Ejemplo n.º 1
0
        void Awake()
        {
            GameManager       GM      = GameObject.Find("GameManager").GetComponent <GameManager>();
            CombatManager     CM      = CombatManager.instance;
            MonsterController monster = null;
            HeroController    hero    = GameObject.Find(GM.GetHeroByPID(CM.battleHeroID)).GetComponent <HeroController>();

            if (hero.GetHeroID() != HeroSelection.HS.mySelectedCharacter)
            {
                foreach (GameObject m in GM.getMonsterList())
                {
                    if (m.GetComponent <MonsterController>().getCurrentPosition().GetComponent <Node>().getRank() == CM.MonsterFighterID)
                    {
                        monster = m.GetComponent <MonsterController>();
                        break;
                    }
                }

                monster.GetMonster().Recover();
            }



            CM.battleHeroID     = 0;
            CM.MonsterFighterID = 0;
            CM.heroRetreaterID  = 0;

            Destroy(this);
        }
Ejemplo n.º 2
0
        void Awake()
        {
            GameManager       GM      = GameObject.Find("GameManager").GetComponent <GameManager>();
            CombatManager     CM      = CombatManager.instance;
            MonsterController monster = null;
            HeroController    hero    = GameObject.Find(GM.GetHeroByPID(CM.battleHeroID)).GetComponent <HeroController>();

            if (hero.GetHeroID() != HeroSelection.HS.mySelectedCharacter)
            {
                foreach (GameObject m in GM.getMonsterList())
                {
                    if (m.GetComponent <MonsterController>().getCurrentPosition().GetComponent <Node>().getRank() == CM.MonsterFighterID)
                    {
                        monster = m.GetComponent <MonsterController>();
                        break;
                    }
                }

                int result = CM.heroSyncBV - CM.monsterSyncBV;

                if (result > 0)
                {
                    monster.GetMonster().TakeDamage(result);
                }
                else
                {
                    hero.getHero().TakeDamage(result);
                }
                hero.TimeTrackTick();
            }


            CM.monsterSyncBV = 0;
            CM.heroSyncBV    = 0;


            Destroy(this);
        }