Esempio n. 1
0
        private void InitializeVirus(float respawnDeviation)
        {
            List <RoadSegmentController> roadSegments = new List <RoadSegmentController>();

            for (int i = 0; i < _roadSegments.Count(); i++)
            {
                roadSegments.Add(RoadSegmentController.GetCopy(_roadSegments[i]));
            }
            Vector2 startPosition = _startPosition + StartDirection * respawnDeviation;

            roadSegments[0] = new LinearRoadSegmentController(startPosition, _firstTargetPosition);
            float virusSpeed = _groupSpeed * (_routeDistance - respawnDeviation * _convergenceFactor) / _routeDistance;

            Virus virus = Object.Instantiate(VirusPrefab, startPosition, Quaternion.identity).GetComponent <Virus>();

            virus.Initialize(roadSegments, _routeDistance - respawnDeviation, virusSpeed, Random.Range(0, Mathf.PI / 2));
        }