Beispiel #1
0
        public Human getHumanToAttack()
        {
            // Get the hex that the zombie is facing.
            Hex facingHex = MyBoard.getHexNextTo(Location.getHex(), Location.direction);

            if (facingHex != null)
            {
                GameEntity gameEntity = facingHex.MyGameEntity;
                if (gameEntity != null && gameEntity.MyEntityType == EntityType.Player)
                {
                    Player player = (Player)gameEntity;
                    if (player.MyType == Type.Human)
                    {
                        return((Human)player);
                    }
                }

                GameEntity inactiveEntity = facingHex.InactiveEntity;
                if (inactiveEntity != null && inactiveEntity.MyEntityType == EntityType.Player)
                {
                    Player player = (Player)inactiveEntity;
                    if (player.MyType == Type.Human)
                    {
                        return((Human)player);
                    }
                }
            }

            return(null);
        }