Пример #1
0
 public void ShowJobSelect(Character c)
 {
     SelectedCharacter = c;
     gameObject.SetActive(true);
     JobSelect.gameObject.SetActive(this);
     JobSelect.Init();
 }
Пример #2
0
        public void OnHeroChanged(Character character, bool value)
        {
            if (value)
                SelectedChar = character;
            else
                SelectedChar = null;

            FillCharInfo();
        }
Пример #3
0
 public bool CheckCharacter(Character c)
 {
     foreach (var p in Requirements)
     {
         var find = c.Attributes.FirstOrDefault(item => item.Key == p.Stat);
         if (find == null || find.Value < p.Value)
             return false;
     }
     return true;
 }
Пример #4
0
        public void CancelTrain(Character selectedChar)
        {
            if (selectedChar.HeroState != Character.State.Train)
                return;
            selectedChar.HeroState = Character.State.Free;
            selectedChar.Trains = null;

            HeroCounts();
            AGEventHandler.Inst.UpdateInfo();
        }
Пример #5
0
 public void CancelHeal(Character c)
 {
     if (c.HeroState == Character.State.Heal)
     {
         c.HeroState = Character.State.Free;
         c.MissionTime = 0;
         HeroCounts();
         AGEventHandler.Inst.UpdateInfo();
     }
 }
Пример #6
0
 public void SendWork(Character c, Job j)
 {
     if (c.HeroState == Character.State.Free)
     {
         c.HeroState = Character.State.Work;
         c.Job = j;
         HeroCounts();
         AGEventHandler.Inst.UpdateInfo();
     }
 }
Пример #7
0
        public void SendTrain(Character c, List<Pair<Data.Stat, int>> train_list, int days, int cost, int sp_cost)
        {
            if (c == null || c.HeroState != Character.State.Free || train_list == null ||
                train_list.Count == 0 || days < 1 || cost > Money || sp_cost > c.SkillPoint)
                return;

            Money -= cost;
            c.HeroState = Character.State.Train;
            c.SkillPoint -= sp_cost;
            c.MissionTime = days;
            c.Trains = train_list;
            HeroCounts();
            AGEventHandler.Inst.UpdateInfo();
        }
Пример #8
0
        public void SendHeal(Character c)
        {
            if (c.HeroState == Character.State.Free && c.Hp < c.MaxHp)
            {
                var cost = HealCost(c);

                if (cost.Value <= Money)
                {
                    Money -= cost.Value;
                    c.HeroState = Character.State.Heal;
                    c.MissionTime = cost.Key;
                    HeroCounts();
                    AGEventHandler.Inst.UpdateInfo();
                }

            }
        }
Пример #9
0
        public void RetireHero(Character c)
        {
            if (c != null && c.HeroState == Character.State.Free)
            {
                Heroes.Remove(c);

                HeroCounts();
                AGEventHandler.Inst.UpdateInfo();
            }
        }
Пример #10
0
 public Pair<int, int> HealCost(Character c)
 {
     var res = new Pair<int, int>();
     int num = c.MaxHp - c.Hp;
     res.Key = num * 2;
     res.Value = num * 25;
     return res;
 }
Пример #11
0
 public void CancelWork(Character selectedChar)
 {
     if (selectedChar.HeroState == Character.State.Work)
     {
         selectedChar.HeroState = Character.State.Free;
         selectedChar.Job = null;
         HeroCounts();
         AGEventHandler.Inst.UpdateInfo();
     }
 }
Пример #12
0
        private void FillList()
        {
            foreach (Transform child in HeroesTransform)
                DestroyObject(child.gameObject);

            bool found = false;

            foreach (var hero in GameController.Inst.Heroes)
            {
                var child = Instantiate(HeroCardPrefab).GetComponent<HeroCardControl>();
                child.Char = hero;

                child.ToggleControl.@group = toggle_group;
                child.transform.SetParent(HeroesTransform);
                if (hero == SelectedChar)
                {
                    child.ToggleControl.isOn = true;
                    found = true;
                }
            }
            if (!found)
                SelectedChar = null;
        }