void deductHealth(Collider col) { if (healthManager = col.GetComponent<Health>()){ healthManager.takeDamage(20f); } else if (NPCStats = col.GetComponent(typeof(F_Stats)) as F_Stats){ NPCStats.takeDamage(20f); } else if (tRig = col.rigidbody.GetComponentInChildren<AIRig>()) { Debug.Log (tRig); float currentHelath = tRig.AI.WorkingMemory.GetItem<float>("health"); tRig.AI.WorkingMemory.SetItem<float>("health", currentHelath - 20f); } }
public DestroyedState(F_TankController NPC) { stateID = StateID.Destroyed; myController = NPC; mySensor = myController.GetComponentInChildren<F_PasiveSensor>(); myNav = myController.GetComponent<NavMeshAgent>(); myTargetting = myController.GetComponent<F_Targetting>(); myAttack = myController.GetComponent<TankMinionAttack>(); myStats = myController.GetComponent<F_Stats>(); myControlMode = myController.GetComponent<F_ControlMode>(); }