public void Initialize(Unit unit, OnClickDeploy ocd, ShowChosenGeneral showChosenGeneral) { UnitImage.sprite = unit.CreateAndOrderButton.UnitIconSprite; this.showChosenGeneral = showChosenGeneral; AttachedUnit = unit; this.ocd = ocd; }
public DeployedUnit CreateNewUnitImage(Unit unit, OnClickDeploy ocd) { foreach (var stack in unitStacks) { if (stack.AttachedUnit == unit) { stack.IncreaseCount(); return(stack); } } var go = Instantiate(this.UnitImagePrefab, this.UnitContainer).GetComponent <DeployedUnit>(); go.Initialize(unit, ocd, this); unitStacks.Add(go); return(go); }