示例#1
0
文件: Beatle.cs 项目: Bdoom/Bug-Wars
    void OnMouseDown()
    {
        if (!hasAuthority)
        {
            return;
        }

        if (!WorldHandler.isShiftDown())
        {
            WorldHandler.deselectAntHill();
            WorldHandler.deselectUnits();
        }

        GameObject indicator = gameObject.transform.FindChild("Indicator").gameObject;

        indicator.SetActive(!indicator.activeSelf);
        isUnitSelected = indicator.activeSelf;

        if (isUnitSelected)
        {
            WorldHandler.PlayUnitBattleSound();
            WorldHandler.unitsSelected.Add(gameObject);
        }
        else
        {
            WorldHandler.unitsSelected.Remove(gameObject);
        }
    }
示例#2
0
 void OnMouseDown()                                      // Change to OnMouseHover and check for clicks, then put a public static bool inside of dragselection script called "isDragging" if you are dragging none of this should apply
 {
     if (!EventSystem.current.IsPointerOverGameObject()) // If the mouse is not over an event system object (UI Object) and the user is pressing the left click
     {
         WorldHandler.deselectUnits();
         WorldHandler.deselectAntHill();
         Cursor.lockState = CursorLockMode.Confined;                     // lock the cursor when the user clicks the terrain.
         WorldHandler.hideAnthillInfo();
         WorldHandler.DestroyFlags();
     }
 }
示例#3
0
    void OnMouseDown()
    {
        if (EventSystem.current.IsPointerOverGameObject())
        {
            return;
        }

        if (!GetComponent <NetworkIdentity>().hasAuthority)
        {
            return;
        }

        if (!WorldHandler.isShiftDown())
        {
            WorldHandler.deselectUnits();
        }


        GameObject indicator = gameObject.transform.FindChild("Indicator").gameObject;

        indicator.SetActive(!indicator.activeSelf);
        isAntHillSelected = indicator.activeSelf;
    }