Esempio n. 1
0
 public override float Move(VirusMovement virus, float amplitude, float frequency, float phase, float _totalDistance)
 {
     virus.transform.position  = Vector2.Lerp(_startPosition, _endPosition, Progress);
     virus.transform.right     = _endPosition - _startPosition;
     virus.transform.position += virus.transform.up * amplitude * Mathf.Sin(_totalDistance * frequency + phase);
     virus.transform.Rotate(0F, 0F, Mathf.Atan(amplitude * Mathf.Cos(_totalDistance * frequency + phase)) * Mathf.Rad2Deg);
     return(virus.FrameSpeed);
 }
        public override float Move(VirusMovement virus, float amplitude, float frequency, float phase, float _totalDistance)
        {
            Vector2 newTarget = Circle.Lerp(_startDirection, _endDirection, _clockWise, Progress).normalized;

            virus.transform.position  = _circle.Position + newTarget * _circle.Radius;
            virus.transform.up        = _clockWise ? newTarget : -newTarget;
            virus.transform.position += virus.transform.up * amplitude * Mathf.Sin(_totalDistance * frequency + phase);
            virus.transform.Rotate(0F, 0F, Mathf.Atan(amplitude * Mathf.Cos(_totalDistance * frequency + phase)) * Mathf.Rad2Deg);
            return(virus.FrameSpeed);
        }
Esempio n. 3
0
 public VirusMovementManager(IEnumerable <RoadSegmentController> roadSegments, float routeDistance, VirusMovement virusMovement, float groupSpeed, float phase)
 {
     _routeDistance = routeDistance;
     _virusMovement = virusMovement;
     _speed         = groupSpeed;
     _virusMovement.Initialize(UnityEngine.Random.Range(0, Mathf.PI / 2));
     _roadSegments       = new Queue <RoadSegmentController>(roadSegments);
     _currentRoadSegment = _roadSegments.Dequeue();
     Phase     = phase;
     Amplitude = UnityEngine.Random.Range(0.1F, 0.3F);
     Frequency = UnityEngine.Random.Range(0.3F, 1.5F);
     ChangeSpeed();
 }
 public abstract float Move(VirusMovement virus, float amplitude, float frequency, float phase, float _totalDistance);