示例#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;
        }