// *********************************************************************** // Assembly : Game // Author : Kimch // Created : 2020-09-02 // Description : // Last Modified By : // Last Modified On : // *********************************************************************** // // // *********************************************************************** using UnityEngine; namespace G { public class Sword_Extreme : MonoBehaviour { private float _delay; private bool _efOn; private Transform _cha1; private Collider _collider; private Vector3 _startPos; private void Awake() { _cha1 = GameObject.FindWithTag("Player").transform; _collider = this.GetComponent(); } private void OnEnable() { _delay = 1.5f; _efOn = false; this.gameObject.layer = GameLayer.StunAttack; _collider.enabled = true; _startPos = transform.position; } public void SetPower(int _amount) { this.GetComponent().mass = _amount * 0.4f; } private void ColliderOn() { _collider.enabled = false; _collider.enabled = true; } private void Update() { _delay -= Time.deltaTime; if (_delay < -1.5f) { this.GetComponent().Clear(); this.gameObject.SetActive(false); } else if (_delay < -1f) { CancelInvoke(); } else if (_delay < 0f) { transform.position = Vector3.Lerp(transform.position, _cha1.position + Vector3.up * 0.2f, Time.deltaTime * 3.5f); if (!_efOn) { transform.position = _startPos; this.gameObject.layer = GameLayer.RiseupAttack; InvokeRepeating(nameof(ColliderOn), 0.01f, 0.1f); _efOn = true; this.GetComponent().Play(); } } else { transform.position = _cha1.position; } } } }