Beispiel #1
0
    public void ZombiesArrived()
    {
        if (!_gameOver)
        {
            _gameOver = true;

            GameObject             cameraGO         = Camera.main.gameObject;
            ZombieCameraController cameraController = _zombieSquad.GetComponent <ZombieCameraController>();
            Vector3 offset = cameraController.DistanceToCamera;
            Destroy(cameraController);

            EndCameraController endCameraController = cameraGO.AddComponent <EndCameraController>();
            Vector3             finalOffset         = new Vector3(10f, 10f, 10f);
            endCameraController.Init(offset, _humanBase.transform.position + new Vector3(-3f, 0f, 0f), finalOffset, () => {
                if (_zombieSquad.Zombies.Count >= _humanBase.RequiredZombies)
                {
                    ShowYouWin();
                }
                else
                {
                    ShowYouLose("You need at least " + _humanBase.RequiredZombies + " zombies");
                }
            });
        }
    }
    void Awake()
    {
        _zombie = GetComponent <Zombie>();
        if (_zombie == null)
        {
            Debug.LogWarning("Zombie is NOT found!!");
        }

        _physics = GetComponent <ImpactPhysics>();

        _zombieMover = GetComponent <ZombieMover>();

        _cameraController = FindObjectOfType <ZombieCameraController>();
    }