diff options
Diffstat (limited to 'SurvivalTest/Assets/Scripts/Equips/LightSaber/Equip_LightSaber.cs')
-rw-r--r-- | SurvivalTest/Assets/Scripts/Equips/LightSaber/Equip_LightSaber.cs | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/SurvivalTest/Assets/Scripts/Equips/LightSaber/Equip_LightSaber.cs b/SurvivalTest/Assets/Scripts/Equips/LightSaber/Equip_LightSaber.cs deleted file mode 100644 index 9066884..0000000 --- a/SurvivalTest/Assets/Scripts/Equips/LightSaber/Equip_LightSaber.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Equip_LightSaber : EquipBase -{ - public override string name => "¹â½£"; - - public override string iconPath => "art/ui/equipicon/light_saber"; - - public override AutoMode autoMode => AutoMode.Condition; - - private string lightSaberPrefabPath = "prefabs/weapon/light_saber"; - - private bool isWielding = false; - - private LightSaber m_LightSaber; - - private TopDownTransform m_TopDownTransform; - - private float m_Dist = 0.2f; - - public override void OnInitialize(GameObject owner) - { - m_LightSaber = UnityEngine.Object.Instantiate<LightSaber>(ResourceManager.Instance.Load<LightSaber>(lightSaberPrefabPath)); - m_TopDownTransform = m_LightSaber.gameObject.GetComponent<TopDownTransform>(); - SetLightSaberPositionAndRotation(owner.GetComponent<CrewScript>()); - m_LightSaber.gameObject.SetActive(false); - } - - public override bool CheckCondition(GameObject owner) - { - return true; - } - - public override void OnTrigger(GameObject owner) - { - if (isWielding) - return; - isWielding = true; - - m_LightSaber.gameObject.SetActive(true); - } - - public override void OnStop(GameObject owner) - { - isWielding = false; - m_LightSaber.gameObject.SetActive(false); - } - - public override void Update(GameObject owner) - { - CrewScript crew = owner.GetComponent<CrewScript>(); - SetLightSaberPositionAndRotation(crew); - } - - void SetLightSaberPositionAndRotation(CrewScript crew) - { - m_LightSaber.transform.position = crew.arrow.position + new Vector3(crew.aimDirection.x, crew.aimDirection.y, 0) * m_Dist; - m_LightSaber.transform.rotation = Quaternion.Euler(0, 0, Mathf.Atan2(crew.aimDirection.y, crew.aimDirection.x) * Mathf.Rad2Deg); - } - -}
\ No newline at end of file |