Example #1
0
    void RemovePhase()
    {
        //Remove wall
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        LayerMask  lm = 1 << LayerMask.NameToLayer("Wall");

        if (Physics.Raycast(ray, out hit, 40f, lm))
        {
            Wall w = hit.transform.GetComponent <Wall>();
            //Show destroy button
            if (Input.GetMouseButtonDown(0))
            {
                if (w.currentPhase != Wall.WallPhase.ghostPlaced)
                {
                    if (!wallsBeingRemoved.Contains(w))
                    {
                        wallsBeingRemoved.Add(w);
                    }
                    w.BeingRemoved();//Set color
                    StartMovePhase();
                }
            }
        }
    }