示例#1
0
    //Public functions for keypress actions so that they can be reused for the UI button presses

    public void Cancel()
    {
        if (selectedObjectToBuild == true)
        {
            //Cancels tower/wall location selection

            Debug.Log("CANCEL SELECTED TOWER");
            selectedObjectToBuild = false;
            mFunc.Mode            = 0;   //Shows mouse cursor
            Destroy(mFunc.SelHighlight); //Destroys the green highlight selection box
            sourceSFX.PlayOneShot(UIClickFX);
        }
        else if (this.mode == 1 && selectedObjectToBuild == false)
        {
            //Cancels building this.mode
            buildButton.BuildToggle();
            Debug.Log("CANCEL BUILDING");
            this.mode = 0;
            sourceSFX.PlayOneShot(UIClickFX);
            Cursor.SetCursor(normalCursor, hotSpot, cursorMode);
        }
        else if (this.mode == 2)
        {
            //Cancels sending this.mode
            sendButton.SendToggle();
            sourceSFX.PlayOneShot(UIClickFX);
            Debug.Log("CANCEL SENDING");
            this.mode = 0;
            Cursor.SetCursor(normalCursor, hotSpot, cursorMode);
        }
    }
示例#2
0
 public void BuildToggle()
 {
     if (kf.Mode == 2)
     {
         sendButton.SendToggle();
         towerButton.interactable  = true;
         cannonButton.interactable = true;
         wallButton.interactable   = true;
         iceButton.interactable    = true;
         laserButton.interactable  = true;
         lightButton.interactable  = true;
         magicButton.interactable  = true;
         kf.Build();
     }
     else if (kf.Mode == 1)
     {
         towerButton.interactable  = false;
         cannonButton.interactable = false;
         wallButton.interactable   = false;
         iceButton.interactable    = false;
         laserButton.interactable  = false;
         lightButton.interactable  = false;
         magicButton.interactable  = false;
         kf.CancelBuild();
     }
     else if (kf.Mode == 0)
     {
         kf.Build();
         towerButton.interactable  = true;
         cannonButton.interactable = true;
         wallButton.interactable   = true;
         iceButton.interactable    = true;
         laserButton.interactable  = true;
         lightButton.interactable  = true;
         magicButton.interactable  = true;
     }
 }