Esempio n. 1
0
 /// <summary>
 /// Clicks the clear button.
 /// </summary>
 public void ClickClearButton()
 {
     levelDesigner.SetSelectedType(levelDesigner.GetNo_Value());
     Debug.Log("Clear Clicked");
 }
Esempio n. 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
        }
    }