Exemplo n.º 1
0
        Line GetRandomSpawnLine(Line previousLine)
        {
            var newLine = previousLine;

            while (newLine == previousLine)
            {
                newLine = MovementHelper.GetRandomLine();
            }
            return(newLine);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 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)));
     }
 }
Exemplo n.º 4
0
        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;
        }