private void Awake() { CreateBasePivot(); _currentFormation.Set((_formationList[0].Value)); _pivot.position = _currentFormation._pivot.position; _pivot.rotation = _currentFormation._pivot.rotation; UpdateFormation(); _animator.Subscribe(Animation.AnimationState.FadingIn, HandleAnimationStateEvent); _animator.Subscribe(Animation.AnimationState.FadingOut, HandleAnimationStateEvent); _animator.Subscribe(Animation.AnimationState.FadeInComplete, HandleAnimationStateEvent); _animator.Subscribe(Animation.AnimationState.FadeOutComplete, HandleAnimationStateEvent); _animator.Subscribe(Animation.AnimationState.Start, HandleAnimationStateEvent); _animator.Subscribe(Animation.AnimationState.Completed, HandleAnimationStateEvent); _timerPairList = new List <PairedValue <WeakpointFormation, Timer> >(); _direction = new List <Vector2>(); for (int i = 0; i < _weakpoints.Count; i++) { var direction = _trackPoints[i].position - _weakpoints[i].position; this._direction.Add(direction); } }
public void SwitchToFormat(WeakpointFormation formation) { _lastFormation.Set(_currentFormation); _targetFormation.Set(formation); _transiting = true; _transitionTime = 0; if (_targetFormation._type == _lastFormation._type) { return; } _transitionStartPoint.Clear(); foreach (var point in _trackPoints) { _transitionStartPoint.Add(point.position); } Vector3[] targetPoints; CalculateTargetPoints(out targetPoints); SortTrackPointstoClosestTarget(targetPoints); }