Exemplo n.º 1
0
        /// <summary>
        /// Spawns a character given the faction, should decide position and random texture
        /// </summary>
        /// <param name="type"></param>
        public Character SpawnCharacter(Faction type)
        {
            Character character = null;

            switch (type)
            {
            case Faction.Good:
                character = new GoodCharacter(mainMan.Rnd.Next(lx, lx + lw), mainMan.Rnd.Next(ly, ly + lh), mainMan.DrawMan.CharacterTextures[Faction.Good], mainMan);
                break;

            case Faction.Tribal:
                character = new TribalCharacter(mainMan.Rnd.Next(rx, rx + rw), mainMan.Rnd.Next(ry, ry + rh), mainMan.DrawMan.CharacterTextures[Faction.Tribal], mainMan);
                break;

            case Faction.Rich:
                character = new RichCharacter(mainMan.Rnd.Next(tx, tx + tw), mainMan.Rnd.Next(ty, ty + th), mainMan.DrawMan.CharacterTextures[Faction.Rich], mainMan);
                break;

            case Faction.Thief:
                character = new ThiefCharacter(mainMan.Rnd.Next(bx, bx + bw), mainMan.Rnd.Next(by, by + bh), mainMan.DrawMan.CharacterTextures[Faction.Thief], mainMan);
                break;
            }

            mainMan.GameMan.Characters.Add(character);
            return(character);
        }
Exemplo n.º 2
0
        public void ReplenishCharacter(Faction type)
        {
            Character character = null;

            //double initialTime = mainMan.GameTime.TotalGameTime.TotalSeconds;
            //double elapsed = 0;
            //while(elapsed < respawnTime)
            //{
            //    elapsed = (mainMan.GameTime.TotalGameTime.TotalSeconds - initialTime);
            //}

            switch (type)
            {
            case Faction.Good:
                if (goodNum > 0 && !mainMan.GameMan.MapMan.Strongholds[0].Captured)
                {
                    character = new GoodCharacter(mainMan.GameMan.LeftStrong.Center.X, mainMan.GameMan.LeftStrong.Center.Y, mainMan.DrawMan.CharacterTextures[Faction.Good], mainMan);
                    goodNum--;
                }
                break;

            case Faction.Tribal:
                if (tribalNum > 0 && !mainMan.GameMan.MapMan.Strongholds[1].Captured)
                {
                    character = new TribalCharacter(mainMan.GameMan.RightStrong.Center.X, mainMan.GameMan.RightStrong.Center.Y, mainMan.DrawMan.CharacterTextures[Faction.Tribal], mainMan);
                    tribalNum--;
                }
                break;

            case Faction.Rich:
                if (richNum > 0 && !mainMan.GameMan.MapMan.Strongholds[2].Captured)
                {
                    character = new RichCharacter(mainMan.GameMan.TopStrong.Center.X, mainMan.GameMan.TopStrong.Center.Y, mainMan.DrawMan.CharacterTextures[Faction.Rich], mainMan);
                    richNum--;
                }
                break;

            case Faction.Thief:
                if (thiefNum > 0 && !mainMan.GameMan.MapMan.Strongholds[3].Captured)
                {
                    character = new ThiefCharacter(mainMan.GameMan.LowerStrong.Center.X, mainMan.GameMan.LowerStrong.Center.Y, mainMan.DrawMan.CharacterTextures[Faction.Thief], mainMan);
                    thiefNum--;
                }
                break;
            }
            if (character != null)
            {
                mainMan.GameMan.Characters.Add(character);
                mainMan.GameMan.CharactersDictionary[type].Add(character);
            }
        }
Exemplo n.º 3
0
        public void SpawnPlayer(Faction type)
        {
            Character character = null;

            switch (type)
            {
            case Faction.Good:
                character = new GoodCharacter(mainMan.Rnd.Next(lx, lx + lw), mainMan.Rnd.Next(ly, ly + lh), mainMan.DrawMan.CharacterTextures[Faction.Good], mainMan);
                break;

                //add the other types for multiplayer support
            }

            Player player = new Player(character, mainMan);

            mainMan.GameMan.Players.Add(player);
            mainMan.GameMan.Characters.Add(character);
        }