コード例 #1
0
 public void SetAbility(Ability ability, bool isSelected)
 {
     currentAbility = ability;
     if (ability == null)
     {
         icon.sprite       = null;
         icon.color        = ColorPallete.GetColor("Grey");
         highlight.enabled = false;
     }
     else
     {
         icon.sprite = SpriteLibrary.GetAbilitySprite(ability.abilityName);
         icon.color  = Color.white;
         tooltip.SetAbility(ability);
         tooltip.gameObject.SetActive(false);
         selected = isSelected;
         if (selected)
         {
             highlight.enabled = true;
         }
         else
         {
             highlight.enabled = false;
         }
     }
 }
コード例 #2
0
 public void Select(bool isSelected)
 {
     if (isSelected)
     {
         border.color = ColorPallete.GetColor("Orange");
     }
     else
     {
         border.color = Color.grey;
     }
 }
コード例 #3
0
 protected IEnumerator RecoverTeam(Unit actor)
 {
     foreach (Unit u in actor.UnitTeam.GetUnits())
     {
         if (u == actor)
         {
             continue;
         }
         u.stats.StressDamage(stressHeal);
         u.CreatePopUpText(stressHeal.ToString(), ColorPallete.GetColor("White"));
         yield return(new WaitForSeconds(0.2f));
     }
 }
コード例 #4
0
 public virtual IEnumerator StressTeam(Unit actor)
 {
     foreach (Unit u in actor.UnitTeam.GetUnits())
     {
         if (u == actor)
         {
             continue;
         }
         u.stats.StressDamage(stressDamage);
         u.CreatePopUpText(stressDamage.ToString(), ColorPallete.GetColor("Purple"));
         yield return(new WaitForSeconds(0.2f));
     }
 }
コード例 #5
0
 public void SetAbility(Ability a)
 {
     //reset
     abilityName.text   = "";
     usable.sprite      = null;
     targets.sprite     = null;
     abilityStats.text  = "";
     selfEffects.text   = "";
     targetEffects.text = "";
     if (a == null)
     {
         return;
     }
     abilityName.text = a.abilityName;
     usable.sprite    = a.usable.single;
     usable.color     = ColorPallete.GetColor("Highlight Blue");
     targets.sprite   = a.isAOE ? a.targetable.aoe : a.targetable.single;
     targets.color    = a.IsAttack ? ColorPallete.GetColor("Highlight Red") : ColorPallete.GetColor("Green");
     if (a.IsAttack)
     {
         Ability_Attack aa = (Ability_Attack)a;
         abilityStats.text = string.Format("<color={2}><b>Accuracy</b></color>: {0}{1}%\n",
                                           aa.accmod >= 0 ? "+" : "-", aa.accmod, ColorPallete.GetHexColor("Grey"));
         abilityStats.text += string.Format("<color={1}><b>Damage</b></color>: {0}%\n",
                                            aa.dmgmod * 100, ColorPallete.GetHexColor("Red"));
         if (aa.critmod != 0)
         {
             abilityStats.text += string.Format("<color={2}><b>Crit</b></color>: {0}{1}%\n",
                                                aa.critmod >= 0 ? "+" : "-", aa.critmod, ColorPallete.GetHexColor("Yellow"));
         }
     }
     foreach (Effect e in a.SelfBuffs)
     {
         if (selfEffects.text.Length == 0)
         {
             selfEffects.text = "Self: \n";
         }
         selfEffects.text += e.ToString();
     }
     foreach (Effect e in a.TargetBuffs)
     {
         {
             if (targetEffects.text.Length == 0)
             {
                 targetEffects.text = "Target: \n";
             }
             targetEffects.text += e.ToString();
         }
     }
 }
コード例 #6
0
    void BuyItem(int amt)
    {
        int removed = Mathf.Min(amount, amt);

        amount -= removed;
        if (amount <= 0)
        {
            icon.color = ColorPallete.GetColor("Grey");
        }
        count.text = amount.ToString();
        ItemAmount instance = new ItemAmount(item, removed);

        GameEvents.current.BuyTrigger(instance);
    }
コード例 #7
0
 public void SetAbility(Ability a, Unit actor)
 {
     ability     = a;
     currentUnit = actor;
     tooltip.SetAbility(a);
     if (a == null)
     {
         pic.sprite = defaultEmpty;
         pic.color  = ColorPallete.GetColor("Black");
         usable     = false;
     }
     else
     {
         pic.sprite = SpriteLibrary.GetAbilitySprite(a.abilityName);
         SetUsable();
     }
 }
コード例 #8
0
 public void SetUnit(Unit u)
 {
     unit = u;
     if (unit == null)
     {
         icon.sprite        = null;
         icon.color         = ColorPallete.GetColor("Grey");
         background.enabled = false;
         icon.enabled       = false;
     }
     else
     {
         icon.enabled       = true;
         background.enabled = true;
         icon.sprite        = SpriteLibrary.GetStatusSprite(unit.stats.GetClassName());
         icon.color         = Color.white;
     }
     border.enabled = false;
 }
コード例 #9
0
    private void Start()
    {
        _planets = PlanetGenerator.Instance.Planets;

        for (int i = 1; i <= _playerCount; i++)
        {
            int playerPlanet = Random.Range(0, _planets.Count);

            _planets[playerPlanet].SetPlayer(i, _colorPallete.GetColor(i - 1));

            _planets[playerPlanet].GetComponent <Hangar>().SetDefault(_playersRefill, _playersStartShips);

            if (i > 1)
            {
                SimpleBot simpleBot = gameObject.AddComponent <SimpleBot>();
                simpleBot.Init(i);
            }

            _planets.RemoveAt(playerPlanet);
        }
    }
コード例 #10
0
    public bool OnTurnStart()
    {
        if (health.x <= 0)
        {
            return(false);
        }
        bool startTurn = true;

        if (modifiers.IsStunned)
        {
            startTurn = false;
            modifiers.ClearStun();
        }
        int damage = 0;

        foreach (StatusEffect e in modifiers.Bleed)
        {
            damage += e.ApplyOverTime(unit);
        }
        if (damage > 0)
        {
            unit.CreatePopUpText(damage.ToString(), ColorPallete.GetColor("Red"));
        }
        int stress = 0;

        foreach (StatusEffect e in modifiers.Terror)
        {
            stress += e.ApplyOverTime(unit);
        }
        if (stress > 0)
        {
            unit.CreatePopUpText(stress.ToString(), ColorPallete.GetColor("Purple"));
        }
        modifiers.OnTurnBegin();
        if (health.x <= 0)
        {
            return(false);
        }
        return(startTurn);
    }
コード例 #11
0
    void SetUsable()
    {
        if (ability == null)
        {
            return;
        }
        bool position = ability.usable.IsValidRank(currentUnit, currentUnit);
        bool cost     = GameState.Instance.metal.metalLevel >= ability.metalCost;
        bool ammo     = GameState.Instance.inventory.HasItem(new ItemAmount(GameState.Instance.inventory.ammo, ability.ammoCost));

        if (position && cost && ammo)
        {
            usable    = true;
            pic.color = Color.white;
            unusableTooltip.SetDescription("");
        }
        else
        {
            usable    = false;
            pic.color = ColorPallete.GetColor("Grey");
            string description = "";
            if (!position)
            {
                description += "Out of position\n";
            }
            if (!cost)
            {
                description += "Low metal reserves\n";
            }
            if (!ammo)
            {
                description += "Low Ammunition\n";
            }
            unusableTooltip.SetDescription(description);
        }
    }