public void setIdle(bool force) { // not idle if jumping and force = false if (!force && jump != null && jump.isJumping()) { return; } if (move != null) { move.stop(); } 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.stop(); // 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; }