Esempio n. 1
0
        public bool Move(BaseEntity entity, Enums.Intent action)
        {
            entity.OldY = entity.Y;
            entity.OldX = entity.X;

            switch (action)
            {
                case Infrastructure.Enums.Intent.Idle:
                    break;
                case Infrastructure.Enums.Intent.MoveUp:
                    entity.Y -= 1;
                    break;
                case Infrastructure.Enums.Intent.MoveDown:
                    entity.Y += 1;
                    break;
                case Infrastructure.Enums.Intent.MoveRight:
                    entity.X += 1;
                    break;
                case Infrastructure.Enums.Intent.MoveLeft:
                    entity.X -= 1;
                    break;
                default: return false;
            }

            if (!IsLegal(entity.X, entity.Y))
            {
                entity.X = entity.OldX;
                entity.Y = entity.OldY;
                return false;
            }

            return true;
        }
Esempio n. 2
0
 public bool HasEnough(BaseEntity entity)
 {
     return entity.Energy >= EnergyThreshold;
 }