public void getClick(Character.Type objType, int id)
 {
     if (judgement.getCurStatus() == Judge.GameStatus.Gaming)
     {
         checkMove(objType, id);
     }
 }
Beispiel #2
0
 private Configuration(int n, int k, double a, double b,
                       ISelection method1,
                       ISelection method2,
                       ISelection method3,
                       ISelection method4,
                       ICrossover crossover,
                       IMutation mutation,
                       double mutationProbability,
                       IReplacement replacement,
                       IFinisher finisher,
                       Character.Type characterType)
 {
     this.N                  = n;
     this.K                  = k;
     this.A                  = a;
     this.B                  = b;
     this.Method1            = method1;
     this.Method2            = method2;
     this.Method3            = method3;
     this.Method4            = method4;
     this.CrossoverMethod    = crossover;
     this.MutationMethod     = mutation;
     this.ReplacementMethod  = replacement;
     this.MutationProbablity = mutationProbability;
     this.FinishCondition    = finisher;
     this.CharacterType      = characterType;
 }
    public static void SpawnCharacter(Character.Type characterType, BattleHandler.LanePosition lanePosition, bool isPlayerTeam, Character.Stats stats)
    {
        Transform       characterTransform = Object.Instantiate(GameAssets.i.pfCharacterBattle, GetPosition(lanePosition, isPlayerTeam), Quaternion.identity);
        CharacterBattle characterBattle    = characterTransform.GetComponent <CharacterBattle>();

        characterBattle.Setup(characterType, lanePosition, GetPosition(lanePosition, isPlayerTeam), isPlayerTeam, stats);
        instance.characterBattleList.Add(characterBattle);
    }
Beispiel #4
0
 public static Character GetCharacter(Character.Type characterType)
 {
     foreach (Character character in characterList)
     {
         if (character.type == characterType)
         {
             return(character);
         }
     }
     return(null);
 }
Beispiel #5
0
 public EnemyOvermap GetEnemy(Character.Type characterType)
 {
     foreach (EnemyOvermap enemyOvermap in enemyList)
     {
         if (enemyOvermap.GetCharacter().type == characterType)
         {
             return(enemyOvermap);
         }
     }
     return(null);
 }
        public static void Draw(SpriteBatch Spritebatch)
        {
            Spritebatch.Draw(lairBkgd, new Rectangle(-500, -200, 2308, 1200), Color.White);
            Spritebatch.Draw(lairLobby, new Rectangle((int)(towerPosition.X + LeaveMeAlone.WindowX / 3), (int)(towerPosition.Y + LeaveMeAlone.WindowY - 100), 400, 100), Color.White);
            Spritebatch.Draw(bossRoom, new Rectangle((int)(towerPosition.X + LeaveMeAlone.WindowX / 3), (int)(towerPosition.Y + LeaveMeAlone.WindowY - 100 - 100 * (TowerLevel + 1)), 400, 100), Color.White);



            for (int i = 0; i < TowerLevel; i++)
            {
                Spritebatch.Draw(LairRooms[i].img, new Rectangle((int)(towerPosition.X + LeaveMeAlone.WindowX / 3), (int)(towerPosition.Y + LeaveMeAlone.WindowY - 100 - 100 * (i + 1)), 400, 100), Color.White);
                if (selected_flag)
                {
                    Spritebatch.Draw(BattleManager.targeter, new Rectangle((int)(towerPosition.X + LeaveMeAlone.WindowX / 3) + 150, (int)(towerPosition.Y + LeaveMeAlone.WindowY - 100 - 100 * (i + 1)), 100, 100), Color.Red);
                }
            }
            for (int j = 0; j < TowerLevel + 1; j++)
            {
                //This is where is breaks in the final battle
                if (PartyManager.partyQueue[j] != null)
                {
                    Character.Type placeholder  = Character.Type.LairHero;
                    Vector2        characterPos = new Vector2((int)(towerPosition.X + LeaveMeAlone.WindowX / 3), (int)(towerPosition.Y + LeaveMeAlone.WindowY + 20 - 100 * (TowerLevel - j + 1)));
                    Character      newChar      = new Character(placeholder, 1, characterPos);
                    //newChar.Init();
                    newChar.Draw(Spritebatch, Color.White);
                }
            }
            BattleManager.boss.Draw(Spritebatch, Color.White, true);
            int count = 0;

            foreach (UpgradeMenu.ButtonRoom r in boughtRooms)
            {
                r.Draw(Spritebatch, r.used);
                count++;
            }
            nextwaveBtn.Draw(Spritebatch);
            if (EndOfGame)
            {
                grindwaveBtn.Draw(Spritebatch);
            }
            skillsBtn.Draw(Spritebatch);
            constructionBtn.Draw(Spritebatch);
            mainmenuBtn.Draw(Spritebatch);
            InfoText.Draw(Spritebatch);

            if (TutorialText.message != "" && BattleManager.boss.level < 2)
            {
                TutorialText.Draw(Spritebatch);
                Spritebatch.Draw(highlighter, highlighter_rect, new Color(Color.LimeGreen, 120));
            }
        }
Beispiel #7
0
    public static string GetCharacterName(Character.Type characterType)
    {
        Character character = GetCharacter(characterType);

        if (character != null)
        {
            return(character.name);
        }
        else
        {
            return("???");
        }
    }
 public MenuBoss(Character.Type type, Vector2 pos)
 {
     bossType  = type;
     sPosition = pos;
     sTexture  = textures[bossType];
     //funky stuff accounting for sprites
     bounding       = new Rectangle((int)sPosition.X + 50, (int)sPosition.Y, 125, sTexture.Height);
     idleStartFrame = 0;
     idleEndFrame   = 1;
     walkStartFrame = 3;
     walkEndFrame   = 11;
     AddAnimation(12);
     facingRight = true;
 }
Beispiel #9
0
 //Handles which turn it is. Is called by DoneMoving. Turn cycle is Friendly>Enemy>NPC>Friendly atm. This should probably be Friendly>NPC>Enemy>Friendly.
 private void toggleTurn()
 {
     if (activeTeam == Character.Type.FRIENDLY)
     {
         bottomMenu.SetActive(false); //Turns off the "End Turn" button so players can't just skip the enemy's turn.
         activeTeam = Character.Type.ENEMY;
         foreach (CharacterMovement friend in friendlyList)
         {
             //This resets the temporary animation stuff
             friend.ResetTemp();
         }
         loadActiveList(enemyList);
         foreach (CharacterMovement enemy in enemyList)
         {
             //This resets all values of the current team's turn!
             enemy.ResetTurn();
         }
     }
     else if (activeTeam == Character.Type.ENEMY)
     {
         if (NPCList != null && NPCList.Count != 0)
         {
             activeTeam = Character.Type.NPC;
             loadActiveList(NPCList);
         }
         else
         {
             bottomMenu.SetActive(true);
             activeTeam = Character.Type.FRIENDLY;
             foreach (CharacterMovement enemy in enemyList)
             {
                 enemy.ResetTemp();
             }
             loadActiveList(friendlyList);
             foreach (CharacterMovement friend in friendlyList)
             {
                 //This resets the temporary animation stuff
                 friend.ResetTurn();
             }
         }
     }
     else
     {
         bottomMenu.SetActive(true);
         activeTeam = Character.Type.FRIENDLY;
         loadActiveList(friendlyList);
     }
     //Debug.Log(activeTeam);
 }
Beispiel #10
0
    private bool HasKey(Dictionary <Character.Type, List <Character> > dictionary, Character.Type key)
    {
        if (dictionary == null || key == null)
        {
            return(false);
        }

        if (dictionary != null)
        {
            if (dictionary.ContainsKey(key))
            {
                return(true);
            }
        }

        return(false);
    }
Beispiel #11
0
    public Enemy(int ID_, Character.World WORLD_, Character.Type TYPE_, string Name_, int HP_, int ATK_, int DEF_, int COURAGE_, int MANA_, minion M, string description_)
    {
        ID = ID_;

        WORLD = WORLD_;
        TYPE  = TYPE_;

        Name = Name_;

        HP  = HP_ + (int)Mathf.Round(M.gethp());
        ATK = ATK_ + (int)Mathf.Round(M.getatk());
        DEF = DEF_ + (int)Mathf.Round(M.gethp());


        COURAGE = COURAGE_;
        MANA    = MANA_;

        minion      = M;
        Description = description_;
    }
Beispiel #12
0
        private static Configuration LoadConfiguration(ConfigurationFile configFile)
        {
            ISelection method1       = GetSelection(configFile.Method1, configFile),
                       method2       = GetSelection(configFile.Method2, configFile),
                       method3       = GetSelection(configFile.Method3, configFile),
                       method4       = GetSelection(configFile.Method4, configFile);
            ICrossover   crossover   = GetCrossover(configFile.CrossoverMethod);
            IMutation    mutation    = GetMutation(configFile.MutationMethod);
            IReplacement replacement = GetReplacement(configFile.ReplacementMethod, configFile.N, configFile.K);

            Character.Type type     = GetCharacterType(configFile.CharacterType);
            IFinisher      finisher = GetFinisher(configFile.Finish, configFile);

            if (configFile.HeightMutationDelta.HasValue)
            {
                HeightGene.Delta = configFile.HeightMutationDelta.Value;
            }
            return(new Configuration(configFile.N, configFile.K, configFile.A, configFile.B, method1, method2, method3, method4,
                                     crossover, mutation, configFile.MutationProbability, replacement, finisher, type));
        }
Beispiel #13
0
 //This is called when a unit is clicked to show its range of movement
 public void setMask(bool isAttack, bool isHeal, Character.Type type)
 {
     movementMask.gameObject.SetActive(true);
     if (type == Character.Type.ENEMY || isAttack)
     {
         if (isHeal)
         {
             movementMask.color = Color.green;
         }
         else
         {
             movementMask.color = Color.red;
         }
     }
     else if (withinRange)
     {
         movementMask.color = Color.blue;
     }
     else
     {
         movementMask.color = Color.yellow;
     }
 }
Beispiel #14
0
 public EnemyBattle(Character.Type characterType, BattleHandler.LanePosition lanePosition)
 {
     this.characterType = characterType;
     this.lanePosition  = lanePosition;
 }
Beispiel #15
0
 /// <summary>
 /// Typeに該当するCharacterをすべて取得
 /// </summary>
 public IEnumerable <Character> FindAll(Character.Type type = Character.Type.None)
 {
     return(m_CharacterList.FindAll(c => type == Character.Type.None || c.CharaType == type));
 }
 public void getClick(Character.Type objType, int id)
 {
     checkMove(objType, id);
 }
 public void checkMove(Character.Type objType, int id)
 {
     if (objType == Character.Type.classBoat)
     {
         if (boat.canMove())
         {
             boat.Move();
             for (int i = 0; i < 3; i++)
             {
                 if (objPriest[i].position == Character.Status.leftBoat || objPriest[i].position == Character.Status.rightBoat)
                 {
                     objPriest[i].moveOnBoat(boat.isLeft);
                 }
             }
             for (int i = 0; i < 3; i++)
             {
                 if (objDevil[i].position == Character.Status.leftBoat || objDevil[i].position == Character.Status.rightBoat)
                 {
                     objDevil[i].moveOnBoat(boat.isLeft);
                 }
             }
             if (checkLose() == true)
             {
                 cur_status = GameSceneController.GameStatus.Lose;
             }
         }
     }
     else if (objType == Character.Type.classPriest)
     {
         if (objPriest[id].position == Character.Status.leftLand || objPriest[id].position == Character.Status.rightLand)
         {
             if (boat.getCapacity() > 0)
             {
                 objPriest[id].Move(boat.isLeft, boat.getCapacity(), boat.assignSeat());
                 boat.add(objPriest[id].boatSeat);
             }
         }
         else
         {
             objPriest[id].Move(boat.isLeft, boat.getCapacity(), 0);
             boat.remove(objPriest[id].boatSeat);
         }
         if (checkWin() == true)
         {
             cur_status = GameSceneController.GameStatus.Win;
         }
     }
     else if (objType == Character.Type.classDevil)
     {
         if (objDevil[id].position == Character.Status.leftLand || objDevil[id].position == Character.Status.rightLand)
         {
             if (boat.getCapacity() > 0)
             {
                 objDevil[id].Move(boat.isLeft, boat.getCapacity(), boat.assignSeat());
                 boat.add(objDevil[id].boatSeat);
             }
         }
         else
         {
             objDevil[id].Move(boat.isLeft, boat.getCapacity(), 0);
             boat.remove(objDevil[id].boatSeat);
         }
         if (checkWin() == true)
         {
             cur_status = GameSceneController.GameStatus.Win;
         }
     }
 }
 public void getClick(Character.Type objType, int id)
 {
 }
 public void checkMove(Character.Type objType, int id)
 {
     if (objType == Character.Type.classBoat)
     {
         if (boat.canMove())
         {
             boat.Move();
             actionManager.MoveBoat(boat);
             for (int i = 0; i < 3; i++)
             {
                 if (objPriest[i].position == Character.Status.leftBoat || objPriest[i].position == Character.Status.rightBoat)
                 {
                     objPriest[i].moveOnBoat(boat.isLeft);
                     actionManager.MovePriest(objPriest[i]);
                 }
             }
             for (int i = 0; i < 3; i++)
             {
                 if (objDevil[i].position == Character.Status.leftBoat || objDevil[i].position == Character.Status.rightBoat)
                 {
                     objDevil[i].moveOnBoat(boat.isLeft);
                 }
                 actionManager.MoveDevil(objDevil[i]);
             }
             judgement.checkWinOrLose(getPriestNum(Character.Status.leftLand) + getPriestNum(Character.Status.leftBoat), getPriestNum(Character.Status.rightLand) + getPriestNum(Character.Status.rightBoat), getDevilNum(Character.Status.leftLand) + getDevilNum(Character.Status.leftBoat), getDevilNum(Character.Status.rightLand) + getDevilNum(Character.Status.rightBoat));
         }
     }
     else if (objType == Character.Type.classPriest)
     {
         if (objPriest[id].position == Character.Status.leftLand || objPriest[id].position == Character.Status.rightLand)
         {
             if (boat.getCapacity() > 0)
             {
                 objPriest[id].Move(boat.isLeft, boat.getCapacity(), boat.assignSeat());
                 actionManager.MovePriest(objPriest[id]);
                 boat.add(objPriest[id].boatSeat);
             }
         }
         else
         {
             objPriest[id].Move(boat.isLeft, boat.getCapacity(), 0);
             actionManager.MovePriest(objPriest[id]);
             boat.remove(objPriest[id].boatSeat);
         }
         judgement.checkWinOrLose(getPriestNum(Character.Status.leftLand) + getPriestNum(Character.Status.leftBoat), getPriestNum(Character.Status.rightLand) + getPriestNum(Character.Status.rightBoat), getDevilNum(Character.Status.leftLand) + getDevilNum(Character.Status.leftBoat), getDevilNum(Character.Status.rightLand) + getDevilNum(Character.Status.rightBoat));
     }
     else if (objType == Character.Type.classDevil)
     {
         if (objDevil[id].position == Character.Status.leftLand || objDevil[id].position == Character.Status.rightLand)
         {
             if (boat.getCapacity() > 0)
             {
                 objDevil[id].Move(boat.isLeft, boat.getCapacity(), boat.assignSeat());
                 actionManager.MoveDevil(objDevil[id]);
                 boat.add(objDevil[id].boatSeat);
             }
         }
         else
         {
             objDevil[id].Move(boat.isLeft, boat.getCapacity(), 0);
             actionManager.MoveDevil(objDevil[id]);
             boat.remove(objDevil[id].boatSeat);
         }
         judgement.checkWinOrLose(getPriestNum(Character.Status.leftLand) + getPriestNum(Character.Status.leftBoat), getPriestNum(Character.Status.rightLand) + getPriestNum(Character.Status.rightBoat), getDevilNum(Character.Status.leftLand) + getDevilNum(Character.Status.leftBoat), getDevilNum(Character.Status.rightLand) + getDevilNum(Character.Status.rightBoat));
     }
 }
    public void Setup(Character.Type characterType, BattleHandler.LanePosition lanePosition, Vector3 startingPosition, bool isPlayerTeam, Character.Stats stats)
    {
        this.characterType    = characterType;
        this.lanePosition     = lanePosition;
        this.startingPosition = startingPosition;
        this.isPlayerTeam     = isPlayerTeam;
        this.stats            = stats;

        hitUnitAnimType    = GameAssets.UnitAnimTypeEnum.dBareHands_Hit;
        slideLeftUnitAnim  = UnitAnim.GetUnitAnim("dBareHands_SlideLeft");
        slideRightUnitAnim = UnitAnim.GetUnitAnim("dBareHands_SlideRight");

        Vector3 healthWorldBarLocalPosition = new Vector3(0, 10);

        switch (characterType)
        {
        case Character.Type.Player:
            material.mainTexture = GameAssets.i.t_Player;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Idle, GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Walk, 1f, 1f);
            attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Sword;

            if (GameData.GetCharacter(Character.Type.Player).hasFtnDewArmor)
            {
                Texture2D newSpritesheetTexture = new Texture2D(material.mainTexture.width, material.mainTexture.height, TextureFormat.ARGB32, true);
                newSpritesheetTexture.SetPixels((material.mainTexture as Texture2D).GetPixels());
                Color[] ftnDewArmorPixels = GameAssets.i.t_FtnDewArmor.GetPixels(0, 0, 512, 128);
                newSpritesheetTexture.SetPixels(0, 256, 512, 128, ftnDewArmorPixels);
                newSpritesheetTexture.Apply();
                material.mainTexture = newSpritesheetTexture;
            }

            if (GameData.GetCharacter(Character.Type.Player).hasSwordThousandTruths)
            {
                Texture2D newSpritesheetTexture = new Texture2D(material.mainTexture.width, material.mainTexture.height, TextureFormat.ARGB32, true);
                newSpritesheetTexture.SetPixels((material.mainTexture as Texture2D).GetPixels());
                Color[] swordThousandTruthsPixels = GameAssets.i.t_SwordThousandTruths.GetPixels(0, 0, 128, 128);
                newSpritesheetTexture.SetPixels(0, 128, 128, 128, swordThousandTruthsPixels);
                newSpritesheetTexture.Apply();
                material.mainTexture = newSpritesheetTexture;
            }
            break;

        case Character.Type.Tank:
            material.mainTexture = GameAssets.i.t_Tank;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dSwordShield_Idle, GameAssets.UnitAnimTypeEnum.dSwordShield_Walk, 1f, 1f);
            attackUnitAnimType   = GameAssets.UnitAnimTypeEnum.dSwordShield_Attack;
            transform.localScale = Vector3.one * 1.2f;
            break;

        case Character.Type.Healer:
            material.mainTexture = GameAssets.i.t_Healer;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dDualDagger_Idle, GameAssets.UnitAnimTypeEnum.dDualDagger_Walk, 1f, 1f);
            attackUnitAnimType   = GameAssets.UnitAnimTypeEnum.dDualDagger_Attack;
            transform.localScale = Vector3.one * 1.0f;
            break;

        case Character.Type.EvilMonster:
        case Character.Type.EvilMonster_2:
        case Character.Type.EvilMonster_3:
            material.mainTexture = GameAssets.i.t_EvilMonster;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dBareHands_Idle, GameAssets.UnitAnimTypeEnum.dBareHands_Walk, 1f, 1f);
            attackUnitAnimType            = GameAssets.UnitAnimTypeEnum.dBareHands_Punch;
            transform.localScale          = Vector3.one * 1.8f;
            healthWorldBarLocalPosition.y = 9.5f;
            break;

        case Character.Type.Enemy_MinionOrange:
            material.mainTexture = GameAssets.i.t_EnemyMinionOrange;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dMinion_Idle, GameAssets.UnitAnimTypeEnum.dMinion_Walk, 1f, 1f);
            attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dMinion_Attack;
            break;

        case Character.Type.Enemy_MinionRed:
            material.mainTexture = GameAssets.i.t_EnemyMinionRed;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dMinion_Idle, GameAssets.UnitAnimTypeEnum.dMinion_Walk, 1f, 1f);
            attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dMinion_Attack;
            break;

        case Character.Type.Enemy_Ogre:
            material.mainTexture = GameAssets.i.t_Ogre;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dOgre_Idle, GameAssets.UnitAnimTypeEnum.dOgre_Walk, 1f, 1f);
            attackUnitAnimType            = GameAssets.UnitAnimTypeEnum.dOgre_Attack;
            hitUnitAnimType               = UnitAnimType.GetUnitAnimType("dOgre_Hit");
            slideLeftUnitAnim             = UnitAnim.GetUnitAnim("dOgre_SlideLeft");
            slideRightUnitAnim            = UnitAnim.GetUnitAnim("dOgre_SlideRight");
            healthWorldBarLocalPosition.y = 12;
            break;

        case Character.Type.Enemy_Zombie:
            material.mainTexture = GameAssets.i.t_Zombie;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dZombie_Idle, GameAssets.UnitAnimTypeEnum.dZombie_Walk, 1f, 1f);
            attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dZombie_Attack;
            break;
        }
        transform.Find("Body").GetComponent <MeshRenderer>().material = material;

        healthSystem = new HealthSystem(stats.healthMax);
        healthSystem.SetHealthAmount(stats.health);
        healthWorldBar = new World_Bar(transform, healthWorldBarLocalPosition, new Vector3(12 * (stats.healthMax / 100f), 1.6f), Color.grey, Color.red, healthSystem.GetHealthPercent(), UnityEngine.Random.Range(1000, 2000), new World_Bar.Outline {
            color = Color.black, size = .6f
        });
        healthSystem.OnHealthChanged += HealthSystem_OnHealthChanged;
        healthSystem.OnDead          += HealthSystem_OnDead;

        PlayIdleAnim();
    }