void Awake()
        {
            Random.InitState(0);
            changeScene = GetGlobalObject.FindAndGetComponent <ChangeScenes>(this.gameObject, "Global");

            //Check whether its sandbox or multiplayer.
            //If it is single player, generate the default map.
            //else, generate data and send over and generate again after taking.

            if (Sandbox == true)
            {
                Debug.Log("Tile is at" + theTileMap.ConvertTileToWorld(new Vector2(1, 1)));
                theObj = GameObject.Instantiate(PlayerPrefab, theTileMap.ConvertTileToWorld(new Vector2(1, 1)), Quaternion.identity) as GameObject;
                Player genericplayer = theObj.GetComponent <Player>();
                genericplayer.thePlayerData.CreatePlayerData("Generic Player", 0);
                //CurrentPlayer.Instance.ThePlayer = genericplayer;
            }

            Shop.SetActive(true);
            Game.SetActive(false);
            ReadyText.SetActive(false);
            CurrentPlayer.Instance.GetHPIcons(HPIconsParent);
            CurrentPlayer.Instance.DigPowerUI = NumberOfDigs;
            CurrentPlayer.Instance.controller = this;
            MoneyShop = GameObject.Find("Money").GetComponent <Text>();
            KillTrackSystem.Instance.theUI = KDObject;
        }
Ejemplo n.º 2
0
 void CreateFogOverTile(Vector2 tile)
 {
     if (!(tm.theMap.GetTileAt(tile) is WallBlock))
     {
         Vector2 tileC = tm.ConvertTileToWorld(tile);
         FogObjects[(int)tile.x, (int)tile.y] = Lean.LeanPool.Spawn(FogPrefab, new Vector3(tileC.x, tileC.y, -2), Quaternion.identity, FogParent.transform);
     }
 }
        public static void SpawnRandomGoldTiles(int amount, GameObject goldPrefab, Transform goldParent)
        {
            TileMap tm = TileMapInterfacer.Instance.TileMap;

            Vector2[] goldTiles = GetRandomGoldTiles(amount);
            for (int i = 0; i < goldTiles.Length; i++)
            {
                tm.UpdateTexture(goldTiles[i], new Noblock());
                Lean.LeanPool.Spawn(goldPrefab, tm.ConvertTileToWorld(goldTiles[i]), Quaternion.identity, goldParent);
            }
        }
Ejemplo n.º 4
0
        // Use this for initialization
        protected virtual void Init()
        {
            Exploded        = false;
            WaitTillExplode = new WaitForSeconds(TimeToExplode);
            theTileMap      = TileMapInterfacer.Instance.TileMap;
            Vector2 tilePos = theTileMap.ConvertWorldToTile(transform.position);

            SetTilePos((int)tilePos.x, (int)tilePos.y);
            transform.position = theTileMap.ConvertTileToWorld(tilePos);
            StartCoroutine(CountDown());

            theSrc = SoundPlayer.instance;
            //  InvisibleWallBlock
            theTileMap.theMap.SetTileAt(Pos, new InvisibleWallBlock());
        }
        void Start()
        {
            Map.Offset  += 2.0f;
            waitForTimer = new WaitForSeconds(1);
            PlayerReady  = 0;
            theTileMap   = TileMapInterfacer.Instance.TileMap;
            if (Sandbox == true)
            {
                theObj.transform.position = theTileMap.ConvertTileToWorld(new Vector2(1, 1));
            }
            else if (!Sandbox)
            {
                if (!DarkRiftAPI.isConnected)
                {
                    string IPAddress = "127.0.0.1";
                    CustomNetworkManager.Instance.Connect(IPAddress);
                }
                DarkRiftAPI.SendMessageToAll(NetworkingTags.Controller, NetworkingTags.ControllerSubjects.JoinMessage, "hi");
                //DarkRiftAPI.SendMessageToServer(NetworkingTags.Server, NetworkingTags.ServerSubjects.ChangeStateToGame, "");
            }
            DarkRiftAPI.onDataDetailed       += ReceiveData;
            DarkRiftAPI.onPlayerDisconnected += OnPlayerDisconnect;
            EventManager.OnDisplayKD         += DisplayKD;

            string showBomb = System.IO.File.ReadAllText("showBomb.txt");

            if (showBomb == "True" || showBomb == "true")
            {
                RevealFogExplosion.Trigger = true;
            }
            else
            {
                RevealFogExplosion.Trigger = false;
            }

            CurrentPlayer.Instance.Start();
        }