Esempio n. 1
0
        private void BuildBarracks(GameEntity location)
        {
            GameEntity homebase = GetFirst(_selectedBarracksBuilders);
            GameEntity b        = _presets.CreateBlueprint(Presets.EntitasPresetEnum.BARRACKS);

            b.AddStartPosition(location.hexCell.worldx, location.hexCell.worldy, location.hexCell.worldz);
            b.ReplaceLocation(location.gameObject.value.GetComponent <HexCellBehaviour>(), location.iD.value);
            b.ReplaceTeam(homebase.team.value);
        }
Esempio n. 2
0
    private void SetupPlayers(GameContext game, Presets preset, HexGridBehaviour grid)
    {
        PlayerListData pld = GameObject.FindObjectOfType <PlayerListData>();

        if (pld != null)
        {
            IEnumerator <Vector3> basePos = CoordinatesForBases(grid);
            foreach (var player in pld._model)
            {
                GameEntity pEntity = game.CreateEntity();
                pEntity.AddTeam(player.Color);
                pEntity.isLocalPlayer = (player.Type == PlayerTypeEnum.Human);
                pEntity.isAIPlayer    = (player.Type == PlayerTypeEnum.AI);

                basePos.MoveNext();
                GameEntity       baseEntity = preset.CreateBlueprint(Presets.EntitasPresetEnum.BASE);
                HexCellBehaviour home       = grid.GetCell(basePos.Current);
                baseEntity.ReplaceLocation(home, home.GetComponent <EntitasLink>().id);
                baseEntity.ReplaceTeam(player.Color);
                baseEntity.ReplaceStartPosition(home.transform.position.x, home.transform.position.y, home.transform.position.z);
            }
        }
        else
        {
            Debug.Log("No player setup found; I'm assuming this scene was started in Unity Editor for debugging purposes");

            GameEntity pEntity = game.CreateEntity();
            pEntity.AddTeam(0);
            pEntity.isLocalPlayer = true;
            pEntity.isAIPlayer    = false;
        }
    }
Esempio n. 3
0
 private void FindEntitiesInUnity(GameContext game, Presets preset)
 {
     EntitasInit[] toEntitas = GameObject.FindObjectsOfType <EntitasInit>();
     foreach (var u in toEntitas)
     {
         preset.CreateBlueprint(u);
     }
 }
Esempio n. 4
0
        protected override void Execute(List <InputEntity> entities)
        {
            if (entities.Count != 1)
            {
                throw new System.ArgumentException("found more than 1 UI build command?");
            }

            foreach (var barracks in _selectedBarracks)
            {
                GameEntity newUnit = _presets.CreateBlueprint(Presets.EntitasPresetEnum.VEHICLE);
                newUnit.ReplaceLocation(barracks.location.cell, barracks.location.cellid);
                var cellpos = barracks.location.cell.transform.position;
                newUnit.ReplaceStartPosition(cellpos.x, cellpos.y, cellpos.z);
                newUnit.ReplaceTeam(barracks.team.value);
            }

            //whether or not command was succesful, ui command can be removed
            entities[0].Destroy();
        }