public void setIdle(bool force) { // not idle if jumping and force = false if (!force && jump != null && jump.IsJumping()) { return; } if (move != null) { move.stopWalking(); } if (crouch != null) { crouch.noCrouch(); } // due to problems on Unity's initialization order there is a use case where the object isn't instantiated if (idleAC == null) { idleAC = AnimateTiledConfig.getByName(gameObject, EnumAnimateTiledName.Idle, true); } if (idleAC != null) { idleAC.setupAndPlay(); } }
public void noCrouch() { if (sneak != null) { sneak.stopSneaking(); } if (!crouching) { return; } move.stopWalking(); // this force the reset of the sprite animation crouchAC.stop(); crouching = false; // transform the collider Vector3 theCenter = box.center; theCenter.y = colliderCenterY; box.center = theCenter; // resize the collider Vector3 theSize = box.size; theSize.y /= crouchColliderProportion; box.size = theSize; }
public void stopChasing() { if (!operable) { return; } stop = true; if (patrol == null) { body.velocity = Vector2.zero; walk.stopWalking(); if (idle != null) { idle.setIdle(true); } } }
public void stopPatrol() { stop = true; walk.stopWalking(); }