private void Fight() { RaycastHit[] hits = Physics.RaycastAll(transform.position, transform.forward, 20.0F); foreach (RaycastHit hit in hits) { PRINCESS.Fight.FightTarget target = hit.transform.GetComponent <PRINCESS.Fight.FightTarget>(); if (target == null) { continue; } if (!GetComponent <PRINCESS.Fight.Fighter>().ShouldAttack(target.gameObject)) { continue; } // GetComponent<PRINCESS.Fight.Fighter>().Attack(target.gameObject); PRINCESS.Core.Health targetHealth = target.GetComponent <PRINCESS.Core.Health>(); if (targetHealth == null) { return; } targetHealth.CauseDamage(10f); } }
void Start() { cc = GetComponent <CharacterController>(); anim = GetComponent <Animator>(); // rig = GetComponent<Rigidbody>(); health = GetComponent <PRINCESS.Core.Health>(); currentCoinCount = 0; }