public void AddCard(Unit u) { if (Units.Count < maxdecksize) { UnitState newUnit = ScriptableObject.CreateInstance <UnitState>(); newUnit.Set(u); newUnit.unitPrefab = u; AddCard(newUnit); } }
public void ModifyHealth(int delta) { health += delta; if (health <= 0) { Remove(); } else { unitState.Set(this); } }
public void SetState(State state) { switch (state) { case State.Moving: unitState = new UnitStateMoving(this, unitSettings, signal); break; case State.Dead: unitState = new UnitStateDead(this, unitSettings, signal); break; } unitState.Set(); }
void Awake() { if (MainDeckHandler == null) { MainDeckHandler = this; DontDestroyOnLoad(this); //Temporary to test adding card UnitState initUnit = ScriptableObject.CreateInstance <UnitState>(); initUnit.Set(StartingUnitPrefab); initUnit.unitPrefab = StartingUnitPrefab; AddCard(initUnit); } else { Destroy(gameObject); } }