您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
49 行
1.2 KiB
49 行
1.2 KiB
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class TankShooting : MonoBehaviour
|
|
{
|
|
public int m_PlayerNumber = 1;
|
|
public Rigidbody m_Shell;
|
|
public Transform m_FireTransform;
|
|
public Slider m_AimSlider;
|
|
public AudioSource m_ShootingAudio;
|
|
public AudioClip m_ChargingClip;
|
|
public AudioClip m_FireClip;
|
|
public float m_MinLaunchForce = 15f;
|
|
public float m_MaxLaunchForce = 30f;
|
|
public float m_MaxChargeTime = 0.75f;
|
|
|
|
/*
|
|
private string m_FireButton;
|
|
private float m_CurrentLaunchForce;
|
|
private float m_ChargeSpeed;
|
|
private bool m_Fired;
|
|
|
|
|
|
private void OnEnable()
|
|
{
|
|
m_CurrentLaunchForce = m_MinLaunchForce;
|
|
m_AimSlider.value = m_MinLaunchForce;
|
|
}
|
|
|
|
|
|
private void Start()
|
|
{
|
|
m_FireButton = "Fire" + m_PlayerNumber;
|
|
|
|
m_ChargeSpeed = (m_MaxLaunchForce - m_MinLaunchForce) / m_MaxChargeTime;
|
|
}
|
|
*/
|
|
|
|
private void Update()
|
|
{
|
|
// Track the current state of the fire button and make decisions based on the current launch force.
|
|
}
|
|
|
|
|
|
private void Fire()
|
|
{
|
|
// Instantiate and launch the shell.
|
|
}
|
|
}
|