Ejemplo n.º 1
0
        public bool drawToScreen;     // As in, DON'T draw relitive to the board

        // Constructor
        public E_Meeple(GameStateManager gameStateManager, Vector2 pos, Player.Type type) : base()
        {
            gsm = gameStateManager;

            switch (type)
            {
            case Player.Type.FRANK:
                this.sprite = gameStateManager.game.spr_Frank;
                break;

            case Player.Type.LOUIE:
                this.sprite = gameStateManager.game.spr_Louie;
                break;

            case Player.Type.MANFORD:
                this.sprite = gameStateManager.game.spr_Manford;
                break;

            case Player.Type.SUE:
                this.sprite = gameStateManager.game.spr_Sue;
                break;

            case Player.Type.VELMA:
                this.sprite = gameStateManager.game.spr_Velma;
                break;

            case Player.Type.WILBER:
                this.sprite = gameStateManager.game.spr_Wilber;
                break;
            }

            drawToScreen = false; // By default, draw to board
        } // end constructor
Ejemplo n.º 2
0
    public void ChangeTile(Tile_Type _type, Player.Type _info)
    {
        Tile new_tile = null;

        switch (_type)
        {
        case Tile_Type.FLATLAND:
            new_tile = Instantiate(Resources.Load <Tile>("Prefabs/Flatland"));
            break;

        case Tile_Type.FOREST:
            new_tile = Instantiate(Resources.Load <Tile>("Prefabs/Forest"));
            break;

        case Tile_Type.MOUNTAIN:
            new_tile = Instantiate(Resources.Load <Tile>("Prefabs/Mountain"));
            break;

        default:
            break;
        }
        if (!new_tile)
        {
            return;
        }
        new_tile.name               = name;
        new_tile.transform.parent   = transform.parent;
        new_tile.transform.position = transform.position;
        new_tile.transform.SetSiblingIndex(transform.GetSiblingIndex());
        new_tile.SetOwner(_info);
        new_tile.SetPlayerHighlight();
        new_tile.GetComponent <TileEditor>().editor_owner = _info;
        new_tile.GetComponent <TileEditor>().editor_type  = _type;
    }
Ejemplo n.º 3
0
        public GameEngine(Player.Type hType, int difficultyLevel, Boolean allAI)
        {
            //initialize infection and player decks and map
            Map         map   = initializeCities();
            Deck <City> ideck = initializeInfectionDeck(map);

            //initialize player deck

            gs     = new GameState(atlanta, map, 4, 4, ideck, initializePlayerDeck(map));
            gs.map = initializeBoard(map);
            if (!allAI)
            {
                gs.players[0].isAI = false;
            }

            foreach (Player p in gs.players)
            {
                gs = gs.drawPlayerCards(p, 5);
                List <City> drawn = gs.playerDeck.mostRecent(5);
                p.cards.AddRange(drawn);
                gs = gs.adjustPlayer(p);
            }


            List <int> cardLocations = makeEpidemicCards(gs.playerDeck.drawDeck.Count, difficultyLevel);

            for (int i = 0; i < cardLocations.Count; i++)
            {
                cardLocations[i] = cardLocations[i] + gs.playerDeck.cardWeAreOn + 1;
            }

            gs.playerDeck.epidemicCards = cardLocations;
            //ev = new HatesDisease(100);
            ev = new outbreakHater(true);
        }
Ejemplo n.º 4
0
        public StartScreen()
        {
            InitializeComponent();

            int hpNum = rand.Next(4);

            switch (hpNum)
            {
            case 0:
                humanPlayerType       = Player.Type.DISPATCHER;
                this.playerType.Image = ((System.Drawing.Image)(Image.FromFile("..\\..\\pics\\dispatcher.png")));
                break;

            case 1:
                humanPlayerType       = Player.Type.MEDIC;
                this.playerType.Image = ((System.Drawing.Image)(Image.FromFile("..\\..\\pics\\medic.png")));
                break;

            case 2:
                humanPlayerType       = Player.Type.OPERATIONS;
                this.playerType.Image = ((System.Drawing.Image)(Image.FromFile("..\\..\\pics\\operationsExpert.png")));
                break;

            case 3:
                humanPlayerType       = Player.Type.RESEARCHER;
                this.playerType.Image = ((System.Drawing.Image)(Image.FromFile("..\\..\\pics\\researcher.png")));
                break;

            case 4:
                humanPlayerType       = Player.Type.SCIENTIST;
                this.playerType.Image = ((System.Drawing.Image)(Image.FromFile("..\\..\\pics\\scientist.png")));
                break;
            }
        }
Ejemplo n.º 5
0
 public StartScreen()
 {
     InitializeComponent();
   
     int hpNum = rand.Next(4);
     
     switch (hpNum)
     {
         case 0:
             humanPlayerType = Player.Type.DISPATCHER;
             this.playerType.Image = ((System.Drawing.Image)(Image.FromFile("..\\..\\pics\\dispatcher.png")));
             break;
         case 1:
             humanPlayerType = Player.Type.MEDIC;
             this.playerType.Image = ((System.Drawing.Image)(Image.FromFile("..\\..\\pics\\medic.png")));
             break;
         case 2:
             humanPlayerType = Player.Type.OPERATIONS;
             this.playerType.Image = ((System.Drawing.Image)(Image.FromFile("..\\..\\pics\\operationsExpert.png")));
             break;
         case 3:
             humanPlayerType = Player.Type.RESEARCHER;
             this.playerType.Image = ((System.Drawing.Image)(Image.FromFile("..\\..\\pics\\researcher.png")));
             break;
         case 4:
             humanPlayerType = Player.Type.SCIENTIST;
             this.playerType.Image = ((System.Drawing.Image)(Image.FromFile("..\\..\\pics\\scientist.png")));
             break;
     }
     
 }
Ejemplo n.º 6
0
        public List <Player> getPlayer(Player.Type type)
        {
            List <Player> typesOfPlayers = new List <Player>();

            foreach (Player player in MyPlayers)
            {
                if (player.MyType == type)
                {
                    typesOfPlayers.Add(player);
                }
            }

            return(typesOfPlayers);
        }
Ejemplo n.º 7
0
    public static Player GetPlayer(Player.Type _type)
    {
        switch (_type)
        {
        case Player.Type.PLAYER1:
            return(Global.PLAYER1);

        case Player.Type.PLAYER2:
            return(Global.PLAYER2);

        default:
            return(null);
        }
    }
Ejemplo n.º 8
0
    public static void SwitchPlayerTurn()
    {
        switch (CurrentPlayer)
        {
        case Player.Type.PLAYER1:
            CurrentPlayer = Player.Type.PLAYER2;
            break;

        case Player.Type.PLAYER2:
            CurrentPlayer = Player.Type.PLAYER1;
            break;

        default:
            break;
        }
    }
Ejemplo n.º 9
0
        public Player(LunchHourGames lhg, String templateName, String displayName, Player.Type type, bool isComputerControlled, PlayerSprite sprite)
            : base(lhg, EntityType.Player, templateName, displayName)
        {
            this.templateName         = templateName;
            this.type                 = type;
            this.isComputerControlled = isComputerControlled;
            this.isActive             = true;
            this.sprite               = sprite;
            this.roll                 = -1; // indicate that a roll has not taken place
            this.walkingSpeed         = 1.0f;

            this.idNumber    = random.Next(10, 1000);
            this.isIdVisible = false;

            this.attributes = new DerivedAttributes();
        }
Ejemplo n.º 10
0
    void SpawnPlayer(int team, Player.Type playerType)
    {
        GameObject player = Instantiate(Resources.Load("PlayerPrefab")) as GameObject;


        Vector2 spawnPos = _spawnRadius * Random.insideUnitCircle;

        // team dependant
        if (team == 1)
        {
            if (_team1.Count() == 0)
            {
                _mainPlayer = player;
            }
            _team1.Add(player);

            player.transform.position = _spawner1.position + new Vector3(spawnPos.x, 0.0f, spawnPos.y);
        }
        else
        {
            _team2.Add(player);

            player.transform.position = _spawner2.position + new Vector3(spawnPos.x, 0.0f, spawnPos.y);
        }


        Player playerInstance = null;

        // type of player
        switch (playerType)
        {
        case Player.Type.MARKSMAN:
            playerInstance = player.AddComponent <Marksman>();
            break;

        case Player.Type.PROTECTOR:
            playerInstance = player.AddComponent <Protector>();
            break;

        case Player.Type.ENGINEER:
            playerInstance = player.AddComponent <Engineer>();
            break;
        }

        // assign a team
        playerInstance.team = team;
    }
Ejemplo n.º 11
0
    public void AddPlayer(GameObject player, Map.Sides side, Player.Type type = Player.Type.Player)
    {
        var oldPlayer = _players.Find(p => p.MapSide == side);

        if (oldPlayer != null)
        {
            oldPlayer.DestroyPlayer();
        }

        var goPlayer = Instantiate(player, GameData.Instance.MapController.GetMap(side).GetOrigin().Position, Quaternion.identity);
        var sPlayer  = goPlayer.GetComponent <Player>();

        sPlayer.PlayerType = type;
        sPlayer.MapSide    = side;
        sPlayer.EndTurn   += EndTurn;
        _players.Add(sPlayer);
    }
Ejemplo n.º 12
0
    public static int GenerateUnit(Unit.Type _type, Player.Type _info, bool _active = true)
    {
        Unit unit;

        switch (_type)
        {
        case Unit.Type.KNIGHT:
            unit = GameObject.Instantiate(Resources.Load <Unit>("Prefabs/Knight"));
            break;

        case Unit.Type.ARCHER:
            unit = GameObject.Instantiate(Resources.Load <Unit>("Prefabs/Archer"));
            break;

        case Unit.Type.WARHOUND:
            unit = GameObject.Instantiate(Resources.Load <Unit>("Prefabs/Warhound"));
            break;

        default:
            Debug.Log("ERROR: Unit type not found");
            return(-1);
        }

        switch (_info)
        {
        case Player.Type.PLAYER1:
            unit.FaceDirection(WarforgedMonoBehaviour.Direction.RIGHT);
            break;

        case Player.Type.PLAYER2:
            unit.FaceDirection(WarforgedMonoBehaviour.Direction.LEFT);
            break;

        default:
            Debug.Log("ERROR: Unit owner unassigned at generation");
            break;
        }
        unit.SetOwner(_info);
        unit.InitializeVariables();
        unit.gameObject.SetActive(_active);
        return(UnitManager.AddUnit(unit));
    }
Ejemplo n.º 13
0
        public static Player.Type getTypeFromString(string typeAsString)
        {
            Player.Type type = Player.Type.Unknown;
            switch (typeAsString)
            {
            case "human":
                type = Player.Type.Human;
                break;

            case "zombie":
                type = Player.Type.Zombie;
                break;

            case "animal":
                type = Player.Type.Animal;
                break;
            }

            return(type);
        }
Ejemplo n.º 14
0
        public Player(GameStateManager gameStateManager, Player.Type type, bool isHuman, KeyboardManager.playerIndex pi)
        {
            this.isHuman = isHuman;
            this.coins   = 0;
            this.stars   = 0;

            this.totalMiniGameWins   = 0;
            this.totalMiniGameLosses = 0;

            this.totalRedSpaceLands     = 0;
            this.totalBlueSpaceLands    = 0;
            this.totalChanceSpaceLands  = 0;
            this.totalSpecialSpaceLands = 0;

            this.totalCoinsGained = 0;
            this.totalCoinsLost   = 0;

            this.playerControlsIndex = pi;

            this.uiColor = Color.White;

            switch (type)
            {
            case Player.Type.FRANK:
                this.meeple         = new E_Meeple(gameStateManager, new Vector2(0, 0), type);
                this.closeupPicture = gameStateManager.game.spr_FrankCloseup;
                this.chancePicture  = gameStateManager.game.spr_chanceFrank;
                this.characterColor = Color.SaddleBrown;
                this.type           = type;
                break;

            case Player.Type.LOUIE:
                this.meeple         = new E_Meeple(gameStateManager, new Vector2(0, 0), type);
                this.closeupPicture = gameStateManager.game.spr_LouieCloseup;
                this.chancePicture  = gameStateManager.game.spr_chanceLouie;
                this.characterColor = Color.Lime;
                this.type           = type;
                break;

            case Player.Type.MANFORD:
                this.meeple         = new E_Meeple(gameStateManager, new Vector2(0, 0), type);
                this.closeupPicture = gameStateManager.game.spr_ManfordCloseup;
                this.chancePicture  = gameStateManager.game.spr_chanceManford;
                this.characterColor = Color.Red;
                this.type           = type;
                break;

            case Player.Type.SUE:
                this.meeple         = new E_Meeple(gameStateManager, new Vector2(0, 0), type);
                this.closeupPicture = gameStateManager.game.spr_SueCloseup;
                this.chancePicture  = gameStateManager.game.spr_chanceSue;
                this.characterColor = Color.Magenta;
                this.type           = type;
                break;

            case Player.Type.VELMA:
                this.meeple         = new E_Meeple(gameStateManager, new Vector2(0, 0), type);
                this.closeupPicture = gameStateManager.game.spr_VelmaCloseup;
                this.chancePicture  = gameStateManager.game.spr_chanceVelma;
                this.characterColor = Color.Yellow;
                this.type           = type;
                break;

            case Player.Type.WILBER:
                this.meeple         = new E_Meeple(gameStateManager, new Vector2(0, 0), type);
                this.closeupPicture = gameStateManager.game.spr_WilberCloseup;
                this.chancePicture  = gameStateManager.game.spr_chanceWilber;
                this.characterColor = Color.DarkOrchid;
                this.type           = type;
                break;
            } // end switch
        }     // end constructor
Ejemplo n.º 15
0
 public void SetOwner(Player.Type _info)
 {
     owner = _info;
 }
Ejemplo n.º 16
0
 public Player.Type owner; //{ get; protected set; }
 public void SetOwner(Player.Type _owner)
 {
     owner = _owner;
 }
Ejemplo n.º 17
0
 public List <Player> getPlayer(Player.Type type)
 {
     return(this.gameEntities.getPlayer(type));
 }
Ejemplo n.º 18
0
 public TurnState(Player.Type _type)
 {
     player_info = _type;
 }
Ejemplo n.º 19
0
 public BuildState(Player.Type _info)
 {
     player_info = _info;
 }
Ejemplo n.º 20
0
        private Player createPlayerFromTemplate(string referenceName)
        {
            Player player = null;

            if (playersDocument == null)
            {
                this.playersDocument = new XmlDocument();
                playersDocument.Load("Content/Xml/players.xml");
            }

            // Check to see if the player template is in our cache already.
            Player cachedPlayer = lhg.Assets.findPlayerTemplateInCache(referenceName);

            if (cachedPlayer != null)
            {
                progress.updateProgress("Loading player template " + referenceName + " from cache", "Loading", 0);
                return(createQuickCopy(cachedPlayer));
            }
            else
            {
                progress.updateProgress("Loading player template " + referenceName + " from disk", "Loading", 0);
                string  xpath      = "/players/player[@referenceName='" + referenceName + "']";
                XmlNode playerNode = playersDocument.SelectSingleNode(xpath);
                if (playerNode != null)
                {
                    PrimaryStatistics stats = null;

                    List <PlayerSpriteSheet> playerSpriteSheetList = null;
                    StaticSprite             hudSprite             = null;
                    InventoryStorage         inventoryStorage      = null;
                    Player.Type type           = Player.getTypeFromString(playerNode.Attributes["type"].Value);
                    XmlNodeList playerChildren = playerNode.ChildNodes;
                    foreach (XmlNode childNode in playerChildren)
                    {
                        switch (childNode.Name)
                        {
                        case "stats":
                            stats = loadStats(childNode);
                            break;

                        case "hud":
                            hudSprite = loadCombatHUDSprite(childNode);
                            break;

                        case "animations":
                            playerSpriteSheetList = loadAnimations(childNode);
                            break;

                        case "inventory":
                            inventoryStorage = loadInventory(childNode);
                            break;
                        }
                    }

                    PlayerSprite playerSprite = new PlayerSprite(lhg, playerSpriteSheetList, PlayerSpriteSheet.Type.Standing);

                    // Create a player for our cache that won't change, so we can quickly create copies
                    if (type == Player.Type.Human)
                    {
                        cachedPlayer = new Human(lhg, referenceName, referenceName, playerSprite);
                    }
                    else if (type == Player.Type.Zombie)
                    {
                        cachedPlayer = new Zombie(lhg, referenceName, referenceName, playerSprite);
                    }

                    cachedPlayer.MyHUDSprite = hudSprite;
                    cachedPlayer.MyInventory = inventoryStorage;
                    lhg.Assets.addPlayerTemplate(cachedPlayer);

                    // Now, create a copy we will use as the real instance
                    player = createQuickCopy(cachedPlayer);
                }
            }

            return(player);
        }
Ejemplo n.º 21
0
 public static void SetPlayerTurn(Player.Type _type)
 {
     CurrentPlayer = _type;
 }
Ejemplo n.º 22
0
 void Start()
 {
     PlayerType = Player.instance.PlayerType;
 }