示例#1
0
    private GroundCube InstantiateCube(Key pos)
    {
        GroundCube _temp = Instantiate(CubePrefab, transform);

        _temp.InitializeCube(pos);
        return(_temp);
    }
示例#2
0
 private void ClearTile()
 {
     _ray = Camera.main.ScreenPointToRay(touch.ScreenPos);
     if (Physics.Raycast(_ray, out _hit, Mathf.Infinity, GroundCubeLayer))
     {
         GroundCube temp = _hit.transform.GetComponent <GroundCube>();
         temp.UpgradeTile(CubeUpgradeTypes.Nil);
     }
 }
示例#3
0
 private void OnTriggerExit(Collider other)
 {
     if (other.tag == "Building" || other.tag == "Wall")
     {
         obj.Remove(other.gameObject);
     }
     if (other.tag == "GroundCube")
     {
         GroundCube gc = other.GetComponent <GroundCube>();
         Cubes.Remove(gc);
         gc.Selection();
     }
     ChangeColor();
 }
示例#4
0
    //----this is the exact opposit of OnTriggerEnter
    private void OnTriggerExit(Collider other)
    {
        if (other.CompareTag("Building") || other.CompareTag("Wall"))
        {
            obj.Remove(other.gameObject);//----notice we're removing it from the list
        }

        if (other.CompareTag("GroundCube"))
        {
            GroundCube gc = other.GetComponent <GroundCube>();
            cubes.Remove(gc);//----removing it from the list
            gc.HandleSelection();
        }
        ChangeColor();
    }
示例#5
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Building") || other.CompareTag("Wall")) //hit a building or a wall?......
        {
            obj.Add(other.gameObject);                                //then stick it in the obj list.....
        }

        if (other.CompareTag("GroundCube"))                    //hit a ground cube?.........
        {
            GroundCube gc = other.GetComponent <GroundCube>(); //get the ground cube script that is sitting on this particular gameobject.....
            cubes.Add(gc);                                     //add it to the ground cubes list....
            gc.HandleSelection();                              //toggle the selection color of this particular ground cube......
        }
        ChangeColor();                                         //<----no check if the color should be green or red
    }
示例#6
0
    private void OnTriggerExit(Collider other)
    {
        if (other.CompareTag("Building") || other.CompareTag("Wall") || other.CompareTag("Minion"))
        {
            gosBumped.Remove(other.gameObject);//----notice we're removing it from the list
        }

        if (other.CompareTag("GroundCube"))
        {
            GroundCube gc = other.GetComponent <GroundCube>();
            cubes.Remove(gc);
            if (gc.tile.isPathway == false && buildMode == BuildMode.Building)
            {
                gc.SetSelection(false);
            }
        }
        ChangeColor();
    }
示例#7
0
 private void OnTriggerEnter(Collider other)
 {
     //hit a building or minion?
     if (other.CompareTag("Building") || other.CompareTag("Wall") || other.CompareTag("Minion"))
     {
         //Debug.Log("Hit "+ other.gameObject.name + "!");
         gosBumped.Add(other.gameObject);
     }
     //hit a ground cube?
     if (other.CompareTag("GroundCube"))
     {
         //Debug.Log("Hit groundtube!");
         GroundCube gc = other.GetComponent <GroundCube>();
         cubes.Add(gc);
         if (isPreviewing && buildMode == BuildMode.Building)
         {
             if (gc.tile.isPathway == false)
             {
                 gc.SetSelection(true);
             }
         }
     }
     ChangeColor();
 }