private void Update() { if (transform.rotation.z >= 0) { hit = Physics2D.Raycast(transform.position, Vector3.left, 5.0f, layerMask); } else { hit = Physics2D.Raycast(transform.position, Vector3.right, 5.0f, layerMask); } if (hit.collider != null) { if (hit.collider.tag == "Shadow") { isHit = true; Debug.Log(hit.collider.name); if (isFrist) { shadowUnit = hit.collider.GetComponent <PlayerShadowUnit>(); shadowUnit.LightDetection(); isFrist = false; } //if(InLight(hit.collider.GetComponent<Transform>().position)) //{ //} } } if (hit.collider == null) { if (shadowUnit == null) { return; } isFrist = true; shadowUnit.Skill1End(); shadowUnit = null; } }
private void DestroySkill() { playerShadow.Skill1End(); Destroy(this.gameObject); }