Exemplo n.º 1
0
        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);
            }
        }
 private void Start()
 {
     unitOrdersInputManager = GetComponent <UnitOrdersInputManager>();
     unitInfoInputManager   = GetComponent <UnitInfoInputManager>();
     Toolbox.Get <InputManager>().CombatInputManager = this;
     clickCatcher.mapClickedEvent.AddListener(OnMapClicked);
 }
Exemplo n.º 3
0
 private void OnEnable()
 {
     _inputManager = Toolbox.Get <InputManager>();
     _inputManager.OnKeyPressed.AddListener(OnAnyKeyPressed);
 }