//awake void Start() { animator = GetComponentInChildren <UnitAnimator_P2>(); playerState = GetComponent <UnitState>(); rb = GetComponent <Rigidbody>(); inputManager = GameObject.FindObjectOfType <InputManager_P2>(); //assign layers and layermasks EnemyLayer = LayerMask.NameToLayer("Enemy"); DestroyableObjectLayer = LayerMask.NameToLayer("DestroyableObject"); EnvironmentLayer = LayerMask.NameToLayer("Environment"); HitLayerMask = (1 << EnemyLayer) | (1 << DestroyableObjectLayer); //display error messages for missing components if (!animator) { Debug.LogError("No player animator found inside " + gameObject.name); } if (!playerState) { Debug.LogError("No playerState component found on " + gameObject.name); } if (!rb) { Debug.LogError("No rigidbody component found on " + gameObject.name); } //set invulnerable during jump if (!invulnerableDuringJump) { HitableStates.Add(UNITSTATE.JUMPING); HitableStates.Add(UNITSTATE.JUMPKICK); HitableStates.Add(UNITSTATE.JUMPPUNCH); //LETHAL FORCES - can not be hurt during jump punch } }
void Start() { //find components if (!animator) { animator = GetComponentInChildren <UnitAnimator_P2>(); } if (!rb) { rb = GetComponent <Rigidbody>(); } if (!playerState) { playerState = GetComponent <UnitState>(); } if (!capsule) { capsule = GetComponent <CapsuleCollider>(); } //error messages for missing components if (!animator) { Debug.LogError("No animator found inside " + gameObject.name); } if (!rb) { Debug.LogError("No Rigidbody component found on " + gameObject.name); } if (!playerState) { Debug.LogError("No UnitState component found on " + gameObject.name); } if (!capsule) { Debug.LogError("No Capsule Collider found on " + gameObject.name); } }