Exemple #1
0
 /// <summary>
 ///When click the Brick button
 /// </summary>
 public void ClickBrickBtn()
 {
     levelDesigner.SetSelectedType(levelDesigner.GetBrick());
     Debug.Log("Brick Clicked ");
 }
Exemple #2
0
    //update per frame
    void Update()
    {
        Renderer renderer = gameObject.GetComponent <Renderer>();       //simplify the color changing process

        if (levelDesigner.GetBlockType(Int32.Parse(gameObject.name.Substring(3, 1)), Int32.Parse(gameObject.name.Substring(1, 1))) == levelDesigner.GetBrick())
        {
            renderer.material = levelDesigner.brickMaterial;             //change the material of the cube to brick material
        }
        else if (levelDesigner.GetBlockType(Int32.Parse(gameObject.name.Substring(3, 1)), Int32.Parse(gameObject.name.Substring(1, 1))) == levelDesigner.GetWall())
        {
            renderer.material = levelDesigner.wallMaterial; //change the material of the cube to the wall material
        }
        else if (levelDesigner.GetBlockType(Int32.Parse(gameObject.name.Substring(3, 1)), Int32.Parse(gameObject.name.Substring(1, 1))) == levelDesigner.GetPlayer())
        {
            renderer.material = levelDesigner.playerMaterial;            //change the block material to player material
        }
        else if (levelDesigner.GetBlockType(Int32.Parse(gameObject.name.Substring(3, 1)), Int32.Parse(gameObject.name.Substring(1, 1))) == levelDesigner.GetEnemy())
        {
            renderer.material = levelDesigner.enemyMaterial;            //change the cube material to enemy material
        }
        else if (levelDesigner.GetBlockType(Int32.Parse(gameObject.name.Substring(3, 1)), Int32.Parse(gameObject.name.Substring(1, 1))) == levelDesigner.GetNo_Value())
        {
            renderer.material = levelDesigner.emptyMaterial;            //change the cube material to empty
        }
    }