Exemple #1
0
        private void Awake()
        {
            UnitGame = GameJsonCreator.CreateUnit(this, isHero, type);

            GameObject selectionBox = null;

            if (index == PlayerIndex.Red)
            {
                selectionBox = (GameObject)Instantiate(Resources.Load <GameObject>("Prefabs/Misc/SelectionRed"));
            }
            else if (index == PlayerIndex.Blue)
            {
                selectionBox = (GameObject)Instantiate(Resources.Load <GameObject>("Prefabs/Misc/SelectionBlue"));
            }
            selectionBox.transform.position = transform.position;
            selectionBox.transform.parent   = transform;
            SelectionBox = selectionBox.GetComponent <SpriteRenderer>();


            if (transform.parent != null)
            {
                Tile = transform.parent.GetComponent <Tile>();
                Tile.unitGameObject = this;
            }
            UnitHealthText = transform.FindChild("UnitHealth").gameObject;
            // Set the sorting layer to GUI. The same used for the hightlights. Eventhough you cannot set it via unity inspector you can still set it via code. :D
            UnitHealthText.renderer.sortingLayerName = "GUI";
            var levelManager = GameObjectReferences.GetGlobalScriptsGameObject().GetComponent <LevelManager>();

            if (levelManager.IsCurrentLevelLoaded())
            {
                levelManager.CurrentLevel.Players[index].AddUnit(UnitGame);
            }
        }
Exemple #2
0
        private void Awake()
        {
            BuildingGame = GameJsonCreator.CreateBuilding(this, type);
            if (transform.parent != null)
            {
                Tile = transform.parent.GetComponent <Tile>();
                Tile.buildingGameObject = this;
            }
            CapturePointsText = transform.FindChild("CapturePoints").gameObject;
            CapturePointsText.renderer.enabled = false;
            // Set the sorting layer to GUI. The same used for the hightlights. Eventough you cannot set it via unity inspector you can still set it via code. :D
            CapturePointsText.renderer.sortingLayerName = "GUI";

            var levelManager = GameObjectReferences.GetGlobalScriptsGameObject().GetComponent <LevelManager>();

            if (levelManager.IsCurrentLevelLoaded())
            {
                levelManager.CurrentLevel.Players[index].AddBuilding(BuildingGame);
            }
        }
 private void Awake()
 {
     EnvironmentGame            = GameJsonCreator.CreateEnvironment(this, type);
     tile                       = GetComponent <Tile>();
     tile.environmentGameObject = this;
 }
 public void CardActionRequest(string gameId, string cardId, string command)
 {
     GameJsonCreator.CardActionJson(gameId, cardId, command);
 }
 public void EndGameRequest(string gameId)
 {
     GameJsonCreator.CreateEndGameJson(gameId);
 }
 public void NextEpochRequest(string gameId)
 {
     GameJsonCreator.CreateNextEpochJson(gameId);
 }
 public void NextMoveRequest(string gameId)
 {
     GameJsonCreator.CreateNextMoveJson(gameId);
 }
 public void GameStartRequest(string gameId)
 {
     GameJsonCreator.CreateStartJson(gameId);
 }
 public void GameInitRequest(string lobbyId)
 {
     GameJsonCreator.CreateInitJson(lobbyId);
 }