Esempio n. 1
0
 public static void ClearSelectedAbility()
 {
     pendingAbilityIdx = -1;
     if (AbilityManager.InTargetSelectionMode())
     {
         AbilityManager.ClearSelect();
     }
 }
Esempio n. 2
0
        //~ void OnGUI(){
        //~ GUI.Label(new Rect(10, Screen.height/2, 130, 35), "ability:");
        //~ if(GUI.Button(new Rect(80, Screen.height/2, 130, 35), ""+targetMode)){
        //~ if(targetMode==_TargetMode.DragNDrop) targetMode=_TargetMode.SelectNDeploy;
        //~ else if(targetMode==_TargetMode.SelectNDeploy) targetMode=_TargetMode.DragNDrop;
        //~ }

        //~ GUI.Label(new Rect(10, Screen.height/2+40, 130, 35), "build:");
        //~ if(GUI.Button(new Rect(80, Screen.height/2+40, 130, 35), ""+buildMode)){
        //~ if(buildMode==_BuildMode.DragNDrop) buildMode=_BuildMode.PointNBuild;
        //~ else if(buildMode==_BuildMode.PointNBuild) buildMode=_BuildMode.PointNBuild;
        //~ }
        //~ }



        void Update()
        {
            if (!isGameScene)
            {
                return;
            }

            if (TowerManager.InDragNDropPhase())
            {
                //for mobile, to prevent getting stuck in DnD phase if user click but not drag the button
                //if(Input.touchCount==0) TowerManager.ExitDragNDropPhase();
                return;
            }

            //for mobile, to prevent getting stuck in target select phase if user click but not drag the button
            //if(AbilityManager.InTargetSelectionMode()){
            //	if(Input.touchCount==0) AbilityManager.ClearSelect();
            //}

            int pointerID = Input.touchCount == 0 ? -1 : 0;

            if (Input.GetMouseButtonDown(0) && !UI.IsCursorOnUI(pointerID))
            {
                if (!InTargetSelectionMode())
                {
                    OnCursorDown();
                }
            }

            if (Input.GetMouseButtonUp(0) && !wasCursorOnUI)
            {
                if (AbilityManager.InTargetSelectionMode())
                {
                    OnCursorDownAbilityTargetMode();
                }
                else if (pendingAbilityIdx >= 0)
                {
                    OnCursorDownAbilityTargetMode(pendingAbilityIdx);
                    pendingAbilityIdx = -1;
                }
            }

            if (Input.GetMouseButtonDown(1))
            {
                UIAbilityButton.ClearSelect();                          //ClearSelectedAbility();
            }
            wasCursorOnUI = UI.IsCursorOnUI(pointerID);                 //to be used for next frame
        }
Esempio n. 3
0
 public static bool InTargetSelectionMode()
 {
     return(AbilityManager.InTargetSelectionMode() | pendingAbilityIdx >= 0);
 }