Пример #1
0
    private void Start()
    {
        humanoids = new List <Humanoid>();
        var firstHumanoid = Instantiate(startHumanoidPrefab, transform.position, Quaternion.identity, transform);

        humanoids.Add(firstHumanoid);
        humanoids[0].Run();

        HumanoidAdded?.Invoke(humanoids.Count);
        finishPoint = pathCreator.path.GetPointAtDistance(pathCreator.path.length, EndOfPathInstruction.Stop);
    }
Пример #2
0
    private void OnTriggerEnter(Collider other)
    {
        humanoids[0].Stop();
        if (other.gameObject.TryGetComponent(out Humanoid humanoid))
        {
            var humanoidTower      = humanoid.GetComponentInParent <Tower>();
            var collectedHumanoids = humanoidTower?.CollectHumanoidInTower(playerDistanceChecker, maxDistanceFromFixPoint);
            if (collectedHumanoids != null)
            {
                for (var i = collectedHumanoids.Count - 1; i >= 0; i--)
                {
                    var insertingHumanoid = collectedHumanoids[i];
                    InsertHumanoidInPlayerTower(insertingHumanoid);
                }
                HumanoidAdded?.Invoke(humanoids.Count);
            }

            humanoidTower?.BreakTower();
        }
    }