public void spawnMembers(PlayerType owner, UnitDefinition unit, int numMembers) { this.owner = owner; playerFlagVisual.SetActive(this.owner == PlayerType.Player); enemyFlagVisual.SetActive(this.owner == PlayerType.Enemy1); influence.setColorToOwner(this.owner); UnitControlFlag unitFlag = controlSurface as UnitControlFlag; if (!!unitFlag) { } controlSurface.gameObject.SetActive(this.owner == PlayerType.Player); unitType = unit; influence.transform.localScale = new Vector3(unitType.InfluenceRange, unitType.InfluenceRange, 1f); CombatSceneManager combatManager = Toolbox.Get <InputManager>().CombatSceneManager; squadMembers = new List <SquadMember>(); for (int i = 0; i < numMembers; i++) { SquadMember newMember = Instantiate(unitType.PrefabOfUnit, combatManager.squadMemberContainer.transform); squadMembers.Add(newMember); newMember.OnUnitDied.AddListener(OnSquadMemberDied); newMember.setOwner(this.owner); newMember.TeleportTo(getRandomPositionInBounds(transform.position, influence.Zone.radius)); newMember.name = (owner == PlayerType.Player ? "PM-" : "EM-") + (unitType.PrefabOfUnit.name); } }
public void OnControlFlagClicked(UnitControlFlag clickedFlag) { if (!unitOrdersInputManager.isWaitingForTarget) { // Dont show UnitInfo if we are currently looking for a Target for UnitOrders unitInfoInputManager.SurfaceClicked(clickedFlag); } unitOrdersInputManager.ControlFlagClicked(clickedFlag); }
public void ControlFlagClicked(UnitControlFlag clickedFlag) { if (sourceSquad == null) { var targetSquad = clickedFlag.Targetable as SquadGroup; if (targetSquad && targetSquad.owner == PlayerType.Player) { //Debug.Log("Selecting Player Unit For Orders", targetSquad); sourceSquad = targetSquad; return; } } //else //{ // Debug.Log($"Assigning Flag As Target for {sourceSquad.name}", clickedFlag); // sourceSquad.setTarget(clickedFlag.Targetable); // sourceSquad = null; //} }