// Use this for initialization void Start() { animator = _controlledObject.GetComponent <Animator>(); _controlledObject.GetComponent <Rigidbody>().isKinematic = false; animator.applyRootMotion = true; characterController = _controlledObject.GetComponent <AO_CharacterController>(); ChangeLayer(characterController.gameObject, LayerMask.NameToLayer("Player")); //characterController.BecomeInfected(); }
public void ChangeCharacter(Transform newCharacter) //Call this on event "OnCharacterChange" { _controlledObject = newCharacter; animator = _controlledObject.GetComponent <Animator>(); _controlledObject.GetComponent <Rigidbody>().isKinematic = false; animator.applyRootMotion = true; characterController = _controlledObject.GetComponent <AO_CharacterController>(); ChangeLayer(characterController.gameObject, LayerMask.NameToLayer("Player")); characterController.BecomeInfected(); _cameraObject._followTarget = _controlledObject; }
private void OnCollisionEnter(Collision collision) { Debug.Log("COLLISION!"); if (collision.gameObject.layer == LayerMask.NameToLayer("Enemy")) { Debug.Log("ENEMY!"); AO_CharacterController cc = collision.gameObject.GetComponent <AO_CharacterController>(); if (cc != null) { cc.GetHitByProjectile(); } Destroy(gameObject); } else if (collision.gameObject.layer == LayerMask.GetMask("Floor", "Default")) { Debug.Log("STATIC STUFF!"); Destroy(gameObject); } }
private void Awake() { _characterController = GetComponent <AO_CharacterController>(); if (Agent == null) { Agent = GetComponent <NavMeshAgent>(); } if (AIPath == null || AIPath.Length < 1) { ShouldDoPath = false; } else { Agent.speed = (Panicked)?PanickedRunSpeed:WalkSpeed; if (_isPatroling) { StartPatroling(); } } }