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);
    }
 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();
         }
     }
 }
Esempio n. 3
0
 public override string ToString()
 {
     if (high)
     {
         return(string.Format(
                    "{0} <color={3}><b>Poise</b></color>: Grants +{1} Accuracy, +{2}% Crit.\n",
                    "Agressive", accuracy, crit,
                    ColorPallete.GetHexColor("Highlight Orange")));
     }
     else
     {
         return(string.Format(
                    "{0} <color={3}><b>Poise</b></color>: Grants +{1} Speed, +{2} Dodge.\n",
                    "Evasive", speed, dodge,
                    ColorPallete.GetHexColor("Highlight Teal")));
     }
 }
Esempio n. 4
0
        public override void draw(GraphicsDevice device, Effect effect, DisplayParameters parameters)
        {
            AnimatedBodyPartGroup block = new AnimatedBodyPartGroup(ContentDistributor.getEmptyString() + @"worldMarkup\" + markerName + ".chr", 1.0f / 7.0f);

            block.setScale(1f / 12f);
            foreach (BlockLoc test in blocksToBuild.Keys)
            {
                //WorldMarkupHandler.addCharacter(ContentDistributor.getEmptyString()+@"worldMarkup\"+markerName+".chr",
                //                           test.toWorldSpaceVector3() + new Vector3(.5f, .5f, .5f), 1.0f/12.0f,.6f);
                block.setRootPartLocation(test.toWorldSpaceVector3() + new Vector3(.5f, .5f, .5f));
                effect.Parameters["xOpacity"].SetValue(.7f);
                effect.Parameters["xTint"].SetValue(ColorPallete.getColorFromByte(blocksToBuild[test]).ToVector4() * 1.2f);
                block.draw(device, effect);
                effect.Parameters["xTint"].SetValue(Color.White.ToVector4());
                effect.Parameters["xOpacity"].SetValue(1f);
            }
        }
Esempio n. 5
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();
     }
 }
 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;
 }
Esempio n. 7
0
    public void Display()
    {
        switch (result)
        {
        case Result.none:
            break;

        case Result.Hit:
        case Result.Graze:
        case Result.Crit:
            target.CreatePopUpText(amount.ToString(), ColorPallete.GetResultColor(result));
            break;

        default:
            target.CreatePopUpText(result.ToString(), ColorPallete.GetResultColor(result));
            break;
        }
        ApplyEffects();
    }
Esempio n. 8
0
        private static void AddVertexToVertices(int x, int y, int z, ref VertexPostitionColorPaintNormal[] vertices, ref int verticesSoFar,
                                                cornr2AOArrLc corner, ref Vector3 normal, ref byte[] AOarray, byte type, int modelOffsetX, int modelOffsetY, int modelOffsetZ)
        {
            VertexPostitionColorPaintNormal Zero = new VertexPostitionColorPaintNormal();

            Zero.Position = new Vector3(x + xOffSetsAtCorners[(int)corner], y + yOffSetsAtCorners[(int)corner], z + zOffSetsAtCorners[(int)corner]);
            Zero.Normal   = normal;
            // NoiseGenerator.Amplitude=2;
            //float simplex = (float)NoiseGenerator.Noise(x, z)+1;
            //Zero.PaintColor = new Color((int)(simplex * 255), (int)(simplex * 255), (int)(simplex * 255));
            //Random rand = new Random(1+(x + xOffSetsAtCorners[(int)corner]+modelOffsetX)
            //    * (y + yOffSetsAtCorners[(int)corner]+modelOffsetY)
            //    * ( z + zOffSetsAtCorners[(int)corner]+modelOffsetZ));
            //Zero.PaintColor = new Color( UIColorPallete.colorArray[type].R + rand.Next(-3,3),UIColorPallete.colorArray[type].G + rand.Next(-3,3),UIColorPallete.colorArray[type].B + rand.Next(-3,3));
            Zero.PaintColor         = new Color(ColorPallete.getColorFromByte(type).R, ColorPallete.getColorFromByte(type).G, ColorPallete.getColorFromByte(type).B);
            Zero.Color.R            = AOarray[(int)corner];
            vertices[verticesSoFar] = Zero;
            verticesSoFar++;
        }
Esempio n. 9
0
 public void Display()
 {
     if (delayedEffect.Type == EffectType.none)
     {
         return;
     }
     if (result == DelayedResult.resist)
     {
         target.CreatePopUpText("Resisted", ColorPallete.GetEffectColor(delayedEffect.Type));
     }
     else if (delayedEffect.Type == EffectType.stress)
     {
         target.CreatePopUpText(string.Format("{0}: {1}",
                                              effectNames[delayedEffect.Type], ((Stress)delayedEffect).StressDamage(target)), ColorPallete.GetEffectColor(EffectType.stress));
     }
     else
     {
         target.CreatePopUpText(effectNames[delayedEffect.Type], ColorPallete.GetEffectColor(delayedEffect.Type));
     }
 }
Esempio n. 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);
    }
    public static void CreateColorPalette()
    {
        if (Selection.activeObject is Texture2D)
        {
            Texture2D selectedTexture = Selection.activeObject as Texture2D;

            string selectionPath = AssetDatabase.GetAssetPath(selectedTexture);

            selectionPath = selectionPath.Replace(".png", ".asset");

            ColorPallete newPalette = CustomAssetUtility.CreateAsset <ColorPallete>(selectionPath);

            newPalette.source = selectedTexture;
            newPalette.SetPalette();

            Debug.Log(selectionPath);
        }
        else
        {
            Debug.LogError("CANT CREATE A PALETTE");
        }
    }
Esempio n. 12
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);
        }
    }
Esempio n. 13
0
 public void ChangeCurrentPallete(int _index)
 {
     currentPaletteIndex = _index;
     currentColorPallete = palletes[_index];
 }
Esempio n. 14
0
 public override string ToString()
 {
     return(string.Format("<color={0}><b>Stunned</b></color>: Skips next turn\n", ColorPallete.GetHexColor("Highlight Yellow")));
 }
Esempio n. 15
0
 public override string ToString()
 {
     return(string.Format("+{0} to <color={1}>Metal</color> reserves", amount, ColorPallete.GetHexColor("Yellow")));
 }
Esempio n. 16
0
 private void OnEnable()
 {
     colorPalette = target as ColorPallete;
 }
Esempio n. 17
0
 public override string ToString()
 {
     return(string.Format("<color={1}><b>Heal</b></color> {0} health\n", amount, ColorPallete.GetHexColor("Green")));
 }
Esempio n. 18
0
 public override string ToString(Unit target)
 {
     return(string.Format("Clear all <color={0}><b>debuffs</b></color>\n",
                          ColorPallete.GetHexColor("Orange")));
 }
Esempio n. 19
0
 public override string ToString(Unit target)
 {
     return(string.Format("<color={1}><b>Move</b></color>: {0}% chance\n",
                          100 - target.stats.GetStat(StatType.moveResist), ColorPallete.GetHexColor("Teal")));
 }
Esempio n. 20
0
 public override string ToString()
 {
     return(string.Format("<color={2}><b>Guarded</b></color> by {0} for {1} turns",
                          defender != null ? defender.stats.GetName() : "unit", duration, ColorPallete.GetHexColor("Blue")));
 }
Esempio n. 21
0
 public void SetIntensity(int val)
 {
     this.intensity = val;
     this.color     = ColorPallete.GetColorInteger(this.intensity);
 }
Esempio n. 22
0
    public void SetAbility(Unit actor, Ability ability, Unit target)
    {
        currentAbility = ability;
        if (ability == null)
        {
            unitName.text = "";
            health.text   = "";
            effects.text  = "";
            return;
        }
        int   lines = 3;
        float width = 200f;
        bool  on    = gameObject.activeSelf;

        if (!on)
        {
            gameObject.SetActive(true);
        }

        unitName.text = target.stats.GetName();
        width         = Mathf.Max(LayoutUtility.GetPreferredWidth(unitName.rectTransform), width);
        Vector2Int hp = target.stats.Health();

        health.text  = string.Format("<color={2}><b>Health</b></color>: {0}/{1}", hp.x, hp.y, ColorPallete.GetHexColor("Green"));
        effects.text = "";
        if (actor == target)
        {
            foreach (Effect e in ability.SelfBuffs)
            {
                if (effects.text.Length == 0)
                {
                    effects.text = "Effects: \n";
                }
                effects.text += e.ToString();
                ++lines;
            }
            if (!ability.usable.self)
            {
                foreach (Effect e in ability.TargetBuffs)
                {
                    if (effects.text.Length == 0)
                    {
                        effects.text = "Effects: \n";
                    }
                    effects.text += e.ToString(target) + "\n";
                    ++lines;
                }
            }
        }
        else
        {
            if (ability.IsAttack)
            {
                Ability_Attack aa = (Ability_Attack)ability;
                effects.text = string.Format("<color={1}><b>Accuracy</b></color>: {0}%\n",
                                             aa.accmod + actor.stats.GetStat(StatType.acc), ColorPallete.GetHexColor("Grey"));
                Vector2Int dmg = aa.DamageRange(actor, target);
                effects.text += string.Format("<color={2}><b>Damage</b></color>: {0} - {1}\n", dmg.x, dmg.y, ColorPallete.GetHexColor("Red"));
                int crit = aa.critmod + actor.stats.GetStat(StatType.crit);
                lines += 3;
                if (crit > 0)
                {
                    effects.text += string.Format("<color={1}><b>Crit</b></color>: {0}%\n", crit, ColorPallete.GetHexColor("Yellow"));
                    ++lines;
                }
            }
            foreach (Effect e in ability.TargetBuffs)
            {
                if (effects.text.Length == 0)
                {
                    effects.text = "Effects: \n";
                }
                effects.text += e.ToString(target) + "\n";
                ++lines;
            }
        }

        width        = Mathf.Max(LayoutUtility.GetPreferredWidth(effects.rectTransform), width);
        rt.sizeDelta = new Vector2(width, lines * unitName.fontSize);
        if (!on)
        {
            gameObject.SetActive(false);
        }
    }
Esempio n. 23
0
 public override string ToString()
 {
     return(string.Format("<color={2}><b>Bleed</b></color> {0} dmg for {1} rds\n",
                          amount, duration, ColorPallete.GetHexColor("Highlight Red")));
 }
Esempio n. 24
0
 public override string ToString()
 {
     return(string.Format("<color={0}><b>Ironwall</b></color>: Unit will always counter attacks when defense is above 0.\n",
                          ColorPallete.GetHexColor("Blue")));
 }
Esempio n. 25
0
 public override string ToString(Unit target)
 {
     return(string.Format("<color={1}><b>Bleed</b></color>: {0}% chance\n",
                          100 - target.stats.GetStat(StatType.bleedResist), ColorPallete.GetHexColor("Highlight Red")));
 }
Esempio n. 26
0
 public override string ToString()
 {
     return(string.Format("<color={1}><b>Mark</b></color> for {0} turns",
                          duration, ColorPallete.GetHexColor("Red")));
 }
Esempio n. 27
0
 public override string ToString()
 {
     return(string.Format("Gain {0} <color={1}><b>Defense</b></color>\n",
                          amount, ColorPallete.GetHexColor("Blue")));
 }
Esempio n. 28
0
 private void addColorButton(Vector2 loc, byte color)
 {
     children.Add(new UIElement(new ColorSelection(color), getColorSwatchBox(), loc,
                                1, ColorPallete.getColorFromByte(color), ColorPallete.getColorFromByte(color), "Select color"));
 }
Esempio n. 29
0
 public override string ToString()
 {
     if (duration < 0)
     {
         return(string.Format("{0} {1}\n", amount, StatName.ToString(stat)));
     }
     return(string.Format("{0}{1} <color={4}>{2}</color> for {3} turns\n",
                          amount < 0 ? "" : "+", amount, StatName.ToString(stat), duration, ColorPallete.GetStatHexColor(stat)));
 }
Esempio n. 30
0
 public override string ToString()
 {
     return(string.Format("<color={2}><b>Move</b></color> {0} {1}\n",
                          Mathf.Abs(amount), amount > 0 ? "Forward" : "Backward", ColorPallete.GetHexColor("Teal")));
 }