示例#1
0
        public static BaseTile GenerateBaseTile(string s, Vector2d tilePosition, ColorScheme c = new ColorScheme())
        {
            BaseTile t;

            switch (s)
            {
            case "#":
                t = new Wall(s, tilePosition);
                break;

            case "o":
                t = new Hero(s, tilePosition);
                break;

            case "g":
                t = new Goal(s, tilePosition);
                break;

            case "k":
                t = new GreenWall(s, tilePosition);
                break;

            case "S":
                t = new Slime(10, tilePosition);
                break;

            default:     //behøver ikke at skabe en tom tile, men gør det fordi..
                t = new BaseTile(s, tilePosition);
                break;
            }
            return(t);
        }
示例#2
0
        public void Move(Vector2d newPos, BaseTile t)
        {
            if (canGoTo(t))
            {
                Position = newPos;
                onTile   = t;
            }
            // Cast til Base Enemy, hvis den tile jeg står på er en BaseEnemy
            BaseEnemy e = onTile as BaseEnemy;

            if (e != null)
            {
                onTile       = e;
                AttackAction = new Attack(this, e);
            }
            //
        }
示例#3
0
 private bool canGoTo(BaseTile b)
 {
     return(b.Walkable);
 }