Пример #1
0
        private void SetTileMaterial()
        {
            this.blockMaterials = this.blockRenderer.sharedMaterials;

#if UNITY_EDITOR
            this._materialID      = Random.Range(1, 6);
            this.tileUpMaterial   = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Empty/Standard/Up/", "Empty" + this._materialID.ToString().PadLeft(2, '0') + "-Up");
            this.tileDownMaterial = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Empty/Standard/Down/", "Empty" + this._materialID.ToString().PadLeft(2, '0') + "-Down");
#endif

            if (this._blockState == BlockInfo.BlockState.UP)
            {
                this.blockMaterials[0] = this.tileUpMaterial;
            }
            else
            {
                if (this.isUp)
                {
                    this.blockMaterials[0] = this.tileUpMaterial;
                }
                else
                {
                    this.blockMaterials[0] = this.tileDownMaterial;
                }
            }

            this.blockRenderer.sharedMaterials = this.blockMaterials;
        }
Пример #2
0
        private void SetMiscMaterial()
        {
            this.warpUpMaterial   = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Warp/Standard/Up/", "Up-Up");
            this.warpDownMaterial = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Warp/Standard/Down/", "Up-Down");

            // OLD WARP DIRECTION CODE.

            /*switch(this.FirstDirection){
             *  case BlockInfo.BlockDirection.UP:
             *      this.warpUpMaterial = AssetProcessor.FindAsset<Material>("Assets/Models/Block/Material/Warp/Standard/Up/", "Up-Up");
             *      this.warpDownMaterial = AssetProcessor.FindAsset<Material>("Assets/Models/Block/Material/Warp/Standard/Down/", "Up-Down");
             *      break;
             *
             *  case BlockInfo.BlockDirection.RIGHT:
             *      this.warpUpMaterial = AssetProcessor.FindAsset<Material>("Assets/Models/Block/Material/Warp/Standard/Up/", "Right-Up");
             *      this.warpDownMaterial = AssetProcessor.FindAsset<Material>("Assets/Models/Block/Material/Warp/Standard/Down/", "Right-Down");
             *      break;
             *
             *  case BlockInfo.BlockDirection.DOWN:
             *      this.warpUpMaterial = AssetProcessor.FindAsset<Material>("Assets/Models/Block/Material/Warp/Standard/Up/", "Down-Up");
             *      this.warpDownMaterial = AssetProcessor.FindAsset<Material>("Assets/Models/Block/Material/Warp/Standard/Down/", "Down-Down");
             *      break;
             *
             *  case BlockInfo.BlockDirection.LEFT:
             *      this.warpUpMaterial = AssetProcessor.FindAsset<Material>("Assets/Models/Block/Material/Warp/Standard/Up/", "Left-Up");
             *      this.warpDownMaterial = AssetProcessor.FindAsset<Material>("Assets/Models/Block/Material/Warp/Standard/Down/", "Left-Down");
             *      break;
             * }*/
        }
Пример #3
0
        public static void FindOrCreate()
        {
            GameObject temp = GameObject.FindWithTag("TileManager");

            if (temp == null)
            {
#if UNITY_EDITOR
                temp = AssetProcessor.FindAsset <GameObject>(AssetPaths.PathPrefab + "Resources/", "TileManager");
#else
                temp = ResourceManager.instance.tileManager;
#endif
                Instantiate(temp).name = "TileManager";
            }
        }
Пример #4
0
    public static void FindOrCreate()
    {
        GameObject tempController = GameObject.FindGameObjectWithTag("GameController");

        if (tempController == null)
        {
#if UNITY_EDITOR
            tempController = AssetProcessor.FindAsset <GameObject>(AssetPaths.PathPrefabMisc, AssetPaths.GameControllerName);
#else
            tempController = ResourceManager.instance.gameController;
#endif
            Instantiate(tempController).name = AssetPaths.GameControllerName;
            return;
        }
        else
        {
            return;
        }
    }
Пример #5
0
        private void SetupLevelBlocks()
        {
            GameObject block = null;

            for (int i = 0; i < 3; i++)
            {
                GameObject temp = Instantiate(ResourceManager.instance.mainMenuPlane) as GameObject;
                temp.transform.parent   = this.transform;
                temp.transform.position = new Vector3(thisObject.transform.position.x + (i * this.distanceBetweenPage) + 2.5f, thisObject.gameObject.transform.position.y - 1.0f, thisObject.transform.position.z + 0.5f);
                for (int r = 0; r < this._row; r++)
                {
                    for (int c = 0; c < this._col; c++)
                    {
#if UNITY_EDITOR
                        block = (GameObject)Instantiate(AssetProcessor.FindAsset <GameObject>(AssetPaths.PathPrefabMainMenu + "Blocks/", AssetPaths.LevelNumberBlockName));
#else
                        block = (GameObject)Instantiate(ResourceManager.instance.levelNumberBlock);
#endif
                        block.GetComponent <LevelBlockButton>().SetID(this._count + 1);
                        if (i >= 1)
                        {
                            block.transform.position = new Vector3(thisObject.transform.position.x + (this.distanceBetweenPage * i) + c * 1, thisObject.gameObject.transform.position.y - r, thisObject.transform.position.z);
                        }
                        else
                        {
                            block.transform.position = new Vector3(thisObject.transform.position.x + c * 1, thisObject.gameObject.transform.position.y - r, thisObject.transform.position.z);
                        }

                        block.transform.parent          = thisObject.transform;
                        this._aLevelBlocks[this._count] = block;
                        this._levelBlocks.Add(block);

                        this._count++;

                        if (this._count >= MazeInfo.MaxMazeLength)
                        {
                            break;
                        }
                    }
                }
            }
        }
Пример #6
0
        private void SetMiscMaterial()
        {
            switch (this.FirstDirection)
            {
            case BlockInfo.BlockDirection.UP:
                this._arrowUpMaterial   = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Normal/Standard/Up/", "Up-Up");
                this._arrowDownMaterial = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Normal/Standard/Down/", "Up-Down");
                break;

            case BlockInfo.BlockDirection.RIGHT:
                this._arrowUpMaterial   = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Normal/Standard/Up/", "Right-Up");
                this._arrowDownMaterial = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Normal/Standard/Down/", "Right-Down");
                break;

            case BlockInfo.BlockDirection.DOWN:
                this._arrowUpMaterial   = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Normal/Standard/Up/", "Down-Up");
                this._arrowDownMaterial = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Normal/Standard/Down/", "Down-Down");
                break;

            case BlockInfo.BlockDirection.LEFT:
                this._arrowUpMaterial   = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Normal/Standard/Up/", "Left-Up");
                this._arrowDownMaterial = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Normal/Standard/Down/", "Left-Down");
                break;
            }

            if (this.BlockState == BlockInfo.BlockState.UP)
            {
                this.blockMaterials[1] = this._arrowUpMaterial;
            }
            else
            {
                if (this.isUp)
                {
                    this.blockMaterials[1] = this._arrowUpMaterial;
                }
                else
                {
                    this.blockMaterials[1] = this._arrowDownMaterial;
                }
            }
        }
Пример #7
0
        public static void FindOrCreate()
        {
            GameObject tempController = GameObject.FindGameObjectWithTag("SoundController");

            if (tempController == null)
            {
#if UNITY_EDITOR
                tempController = AssetProcessor.FindAsset <GameObject>(AssetPaths.PathPrefabMisc, AssetPaths.SoundControllerName);
#else
                tempController = ResourceManager.instance.soundController;
#endif
                var audio = tempController.GetComponent <AudioSource>() as AudioSource;
                audio.rolloffMode   = AudioRolloffMode.Linear;
                audio.minDistance   = 50.0f;
                audio.volume        = 0.2f;
                tempController      = Instantiate(tempController) as GameObject;
                tempController.name = AssetPaths.SoundControllerName;
                if (GameController.instance.gameState == GlobalInfo.GameState.MENU)
                {
                    tempController.transform.parent = Camera.main.transform;
                }
            }
        }
Пример #8
0
        /// <summary>
        /// Finds the Spawn Blocks To Genereate The Player And AI Objects.
        /// </summary>
        public void GeneratePlayers()
        {
            var humanSpawnPoint = this.humanSpawnPoint;
            var aiSpawnPoint    = this.aiSpawnPoint;

            if (humanSpawnPoint == aiSpawnPoint)
            {
                humanSpawnPoint = new Vector3(0 + BlockInfo.BlockWidth * 0.5f, 2.5f, 0 + BlockInfo.BlockBreadth * 0.5f);
                aiSpawnPoint    = new Vector3((this.columns * BlockInfo.BlockWidth) - (BlockInfo.BlockWidth * 0.5f), 2.5f, (this.rows * BlockInfo.BlockBreadth) - (BlockInfo.BlockBreadth * 0.5f));
            }
            else
            {
                humanSpawnPoint = new Vector3(humanSpawnPoint.x + (BlockInfo.BlockWidth * 0.5f), 2.5f, humanSpawnPoint.z + (BlockInfo.BlockBreadth * 0.5f));
                aiSpawnPoint    = new Vector3(aiSpawnPoint.x + (BlockInfo.BlockWidth * 0.5f), 2.5f, aiSpawnPoint.z + (BlockInfo.BlockBreadth * 0.5f));
            }
#if UNITY_EDITOR
            Instantiate((GameObject)AssetProcessor.FindAsset <GameObject>(AssetPaths.PathPrefabPlayer, AssetPaths.PlayerName), humanSpawnPoint, Quaternion.identity);
            Instantiate((GameObject)AssetProcessor.FindAsset <GameObject>(AssetPaths.PathPrefabPlayer, AssetPaths.AIName), aiSpawnPoint, Quaternion.identity);
#else
            Instantiate((GameObject)ResourceManager.instance.playerObject, humanSpawnPoint, Quaternion.identity);
            Instantiate((GameObject)ResourceManager.instance.aiObject, aiSpawnPoint, Quaternion.identity);
#endif
        }
Пример #9
0
        private void SetMiscMaterial()
        {
            Material glassMaterial = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Glass/", "Glass");

            if (this.glassBlock != null)
            {
                this.glassBlock.GetComponent <GlassCollider>().blockRenderer = this.glassBlock.GetComponent <MeshRenderer>();
                this.glassBlock.GetComponent <GlassCollider>().blockRenderer.sharedMaterial = glassMaterial;
            }
            else
            {
                this.glassBlock = this.transform.GetChild(0).gameObject;
                if (this.glassBlock != null)
                {
                    this.glassBlock.GetComponent <GlassCollider>().blockRenderer = this.glassBlock.GetComponent <MeshRenderer>();
                    this.glassBlock.GetComponent <GlassCollider>().blockRenderer.sharedMaterial = glassMaterial;
                }
                else
                {
                    throw new System.ArgumentNullException("Can Not Find The Glass Block.");
                }
            }
        }
Пример #10
0
 private void SetMiscMaterial()
 {
     this.stunUpMaterial   = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Stun/Standard/", "Stun-Up");
     this.stunDownMaterial = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Stun/Standard/", "Stun-Down");
 }
Пример #11
0
 private void SetMiscMaterial()
 {
     this.switchUpMaterial   = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Switch/Standard/", "Up");
     this.switchDownMaterial = AssetProcessor.FindAsset <Material>("Assets/Models/Block/Material/Switch/Standard/", "Down");
 }