private void Start() { // get the components on the object we need ( should be not null due to require component so no need to check ) agent = GetComponentInChildren <NavMeshAgent>(); character = GetComponent <ClimbCharacter>(); climbController = GetComponentInChildren <ClimbController>(); climbController.climbEvent += ClimbEvent; GetComponentInChildren <PlayerDetector>().detectPlayerEvent += OnDetectPlayer; GetComponentInChildren <MeleeAttack>().attackEvent += AttackEvent; m_Sound = GetComponent <SoundManager>(); agent.updateRotation = false; agent.updatePosition = true; fsm = new FSM(this, new FSM.StateMethod[] { Wander, Chase, ClimbInChase, JumpInChase, Die, Attack }); fsm.Start(); }
private void Start() { // get the transform of the main camera if (Camera.main != null) { m_Cam = Camera.main.transform; } else { Debug.LogWarning( "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.", gameObject); // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them! } // get the third person character ( this should never be null due to require component ) m_Character = GetComponent <ClimbCharacter>(); climbController = GetComponentInChildren <ClimbController>(); climbController.climbEvent += ClimbEvent; //climbController.jumpEvent += JumpEvent; //Uncomment to hablity jump against wall or double jump frisbeeThrower = GetComponentInChildren <FrisbeeThrower>(); GetComponent <Health>().onChangeHealthEvent += ChangeHealth; }