public void AssignSecondaryTrait(Element e, GameObject player) { ElementLoadout loadout = player.GetComponent <ElementLoadout>(); //Debug.Log("Assigning secondary trait for " + player.name + " of type " + loadout.m_Element); string ability = null; if (e == Element.Fire) { loadout.SecondaryTrait = new Trait("FireTraitSecondary"); ability = "Fire"; } if (e == Element.Water) { loadout.SecondaryTrait = new Trait("WaterTraitSecondary"); ability = "Water"; } if (e == Element.Earth) { loadout.SecondaryTrait = new Trait("EarthTraitSecondary"); ability = "Earth"; } if (e == Element.Air) { loadout.SecondaryTrait = new Trait("AirTraitSecondary"); ability = "Air"; } loadout.Secondary = loadout.SecondaryTrait.name; Debug.Log($"Secondary trait for {player.name} is {loadout.SecondaryTrait.name}"); //GameManager.instance.NewAssignAbilities(player.GetComponent<PlayerMove>(), 2, ability); }
private void Evolve() { try { ElementLoadout el = GetComponent <ElementLoadout>(); } catch (System.Exception e) { Debug.Log("Please attach ElementLoadout.cs to this player!"); } }
// Start is called before the first frame update private void Awake() { randomized = new Stack <Element>(); //GameObject [] players = GameObject.FindGameObjectsWithTag("Player"); var rand = new System.Random(); elements = elements.OrderBy(x => rand.Next()).ToList(); foreach (Element e in elements) { randomized.Push(e); } //Assign each player a random element by randomizing a stack of 4 and just pop off foreach (GameObject player in playerList) { ElementLoadout loadout = player.GetComponent <ElementLoadout>(); loadout.m_Element = (Element)randomized.Pop(); AssignPrimaryTrait(loadout.m_Element, player); loadout.m_Element = (Element)randomized.Pop(); AssignSecondaryTrait(loadout.m_Element, player); } }