public RotationStep(RotationAction spell, float priority, Func <RotationAction, WoWUnit, bool> predicate)
 {
     this.Action       = spell;
     this.Priority     = priority;
     this.Predicate    = predicate;
     this.TargetFinder = CombatUtil.FindFriend;
 }
Пример #2
0
        public Rotation(BaseEvent be, Character caster, Environment environment)
        {
            this.be          = be;
            this.caster      = caster;
            this.environment = environment;
            ra = (RotationAction)be.ShowAction();
            Entity entity = caster.GameObject().GetComponent <EntityReference>().Entity;

            movementComponent = entity.GetComponent <MovementComponent>();
            TimelineTrigger timelineTrigger = (TimelineTrigger)be.ShowTrigger();

            duration            = ra.ShowDurationInSeconds(timelineTrigger.ShowScaleTime());
            interpolationMethod = ra.ShowInterpolation();
            interpolator        = EasingFunctions.GetEasingFunction(interpolationMethod);
            movingDirection     = ra.ShowMovingDirection();
            mode = ra.mode.ShowRotationMode();
            switch (mode)
            {
            case RotationAction.RotationMode.Delta:
                deltaRotationMode = (RotationAction.DeltaRotationMode)ra.mode;
                break;

            case RotationAction.RotationMode.Destination:
                destinationRotationMode = (RotationAction.DestinationRotationMode)ra.mode;
                break;
            }
        }
 public void ProcessAction(RotationAction action)
 {
     if (action is null)
     {
         throw new ArgumentNullException(nameof(action));
     }
     if (Context is null)
     {
         return;
     }
     Rotate(action);
 }
Пример #4
0
 public RotationStep(RotationAction spell,
                     float priority,
                     Func <RotationAction, WoWUnit, bool> predicate,
                     Func <Func <WoWUnit, bool>, WoWUnit> targetFinder,
                     bool forceCast  = false,
                     bool checkRange = true)
 {
     _action       = spell;
     Priority      = priority;
     _predicate    = predicate;
     _targetFinder = targetFinder;
     _forceCast    = forceCast;
     _checkRange   = checkRange;
 }
Пример #5
0
    public RotationAction UndoRotation()
    {
        if (RotationHistory.Count < 1)
        {
            return(null);
        }

        RotationAction rotAct = RotationHistory[RotationHistory.Count - 1];

        RotationHistory.RemoveAt(RotationHistory.Count - 1);

        hudManager.EnableUndo(RotationHistory.Count > 0);

        return(rotAct);
    }
Пример #6
0
    public void UndoRotation()
    {
        if (currentState != CubeState.Idle)
        {
            return;
        }

        RotationAction rotUndo = historyManager.UndoRotation();

        if (rotUndo == null)
        {
            return;
        }
        RotateSectionAxis(rotUndo.RotAxis, rotUndo.Coordinate, !rotUndo.Clockwise, UndoRotSpeed);
    }
Пример #7
0
    /// <summary>
    /// Remember to call PreLoadSavedGame before calling this function!
    /// </summary>
    public void LoadCurrentSavedGame(out int cubeSize, out List <List <List <int> > > stickers, out List <RotationAction> history, out float timer)
    {
        cubeSize = 3;
        timer    = 0f;
        stickers = new List <List <List <int> > >();
        history  = new List <RotationAction>();

        if (!SavedGameExists)
        {
            return;
        }

        cubeSize = currentSave.CubeSize;

        for (int i = 0; i < 6; i++)
        {
            List <List <int> > face = new List <List <int> >();

            for (int j = 0; j < cubeSize; j++)
            {
                List <int> row = new List <int>();

                for (int k = 0; k < cubeSize; k++)
                {
                    row.Add(currentSave.StickersState[i][j][k]);
                }

                face.Add(row);
            }

            stickers.Add(face);
        }

        for (int i = 0; i < currentSave.History.Length; i++)
        {
            int[]          rawData   = currentSave.History[i];
            RotationAction rotAction = new RotationAction((Axis)rawData[0], rawData[1], rawData[2] == 1);
            history.Add(rotAction);
        }

        timer = currentSave.Timer;
    }
Пример #8
0
    //
    // helper methods
    //

    private IEnumerator RunStep(RotationAction action, float seconds, bool isRunning)
    {
        // wait number of seconds
        yield return(new WaitForSeconds(seconds));

        // call the corresponding rotate action in the scene controller
        if (action.CwAction)
        {
            sceneControllerTargetObject.SendMessage(sceneControllerRotateRightMethod);
            Debug.Log("Rotating right");
        }
        else
        {
            sceneControllerTargetObject.SendMessage(sceneControllerRotateLeftMethod);
            Debug.Log("Rotating left");
        }

        // change running state
        StartCoroutine(ChangeRunningState(isRunning));
    }
Пример #9
0
 public void PlanAction(RotationAction action) => Presented.PlanAction(action);
 public RotationStep(RotationAction spell, float priority, Func <RotationAction, WoWUnit, bool> predicate, Func <Func <WoWUnit, bool>, WoWUnit> targetFinder, bool force = false, bool checkRange = true)
     : this(spell, priority, predicate, targetFinder)
 {
     this.Force      = force;
     this.CheckRange = checkRange;
 }
 public RotationStep(RotationAction spell, float priority, Func <RotationAction, WoWUnit, bool> predicate, Func <Func <WoWUnit, bool>, WoWUnit> targetFinder)
     : this(spell, priority, predicate)
 {
     this.TargetFinder = targetFinder;
 }
 public void PlanAction(RotationAction action) => PlanAction(this, action);