Line GetRandomSpawnLine(Line previousLine)
        {
            var newLine = previousLine;

            while (newLine == previousLine)
            {
                newLine = MovementHelper.GetRandomLine();
            }
            return(newLine);
        }
        IReadOnlyCollection <Line> GetOccupiedLines()
        {
            var previousLine = MovementHelper.GetRandomLine();
            var lines        = new List <Line>();

            for (int i = 0; i < ObstaclesNumber; i++)
            {
                lines.Add(i == 0 ? previousLine : GetRandomSpawnLine(previousLine));
            }
            return(lines);
        }
示例#3
0
 public IEnumerator StartSpawning()
 {
     while (true)
     {
         var randomLine = MovementHelper.GetRandomLine();
         var wolf       = Instantiate(
             wolfPrefab,
             new Vector3(0f, 0f, MovementHelper.LinePositions[randomLine]), Quaternion.identity);
         wolf.GetComponent <AIWolfMovementController>().CurrentLine = randomLine;
         yield return(new WaitForSeconds(Random.Range(minTimeBetweenSpawns, maxTimeBetweenSpawns)));
     }
 }
        void Start()
        {
            GameManager.Instance.State.StatusChanged += OnStatusChanged;
            wolf.GlitchEffect.OnGlitch += () =>
            {
                if (!CanRandomlyTeleport)
                {
                    return;
                }

                CurrentLine = MovementHelper.GetRandomLine(CurrentLine);
                TeleportWolf(CurrentLine);
            };
            currentVelocity = startVelocity;
            animator.speed  = 1f + 1f / 12f * currentVelocity;
        }