Example #1
0
 private void HandleAtPathEndEvent(ZMWaypointMovementEventArgs args)
 {
     if (args.movement.CompareTag(Tags.kMainCamera))
     {
         BeginGame();
     }
 }
Example #2
0
    void FixedUpdate()
    {
        // state sets
        if (_moveState == MoveState.MOVE && _waypointIndex < _waypointSize)
        {
            // set up the movement variables
            _distanceTraveled = 0.0f;

            if (_waypoints[_waypointIndex] != null)
            {
                _targetPosition   = _waypoints[_waypointIndex].position;
                _distanceToTarget = (_targetPosition - transform.position).magnitude;

                _moveState = MoveState.MOVING;
            }

            _waypointIndex += 1;
        }

        // state checks
        if (_moveState == MoveState.MOVING)
        {
            float   distanceRatio;
            Vector3 newPosition;

            _distanceTraveled += moveSpeed * Time.deltaTime;
            distanceRatio      = _distanceTraveled / _distanceToTarget;

            newPosition = Vector3.Lerp(transform.position, _targetPosition, distanceRatio);

            transform.position = newPosition;

            if ((_targetPosition - transform.position).sqrMagnitude < 4.0f * 4.0f)
            {
                _moveState         = MoveState.AT_TARGET;
                transform.position = _targetPosition;
            }
        }
        else if (_moveState == MoveState.AT_TARGET)
        {
            if (_waypointIndex < _waypointSize)
            {
                var args = new ZMWaypointMovementIntEventArgs(this, _waypointIndex);

                _moveState = MoveState.MOVE;

                Notifier.SendEventNotification(AtPathNodeEvent, args);
            }
            else if (_waypointIndex == _waypointSize)
            {
                var args = new ZMWaypointMovementEventArgs(this);

                _moveState      = MoveState.COMPLETED;
                _waypointIndex += 1;

                Notifier.SendEventNotification(AtPathEndEvent, args);
            }
        }
    }
Example #3
0
 private void HandleAtPathEndEvent(ZMWaypointMovementEventArgs args)
 {
     if (args.movement.CompareTag(Tags.kMainCamera))
     {
         Zoom(endZoom);
         _speed = 1.0f;
     }
 }
Example #4
0
    void HandleAtPathEndEvent(ZMWaypointMovementEventArgs args)
    {
        if (gameObject == args.movement.gameObject)
        {
            var infoArgs = new ZMPlayerInfoEventArgs(_playerInfo);

            Notifier.SendEventNotification(ActivateEvent, infoArgs);
        }
    }
Example #5
0
 private void HandleAtPathEndEvent(ZMWaypointMovementEventArgs args)
 {
     if (args.movement.CompareTag("MainCamera"))
     {
         // start the intro
         _audio.PlayOneShot(battleIntro);
         Invoke(kPlayMainBattleTrackMethodName, battleIntro.length);
     }
 }