37 lines
737 B
C#
37 lines
737 B
C#
using UnityEngine;
|
|
|
|
public class VrAims : MonoBehaviour
|
|
{
|
|
[SerializeField] private GameObject TorpedoAim;
|
|
[SerializeField] private GameObject MissileAim;
|
|
|
|
public void Initialize()
|
|
{
|
|
|
|
|
|
G.WeaponModel.OnWeaponChanged += Refresh;
|
|
Refresh(G.WeaponModel.CurrentWeapon);
|
|
|
|
|
|
}
|
|
|
|
private void Refresh(Weapon newWeapon)
|
|
{
|
|
DisableAll();
|
|
if (newWeapon is TorpedoWeapon torpedoWeapon)
|
|
{
|
|
TorpedoAim.SetActive(true);
|
|
}
|
|
else if (newWeapon is MissileWeapon missileWeapon)
|
|
{
|
|
MissileAim.SetActive(true);
|
|
}
|
|
}
|
|
|
|
private void DisableAll()
|
|
{
|
|
TorpedoAim.SetActive(false);
|
|
MissileAim.SetActive(false);
|
|
}
|
|
}
|