My color value jump from RGBA(255,41,41,255) to RGBA(1000,0.162,0.162,255) and I have no idea why. It happens at my ELSE were i call .Reset()
if (attackReady) {
Debug.Log(projectails.Count);
if (projectails.Count == 0) {
projectails.Add ((GameObject)GameObject.Instantiate (weapon, transform.position, Quaternion.identity));
}
if (poolCount >= projectails.Count) {
poolCount = 0;
}
if (projectails [poolCount].GetComponent<AttackProjectails> ().inUse) {
projectails.Add ((GameObject)GameObject.Instantiate (weapon, transform.position, Quaternion.identity));
poolCount++;
}
else {
Debug.Log ("WTF; " + Elements.fire);
projectails [poolCount].GetComponent<AttackProjectails> ().Reset (transform.position, element, dmg, Elements.fire);
poolCount++;
}
attackReady = false;
StartCoroutine (waitForAttack (coolDown));
}
My reset function:
public void Reset(Vector3 pos, Elements.elements element, int dmg, Color color){
transform.position = pos;
this.element = element;
this.dmg = dmg;
this.color = color;
GetComponent<SpriteRenderer>().color = color;
inUse = true;
}
And my colors:
public class Elements {
public enum elements{ FIRE , WATER , EARTH , AIR };
public static Color fire = new Color (255, 41, 41, 255);
public static Color water = new Color(62, 79, 255, 255);
public static Color earth = new Color(116, 88, 15, 255);
public static Color air = new Color(255, 255, 255, 255);
}