Exemplo n.º 1
0
    private IEnumerator JumpSequence(MovementSequence _sequence, SequenceNode _node, SequenceCallback _completionCallback)
    {
        float   _jumpSpeed = jumpStartSpeed;
        Vector2 _peak;

        if (zoneNumber == 0)
        {
            _peak = new Vector2(
                (character.transform.position.x + _node.transform.position.x) / 2,
                Mathf.Max(character.transform.position.y, _node.transform.position.y) + 1f
                );
        }
        else if (zoneNumber == 1)
        {
            _peak = new Vector2(
                Mathf.Min(character.transform.position.x, _node.transform.position.x) - 1f,
                (character.transform.position.y + _node.transform.position.y) / 2f
                );
        }
        else if (zoneNumber == 2)
        {
            _peak = new Vector2(
                (character.transform.position.x + _node.transform.position.x) / 2,
                Mathf.Min(character.transform.position.y, _node.transform.position.y) - 1f
                );
        }
        else
        {
            _peak = new Vector2(
                Mathf.Max(character.transform.position.x, _node.transform.position.x) + 1f,
                (character.transform.position.y + _node.transform.position.y) / 2f
                );
        }

        while (Vector2.Distance(character.transform.position, _peak) > 0.1f)
        {
            character.transform.position = Vector2.MoveTowards(character.transform.position, _peak, _jumpSpeed * Time.deltaTime);
            if (_jumpSpeed < jumpMaxSpeed)
            {
                _jumpSpeed += jumpSpeedIncrease * Time.deltaTime;
            }

            yield return(new WaitForEndOfFrame());
        }

        while (Vector2.Distance(character.transform.position, _node.transform.position) > 0.1f)
        {
            character.transform.position = Vector2.MoveTowards(character.transform.position, _node.transform.position, _jumpSpeed * Time.deltaTime);
            if (_jumpSpeed < jumpMaxSpeed)
            {
                _jumpSpeed += jumpSpeedIncrease * Time.deltaTime;
            }

            yield return(new WaitForEndOfFrame());
        }

        moveNextNode(_sequence, _completionCallback);

        yield return(new WaitForEndOfFrame());
    }
Exemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        zoneIndex  = 0;
        activeGrid = _GridController.gridZones[zoneIndex];
        generateLevel(1, levelDataSet[0].dataSet);

        NextStageCallBack        += nextStage;
        NextZoneCallback         += moveToNextZone;
        NextZoneEntranceCallback += activateSwipe;
    }
Exemplo n.º 3
0
        internal static Sequence DoInsertCallback(Sequence inSequence, TweenCallback callback, float atPosition)
        {
            SequenceCallback c = new SequenceCallback(atPosition, callback);

            c.sequencedPosition = c.sequencedEndPosition = atPosition;
            inSequence._sequencedObjs.Add(c);
            if (inSequence.duration < atPosition)
            {
                inSequence.duration = atPosition;
            }
            return(inSequence);
        }
Exemplo n.º 4
0
        internal static Sequence DoInsertCallback(Sequence inSequence, TweenCallback callback, float atPosition)
        {
            inSequence.lastTweenInsertTime = atPosition;
            SequenceCallback sequenceCallback = new SequenceCallback(atPosition, callback);

            sequenceCallback.sequencedPosition = (sequenceCallback.sequencedEndPosition = atPosition);
            inSequence._sequencedObjs.Add(sequenceCallback);
            if (inSequence.duration < atPosition)
            {
                inSequence.duration = atPosition;
            }
            return(inSequence);
        }
Exemplo n.º 5
0
        public static Sequence DoInsertCallback(Sequence inSequence, TweenCallback callback, float atPosition)
        {
            SequenceCallback sequenceCallback = new SequenceCallback(atPosition, callback);
            ABSSequentiable  arg_13_0         = sequenceCallback;

            sequenceCallback.sequencedEndPosition = atPosition;
            arg_13_0.sequencedPosition            = atPosition;
            inSequence._sequencedObjs.Add(sequenceCallback);
            if (inSequence.duration < atPosition)
            {
                inSequence.duration = atPosition;
            }
            return(inSequence);
        }
Exemplo n.º 6
0
    private IEnumerator RunSequence(MovementSequence _sequence, SequenceNode _node, SequenceCallback _completionCallback)
    {
        while (Vector2.Distance(character.transform.position, _node.transform.position) > 0.1f)
        {
            character.transform.position = Vector2.MoveTowards(character.transform.position, _node.transform.position, runSpeed * Time.deltaTime);
            yield return(new WaitForEndOfFrame());
        }

        character.transform.position = _node.transform.position;

        moveNextNode(_sequence, _completionCallback);

        yield return(new WaitForEndOfFrame());
    }
Exemplo n.º 7
0
 public void processSequence(MovementSequence _sequence, SequenceCallback _completionCallback)
 {
     playingNodeIndex = 0;
     if (_sequence.sequences.Length > 0)
     {
         if (_sequence.sequences[playingNodeIndex].movementType == MovementType.run)
         {
             StartCoroutine(RunSequence(_sequence, _sequence.sequences[playingNodeIndex], _completionCallback));
         }
         else if (_sequence.sequences[playingNodeIndex].movementType == MovementType.jump)
         {
             StartCoroutine(JumpSequence(_sequence, _sequence.sequences[playingNodeIndex], _completionCallback));
         }
     }
 }
Exemplo n.º 8
0
        internal static Sequence DoInsertCallback(Sequence inSequence, TweenCallback callback, float atPosition)
        {
            SequenceCallback callback2;

            inSequence.lastTweenInsertTime = atPosition;
            callback2 = new SequenceCallback(atPosition, callback);
            callback2.sequencedEndPosition = atPosition;
            //base.sequencedPosition = callback2.sequencedEndPosition;

            inSequence._sequencedObjs.Add(callback2);
            if (inSequence.duration < atPosition)
            {
                inSequence.duration = atPosition;
            }
            return(inSequence);
        }
Exemplo n.º 9
0
 private void moveNextNode(MovementSequence _sequence, SequenceCallback _completionCallback)
 {
     playingNodeIndex++;
     if (_sequence.sequences.Length > playingNodeIndex)
     {
         if (_sequence.sequences[playingNodeIndex].movementType == MovementType.run)
         {
             StartCoroutine(RunSequence(_sequence, _sequence.sequences[playingNodeIndex], _completionCallback));
         }
         else if (_sequence.sequences[playingNodeIndex].movementType == MovementType.jump)
         {
             StartCoroutine(JumpSequence(_sequence, _sequence.sequences[playingNodeIndex], _completionCallback));
         }
     }
     else
     {
         endSequence(_completionCallback);
     }
 }
Exemplo n.º 10
0
 private void endSequence(SequenceCallback _completionCallback)
 {
     _completionCallback();
 }