Ignore:
Timestamp:
2013-07-24 23:56:47 (6 years ago)
Author:
dezhidki
Message:

Muokattu sotilaita viimeiseen muotoon.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Entities/Entity.cs

    r4635 r4646  
    8484        } 
    8585 
     86        public virtual void OnTriedExitLevel() { } 
     87 
    8688        public bool Move(float xd, float zd) 
    8789        { 
    8890            if (xd == 0.0F && zd == 0.0F) return false; 
    8991 
    90             if (BoundingRectangle.XRight + xd > level.Width * Viewport.TILESIZE) return false; 
    91             if (BoundingRectangle.XLeft + xd < 0.0F) return false; 
    92             if (BoundingRectangle.ZFar + zd < 0.0F) return false; 
    93             if (BoundingRectangle.ZNear + zd > level.Height * Viewport.TILESIZE) return false; 
     92            bool inLevel = true; 
     93 
     94            if (BoundingRectangle.XRight + xd > level.Width * Viewport.TILESIZE) inLevel = false; 
     95            else if (BoundingRectangle.XLeft + xd < 0.0F) inLevel = false; 
     96            else if (BoundingRectangle.ZFar + zd < 0.0F) inLevel = false; 
     97            else if (BoundingRectangle.ZNear + zd > level.Height * Viewport.TILESIZE) inLevel = false; 
     98 
     99            if (!inLevel) 
     100            { 
     101                OnTriedExitLevel(); 
     102                return false; 
     103            } 
    94104 
    95105            int moveSteps = (int)(Math.Sqrt(xd * xd + zd * zd) + 1); 
Note: See TracChangeset for help on using the changeset viewer.