Beispiel #1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.TryGetComponent(out Human human))
        {
            Tower collisionTower = human.GetComponentInParent <Tower>();
            if (collisionTower != null)
            {
                List <Human> collectedHumans = collisionTower.CollectHuman(_distanceChecker, _fixationMaxDistance);

                if (collectedHumans != null)
                {
                    _humans[0].StopRun();

                    for (int i = collectedHumans.Count - 1; i >= 0; i--)
                    {
                        Human insertHuman = collectedHumans[i];
                        InsertHuman(insertHuman);
                        DisplaceCheckers(insertHuman);
                    }
                    HumanAdded?.Invoke(_humans.Count);
                    _humans[0].Run();
                }

                collisionTower.Break();
            }
        }
    }
Beispiel #2
0
    public void HumanDelete(Human human)
    {
        if (_humans.Count == 1)
        {
            _humans[0].StopRun();
            _humans[0].Dead();
            PlayerDead?.Invoke();

            return;
        }

        if (human != null)
        {
            _humans[0].StopRun();
            _humans[_humans.Count - 1].StopWaving();

            PullOutHuman(human);

            if (_humans.Count != 1)
            {
                _humans[_humans.Count - 1].Waving();
            }

            _humans[0].Run();

            AttractCheckers(human);
            HumanAdded?.Invoke(_humans.Count);
        }
    }
Beispiel #3
0
    private void HumanAdd(Human human)
    {
        Tower collisionTower = human.transform.GetComponentInParent <Tower>();

        if (collisionTower == null)
        {
            return;
        }

        List <Human> collectedHumans = collisionTower.CollectHuman(_distanceChecker, _fixationMaxDistance);

        if (collectedHumans != null)
        {
            _humans[0].StopRun();
            _humans[_humans.Count - 1].StopWaving();

            for (int i = collectedHumans.Count - 1; i >= 0; i--)
            {
                Human insertHuman = collectedHumans[i];
                InSertHuman(insertHuman);
                DisplaceCheckers(insertHuman);
            }

            EquateHumansPosition(_humans);
            HumanAdded?.Invoke(_humans.Count);

            _humans[_humans.Count - 1].Waving();
            _humans[0].Run();
        }

        collisionTower.Break();
    }
 private void Start()
 {
     _humans = new List <Human>();
     _humans.Add(Instantiate(_startHuman, transform.position, Quaternion.identity, transform));
     _humans[0].Running(true);
     HumanAdded?.Invoke(_humans.Count);
 }
Beispiel #5
0
    private void Start()
    {
        _humans = new List <Human>();
        Vector3 spawnPoint = transform.position;

        _humans.Add(Instantiate(_startHuman, spawnPoint, Quaternion.identity, transform));
        _humans[0].Run();
        HumanAdded?.Invoke(_humans.Count);
    }
    public void CollectHumans(Tower collisionTower)
    {
        _humans[0].Running(false);
        List <Human> collectedHumans = collisionTower.CollectHuman(_distanceChecker, _fixationMaxDistance);

        if (collectedHumans != null)
        {
            _humans.InsertRange(0, collectedHumans);
            Build();
            HumanAdded?.Invoke(_humans.Count);
        }
        collisionTower.Break();
        _humans[0].Running(true);
    }