예제 #1
0
    void Start()
    {
        // назначение ключу свою "команду" через методы в InputControll скрипте
        //run
        //inputCtrl.SetCommandForButton(_fire, new FireCommand());
        inputCtrl.SetCommandForButton(_fire, GameObject.FindObjectOfType <FireCommand>() as FireCommand);

        inputCtrl.SetCommandForButton(_jump, new JumpCommand());
        inputCtrl.SetCommandForButton(_sound, new SoundCommand());
        inputCtrl.SetCommandForButton(_ball, new BallCommand());
        //run switch
        inputCtrl.SetCommandForButton(_light, new SwitchLightsCommand(new Light()));
        inputCtrl.SetCommandForButton(_button, new SwitchButtonCommand(new Button()));

        //macrocommand
        //creating macrocommand
        var ballCommand  = new BallCommand();
        var soundCommand = new SoundCommand();
        //merging
        var macroCommand = new MacroCommand(new List <ICommand> {
            ballCommand, soundCommand
        });

        //run macrocommand
        inputCtrl.SetCommandForButton(_macro, macroCommand);

        // hold
        inputCtrl.SetCommandForButton(_hold, GameObject.FindObjectOfType <Hold>() as Hold);
    }
예제 #2
0
        //Called when pressing the combo key
        private static void OnCombo()
        {
            //Find a target for Q
            var qTarget = TargetSelector.GetTarget(Variables.spells[SpellSlot.Q].Range,
                                                   TargetSelector.DamageType.Magical);

            //If the Q Target found is a valid one
            if (qTarget.IsValidTarget())
            {
                //Check if Q is ready and enabled in the menu
                if (Variables.AssemblyMenu.Item("dz191.orianna.combo.q").IsActive() &&
                    Variables.spells[SpellSlot.Q].IsReady())
                {
                    var qPrediction = Variables.spells[SpellSlot.Q].GetPrediction(qTarget);

                    //TODO AOE Q->R Setup

                    //Check if the qPrediction Cast Position is in range of Q from the player
                    if (qPrediction.CastPosition.Distance(ObjectManager.Player.ServerPosition) <
                        Variables.spells[SpellSlot.Q].Range)
                    {
                        //Create a new command instance
                        var ballCommand = new BallCommand()
                        {
                            BallCommandPosition = qPrediction.CastPosition,
                            CommandType         = BallCommands.Q
                        };

                        //Execute the command
                        ballCommand.Execute();
                    }
                }
            }

            //Get another target for W based on the Ball position this time
            var wTarget =
                HeroManager.Enemies.FirstOrDefault(
                    m => m.IsValidTarget(Variables.spells[SpellSlot.W].Range, true, BallManager.BallPosition));

            if (Variables.spells[SpellSlot.W].IsKillable(wTarget))
            {
                //Create a new command instance
                var ballCommand = new BallCommand()
                {
                    CommandType = BallCommands.W
                };

                //Execute the command
                ballCommand.Execute();
            }
        }