public void UpdateRunningAway() { if (facingDirection == (int)ChickenDirection.kChickenFacingLeft) { position.x -= runAwaySpeed; } else { position.x += runAwaySpeed; } const float kMaxRunSpeed = 12.0f; if (runAwaySpeed < kMaxRunSpeed) { runAwaySpeed += runAwayAcc; } ((Globals.g_world.game).GetMapObject(mapObjectId)).SetPosition(position); (anim[(int)ChickenAnimation.n_RunAway]).Update(); if (!Utilities.IsBetweenP1P2((int)(position.x), -50, 430)) { this.SetState(ChickenState.e_Inactive); } }