protected override void OnVisualize()
        {
            //Update the SelectionManager which handles box-selection.
            SelectionManager.Update();
            //Update RTSInterfacing, a useful tool that automatically generates useful data for user-interfacing
            RTSInterfacing.Visualize();

            if (IsGathering)
            {
                //We are currently gathering mouse information. The next click will trigger the command with the mouse position.
                //I.e. Press "T" to use the 'Psionic Storm' ability. Then left click on a position to activate it there.

                //Right click to cancel casting the abiility by setting IsGathering to false
                if (Input.GetMouseButtonDown(1))
                {
                    IsGathering = false;
                    return;
                }

                //If we left click to release the ability
                //Or if the ability we're activating requires no mouse-based information (i.e. CurrentInterfacer.InformationGather)
                //Trigger the ability
                if (Input.GetMouseButtonDown(0) || CurrentInterfacer.InformationGather == InformationGatherType.None)
                {
                    ProcessInterfacer(CurrentInterfacer);
                }
            }
            else
            {
                //We are not gathering information. Instead, allow quickcasted abilities with the mouse. I.e. Right click to move or attack.
                if (Selector.MainSelectedAgent != null)
                {
                    if (Input.GetMouseButtonDown(1))
                    {
                        if (RTSInterfacing.MousedAgent.IsNotNull() &&
                            Selector.MainSelectedAgent.GetAbility <Scan>() != null)
                        {
                            //If the selected agent has Scan (the ability behind attacking) and the mouse is over an agent, send a target command - right clicking on a unit
                            ProcessInterfacer((QuickTarget));
                        }
                        else
                        {
                            //If there is no agent under the mouse or the selected agent doesn't have Scan, send a Move command - right clicking on terrain
                            ProcessInterfacer((QuickPos));
                        }
                    }
                }
            }
        }
Beispiel #2
0
        protected override void OnVisualize()
        {
            SelectionManager.Update();

            if (CommandManager.sendType == SendState.None)
            {
                return;
            }
            RTSInterfacing.Visualize();

            if (IsGathering)
            {
                if (Input.GetMouseButtonDown(1))
                {
                    IsGathering = false;
                    return;
                }

                if (Input.GetMouseButtonDown(0) || CurrentInterfacer.InformationGather == InformationGatherType.None)
                {
                    ProcessInterfacer(CurrentInterfacer);
                }
            }
            else
            {
                if (Selector.MainSelectedAgent != null)
                {
                    if (Input.GetMouseButtonDown(1))
                    {
                        LSAgent target;
                        if (RTSInterfacing.MousedAgent.IsNotNull() &&
                            PlayerManager.GetAllegiance(RTSInterfacing.MousedAgent) == AllegianceType.Enemy &&
                            Selector.MainSelectedAgent.Scanner != null)
                        {
                            ProcessInterfacer((QuickTarget));
                        }
                        else
                        {
                            ProcessInterfacer((QuickPos));
                        }
                    }
                }
            }
        }
        protected override void OnVisualize()
        {
            SelectionManager.Update();


            RTSInterfacing.Visualize();

            if (IsGathering)
            {
                if (Input.GetMouseButtonDown(1))
                {
                    IsGathering = false;
                    return;
                }

                if (Input.GetMouseButtonDown(0) || CurrentInterfacer.InformationGather == InformationGatherType.None)
                {
                    ProcessInterfacer(CurrentInterfacer);
                }
            }
            else
            {
                if (Selector.MainSelectedAgent != null)
                {
                    if (Input.GetMouseButtonDown(1))
                    {
                        //LSAgent target;
                        if (RTSInterfacing.MousedAgent.IsNotNull() &&
                            Selector.MainSelectedAgent.GetAbility <Scan>() != null)
                        {
                            ProcessInterfacer((QuickTarget));
                        }
                        else
                        {
                            ProcessInterfacer((QuickPos));
                        }
                    }
                }
            }
        }