using System;

using Icarus.Graphics.Animation;

namespace Icarus.Logic.Physics 
{
	/// <summary>
	/// Summary description for PhysicsMerc.
	/// </summary>
	public class PhysicsMerc : PhysicsPlayer
	{

        #region Declarations

        /// <summary>
        /// The number of engine interations the whip
        /// remains visable
        /// </summary>
        private int iWhipDuration;

        /// <summary>
        /// the number of engine interations the whip has been displayed
        /// </summary>
        private int iWhipInterations;

        private PhysicsWhip coWhip;//ChildObject coWhip;

        /// <summary>
        /// The spark that shows up when the whip hits something
        /// </summary>
        private ChildObject coHitSpark;

        /// <summary>
        /// Collision box for whip that hits enemies
        /// </summary>
        private CollisionBoxWhip cbWhipHit;

        /// <summary>
        /// collision box for whip that does not hit enemies
        /// </summary>
        private CollisionBoxWhip cbWhipNoHit;

        /// <summary>
        /// The number of consecutive jumps that merc can make
        /// </summary>
        private int iConsecutiveJumpsAllowed;

        /// <summary>
        /// The number of consecutive jumps merc has made
        /// </summary>
        private int iCurrentConsecutiveJumps;

        /// <summary>
        /// Whether or not merc is throwing a CD
        /// </summary>
        private bool bThrowingCD;

        private PhysicsShortLife woCD;

        #endregion

        #region Construction

		public PhysicsMerc()
		{
            cbWhipHit = new CollisionBoxWhip();
            cbWhipNoHit = new CollisionBoxWhip();
            coWhip = new PhysicsWhip();//ChildObject();

            coWhip.Parent = this;
            coWhip.CollisionBox = cbWhipHit;
            coWhip.CBXoffset = -75;
            coWhip.CBYoffset = 140;
            coWhip.AnchorPoint = new Icarus.Logic.Physics.Point(0, 0, 0);

            //Default health
            this.GameStats.Health = 100;

			this.CollisionBox.BoundingBox.X = 0;
            this.CollisionBox.BoundingBox.Y = 0;
            this.CollisionBox.BoundingBox.Width = 50;
            this.CollisionBox.BoundingBox.Height = 170;
            this.CollisionBox.BoundingBoxWidth = 50;
            this.CollisionBox.BoundingBoxHeight = 170;
            this.CBXoffset = 30;
            this.CBYoffset = this.CollisionBox.BoundingBoxHeight;
			this.po_gravity = PhysicsSettings.Instance.sv_mercGravity;
			this.SetAnimation("merc/stand_left/frameset/stand_left.png", AnimationType.LoopForever, 1);
            this.iConsecutiveJumpsAllowed = 2;
            this.iCurrentConsecutiveJumps = 0;
            this.iWhipDuration = 25;
            this.iWhipInterations = 0;

            
            cbWhipHit.WO = this.coWhip;
            cbWhipHit.BoundingBox.X = 0;
            cbWhipHit.BoundingBox.Y = 0;
            cbWhipHit.BoundingBox.Width = 130;
            cbWhipHit.BoundingBox.Height = 10;
            cbWhipHit.BoundingBoxWidth = 130;
            cbWhipHit.BoundingBoxHeight = 10;

            
            cbWhipNoHit.WO = this.coWhip;
            cbWhipNoHit.BoundingBox.X = 0;
            cbWhipNoHit.BoundingBox.Y = 0;
            cbWhipNoHit.BoundingBox.Width = 1;
            cbWhipNoHit.BoundingBox.Height = 1;
            cbWhipNoHit.BoundingBoxWidth = 1;
            cbWhipNoHit.BoundingBoxHeight = 1;

            //Setup hit spark
            coHitSpark = new ChildObject();
            coHitSpark.Parent = this;
            coHitSpark.SetAnimation(@"\hit\hit.png", Icarus.Graphics.Animation.AnimationType.LoopOnce, 3);
            coHitSpark.AnchorPoint = new Icarus.Logic.Physics.Point(210, -140, 0);

            //Preload animations:
            Frameset f = FramesetManager.getInstance().getFrameset(@"\merc\whip_left\frameset\whip_whip_left.png");
            f = FramesetManager.getInstance().getFrameset(@"\merc\whip_left\frameset\whip_left.png");
            f = FramesetManager.getInstance().getFrameset(@"\merc\whip_right\frameset\whip_whip_right.png");
            f = FramesetManager.getInstance().getFrameset(@"\merc\whip_right\frameset\whip_right.png");

            //We are not throwing a CD at the moment
            this.bThrowingCD = false;
		}

        #endregion

        #region Properties

        /// <summary>
        /// Gets or set the number of consecutive jumps merc is allowed to make
        /// </summary>
        public int ConsecutiveJumpsAllowed
        {
            get { return this.iConsecutiveJumpsAllowed; }
            set { this.iConsecutiveJumpsAllowed = value; }
        }

        #endregion


        #region Methods

        /// <summary>
        /// Perform a whip attack
        /// </summary>
        public void whip()
        {
            if((this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.StandingLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingUpSlopeLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingDownSlopeLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.JumpingLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.FallingLeft))
            {
                this.walkStop();
                this.LastActionState = this.ActionState;
                this.ActionState = (int)PhysicsSettings.enumPlayerActionStates.WhippingLeft;
                
                //Create whip object
                coWhip.SetAnimation(@"\merc\whip_left\frameset\whip_whip_left.png", Icarus.Graphics.Animation.AnimationType.LoopOnce, 5);
				this.AddChildObject(coWhip);

				// Play the whip sound:
				Icarus.SoundEngine.SoundEngine.Instance.PlayRandomSoundFrom("merc/whip");
            }
            else if((this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.StandingRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingUpSlopeRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingDownSlopeRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.JumpingRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.FallingRight))
            {
                this.walkStop();
                this.LastActionState = this.ActionState;
                this.ActionState = (int)PhysicsSettings.enumPlayerActionStates.WhippingRight;

                //Create whip object
                coWhip.SetAnimation(@"\merc\whip_right\frameset\whip_whip_right.png", Icarus.Graphics.Animation.AnimationType.LoopOnce, 5);
				this.AddChildObject(coWhip);

				// Play the whip sound:
				Icarus.SoundEngine.SoundEngine.Instance.PlayRandomSoundFrom("merc/whip");
            }
        }

        /// <summary>
        /// Causes merc to throw a CD
        /// </summary>
        public void throwCD()
        {
            if((this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.StandingLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingUpSlopeLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingDownSlopeLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.JumpingLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.FallingLeft))
            {
                this.walkStop();
                this.LastActionState = this.ActionState;
                this.ActionState = (int)PhysicsSettings.enumPlayerActionStates.WhippingLeft;
                
                //Create whip object
                coWhip.SetAnimation(@"\merc\whip_left\frameset\whip_whip_left.png", Icarus.Graphics.Animation.AnimationType.LoopOnce, 5);
                this.bThrowingCD = true;

                // Play the whip sound:
                //Icarus.SoundEngine.SoundEngine.Instance.PlayRandomSoundFrom("merc/whip");
            }
            else if((this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.StandingRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingUpSlopeRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingDownSlopeRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.JumpingRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.FallingRight))
            {
                this.walkStop();
                this.LastActionState = this.ActionState;
                this.ActionState = (int)PhysicsSettings.enumPlayerActionStates.WhippingRight;

                //Create whip object
                coWhip.SetAnimation(@"\merc\whip_right\frameset\whip_whip_right.png", Icarus.Graphics.Animation.AnimationType.LoopOnce, 5);
                this.bThrowingCD = true;                

                // Play the whip sound:
                //Icarus.SoundEngine.SoundEngine.Instance.PlayRandomSoundFrom("merc/whip");
            }
        }


        /// <summary>
        /// Make this player jump
        /// </summary>
        public override void jump()
        {
            if((this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.StandingLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingUpSlopeLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingDownSlopeLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.JumpingLeft) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.FallingLeft))
            {
                this.iCurrentConsecutiveJumps++;
                if(this.iCurrentConsecutiveJumps <= this.ConsecutiveJumpsAllowed)
                {
                    this.Velocity.j = 0.0f;
                    this.Velocity.j += PhysicsSettings.Instance.JumpVelocity;
                    this.LastActionState = this.ActionState;
                    this.ActionState = (int)PhysicsSettings.enumPlayerActionStates.JumpingLeft;
                }
            }
            else if((this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.StandingRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingUpSlopeRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WalkingDownSlopeRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.JumpingRight) ||
                (this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.FallingRight))
            {
                this.iCurrentConsecutiveJumps++;
                if(this.iCurrentConsecutiveJumps <= this.ConsecutiveJumpsAllowed)
                {
                    this.Velocity.j = 0.0f;
                    this.Velocity.j += PhysicsSettings.Instance.JumpVelocity;
                    this.LastActionState = this.ActionState;
                    this.ActionState = (int)PhysicsSettings.enumPlayerActionStates.JumpingRight;
                }
            }
            
        }

        /// <summary>
        /// This guy makes specific special updates.
        /// For example, it changes animations depending on current states.
        /// </summary>
        public override int specificUpdates() 
        {
            if(PhysicsSettings.Instance.GodMode)
            {
                this.GameStats.Health = 100;
            }

            if(this.GameStats.Health <= 0)
            {
                this.stopAll();
                //Just using iconsecutive jumps because it will not be used not that merc is dead
                this.iCurrentConsecutiveJumps++;
                if(this.iCurrentConsecutiveJumps > 5*45)//5 secs at normal engine speed
                {
                    Icarus.Logic.GameEngine.GameEngine.Instance.PopState();
                }
                return (int)PhysicsSettings.enumActions.DoNothing;
            }

            //Shouldn't be moving if standing
            if((this.ActionState == (int)Physics.PhysicsSettings.enumPlayerActionStates.WalkingRight ||
                this.ActionState == (int)Physics.PhysicsSettings.enumPlayerActionStates.WalkingLeft) && 
                Math.Abs(this.Velocity.i) > (int)PhysicsSettings.Instance.WalkVelocity)
            {
                this.Velocity.i = 0f;
                this.Velocity.j = 0f;
            }

            if(!this.Vulnerable)
            {
                this.InvulnerableIterationCount++;
                if(this.InvulnerableIterationCount > this.InvulnerableIterationLimit)
                {
                    this.Vulnerable = true;
                    this.InvulnerableIterationCount = 0;
                }
            }

            //Clear consecutive jumps
            if((this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.JumpingLeft) &&
                (this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.JumpingRight) &&
                (this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.FallingLeft) &&
                (this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.FallingRight))
            {
                this.iCurrentConsecutiveJumps = 0;
            }

            

            //Make sure state is standing or whipping if not moving
            if(this.Velocity.magnitude == 0 && 
                this.LastActionState != (int)PhysicsSettings.enumPlayerActionStates.JumpingRight &&
                this.LastActionState != (int)PhysicsSettings.enumPlayerActionStates.JumpingLeft &&
                this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.WhippingRight &&
                this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.WhippingLeft)
            {
                if(this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.StandingRight &&
                    this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.StandingLeft)
                {
                    this.ActionState = (int)PhysicsSettings.enumPlayerActionStates.StandingRight;
                }
            }
            
            //Set actionstate accordingly
            if(this.Velocity.j > (PhysicsSettings.Instance.sv_gravity.j) && this.Velocity.i < 0)
            {
                if(this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.WalkingDownSlopeLeft &&
                    this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.WalkingLeft &&
                   this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.WhippingLeft)
                {
                    this.ActionState = (int)PhysicsSettings.enumPlayerActionStates.FallingLeft;
                }
            }
            else if(this.Velocity.j > (PhysicsSettings.Instance.sv_gravity.j) && this.Velocity.i > 0)
            {
                if(this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.WalkingDownSlopeRight &&
                    this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.WalkingRight &&
                   this.ActionState != (int)PhysicsSettings.enumPlayerActionStates.WhippingRight)
                {
                    this.ActionState = (int)PhysicsSettings.enumPlayerActionStates.FallingRight;
                }
            }
            else if(this.Velocity.j > (PhysicsSettings.Instance.sv_gravity.j) && this.Velocity.i == 0)
            {
                if(this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.JumpingRight)
                {
                    this.ActionState = (int)PhysicsSettings.enumPlayerActionStates.FallingRight;
                }
                else if(this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.JumpingLeft)
                {
                    this.ActionState = (int)PhysicsSettings.enumPlayerActionStates.FallingLeft;
                }
            }
            
            if(this.LastActionState != this.ActionState)
            {
                //The whip should only be displayed while in a whipping state
                if(this.ActionState != (int)Physics.PhysicsSettings.enumPlayerActionStates.WhippingLeft &&
                    this.ActionState != (int)Physics.PhysicsSettings.enumPlayerActionStates.WhippingRight)
                {
                    this.RemoveChildObject(coHitSpark);
                    this.RemoveChildObject(coWhip);
                }

                //which state to change animation to?
                switch (this.ActionState)
                {
                        //TODO: Have the animations stored in the level or player type. ie: don't manually set
                    case (int)Physics.PhysicsSettings.enumPlayerActionStates.StandingLeft:
                        //Set standing animation
                        this.SetAnimation("/merc/stand_left/frameset/stand_left.png", AnimationType.LoopForever, 1);
                        break;
                    case (int)Physics.PhysicsSettings.enumPlayerActionStates.StandingRight:
                        //set standing animation
                        this.SetAnimation("/merc/stand_right/frameset/stand_right.png", AnimationType.LoopForever, 1);
                        break;
                    case (int)Physics.PhysicsSettings.enumPlayerActionStates.WalkingLeft:
                        //Set walking left animation
                        this.SetAnimation("/merc/walk_left_loop/frameset/walk_left_loop.png", AnimationType.LoopForever, 5);
                        break;
                    case (int)Physics.PhysicsSettings.enumPlayerActionStates.WalkingRight:
                        //Set walking right animation
                        this.SetAnimation("/merc/walk_right_loop/frameset/walk_right_loop.png", AnimationType.LoopForever, 5);
                        break;
                    case (int)Physics.PhysicsSettings.enumPlayerActionStates.WalkingUpSlopeLeft:
                        //Set walking left animation
                        this.SetAnimation("/merc/walk_left_loop/frameset/walk_left_loop.png", AnimationType.LoopForever, 5);
                        break;
                    case (int)Physics.PhysicsSettings.enumPlayerActionStates.WalkingUpSlopeRight:
                        //Set walking right animation
                        this.SetAnimation("/merc/walk_right_loop/frameset/walk_right_loop.png", AnimationType.LoopForever, 5);
                        break;
                    case (int)Physics.PhysicsSettings.enumPlayerActionStates.JumpingLeft:
                        //Set jumping left animation
                        this.SetAnimation("/merc/jump_left/frameset/jump_left.png", AnimationType.LoopForever, 10);
                        break;
                    case (int)Physics.PhysicsSettings.enumPlayerActionStates.JumpingRight:
                        //Set jumping right animation
                        this.SetAnimation("/merc/jump_right/frameset/jump_right.png", AnimationType.LoopForever, 10);
                        break;
                    case (int)Physics.PhysicsSettings.enumPlayerActionStates.FallingLeft:
                        //Set falling left animation
                        this.SetAnimation("/merc/fall_left/frameset/fall_left.png", AnimationType.LoopForever, 1);
                        break;
                    case (int)Physics.PhysicsSettings.enumPlayerActionStates.FallingRight:
                        //Set falling right animation
                        this.SetAnimation("/merc/fall_right/frameset/fall_right.png", AnimationType.LoopForever, 1);
                        break;
                    case (int)Physics.PhysicsSettings.enumPlayerActionStates.WhippingLeft:
                        this.SetAnimation(@"\merc\whip_left\frameset\whip_left.png", Icarus.Graphics.Animation.AnimationType.LoopOnce, 5);
                        break;
                    case (int)Physics.PhysicsSettings.enumPlayerActionStates.WhippingRight:
                        this.SetAnimation(@"\merc\whip_right\frameset\whip_right.png", Icarus.Graphics.Animation.AnimationType.LoopOnce, 5);
                        break;

                }
                this.LastActionState = this.ActionState;

            }
            else if(this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WhippingLeft ||
                    this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WhippingRight)
            {
                iWhipInterations++;
                    
                //Should we show a spark
                if(((CollisionBoxWhip)coWhip.CollisionBox).ShowSpark)
                {
                    this.AddChildObject(coHitSpark);
                    if(this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WhippingLeft)
                    {
                        coHitSpark.AnchorPoint.x = -210;
                    }
                    else
                    {
                        coHitSpark.AnchorPoint.x = 210;
                    }
                    
                     coHitSpark.SetAnimation(@"\hit\hit.png", Icarus.Graphics.Animation.AnimationType.LoopOnce, 3);
                    ((CollisionBoxWhip)coWhip.CollisionBox).ShowSpark = false;
                }

                if(iWhipInterations == 5 && this.bThrowingCD)
                {
                    int i;
                    for(i = 0; i < Logic.GameEngine.GameSettings.Instance.sv_maxActors; i++)
                    {
                        if(PhysicsEngine.Instance.currentLevel.CurrStage.actorList[i] == null) break;
                    }
                    //is there room?
                    if((Logic.GameEngine.GameSettings.Instance.sv_maxActors - 1) > i)
                    {
                        if(this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WhippingLeft)
                        {
                            woCD = null;
                            woCD = new PhysicsShortLife();
                            woCD.IterationsToLive = 30;
                            woCD.FlickerTime = 0;
                            Icarus.Logic.Physics.Vector vec = new Vector();
                            vec.j = PhysicsSettings.Instance.sv_mercGravity.j;
                            Physics.Vector.ScalarMultVector(vec, vec, .35f);
                            woCD.po_gravity = vec;
                            woCD.CollisionBox = new CollisionBoxCD();
                            woCD.Location.x = this.Location.x;
                            woCD.Location.y = this.Location.y-125;
                            woCD.SetAnimation(@"\cd\cd_fset.png", Icarus.Graphics.Animation.AnimationType.LoopForever, 1);
                            woCD.Velocity.i = -40;
                            woCD.Velocity.j = -10;
                            PhysicsEngine.Instance.currentLevel.CurrStage.actorList[i] = woCD;

                        }
                        else if(this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WhippingRight)
                        {
                            woCD = null;
                            woCD = new PhysicsShortLife();
                            woCD.IterationsToLive = 30;
                            woCD.FlickerTime = 0;
                            Icarus.Logic.Physics.Vector vec = new Vector();
                            vec.j = PhysicsSettings.Instance.sv_mercGravity.j;
                            Physics.Vector.ScalarMultVector(vec, vec, .35f);
                            woCD.po_gravity = vec;
                            woCD.CollisionBox = new CollisionBoxCD();
                            woCD.Location.x = this.Location.x;
                            woCD.Location.y = this.Location.y-125;
                            woCD.SetAnimation(@"\cd\cd_fset.png", Icarus.Graphics.Animation.AnimationType.LoopForever, 1);
                            woCD.Velocity.i = 40;
                            woCD.Velocity.j = -10;
                            PhysicsEngine.Instance.currentLevel.CurrStage.actorList[i] = woCD;
                        }

                    }
                    this.bThrowingCD = false;
                }

                //Add collision box when whip is extended
                if(iWhipInterations == 15)
                {
                    //Change offset for new collision box depending on direction of action
                    if(this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WhippingLeft)
                    {
                        coWhip.CBXoffset = 200;
                    }
                    else if(this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WhippingRight)
                    {
                        coWhip.CBXoffset = -75;
                    }
                    //Set child whip object's collision box to whiphit
                    coWhip.CollisionBox = cbWhipHit;
                }
                if(iWhipInterations >= iWhipDuration)
                {
                    //Remove collision box
                    coWhip.CollisionBox = cbWhipNoHit;

                    //Remove spark
                    this.RemoveChildObject(coHitSpark);
                    
                    //Remove whip 
                    this.RemoveChildObject(coWhip);
                    iWhipInterations = 0;
                    if(this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WhippingRight)
                    {
                        this.ActionState = (int)PhysicsSettings.enumPlayerActionStates.StandingRight;
                    }
                    else if(this.ActionState == (int)PhysicsSettings.enumPlayerActionStates.WhippingLeft)
                    {
                        this.ActionState = (int)PhysicsSettings.enumPlayerActionStates.StandingLeft;
                    }
                }

            }

            return (int)PhysicsSettings.enumActions.DoNothing;
            
        }
    #endregion

	}
}
