示例#1
0
    public void Start()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }
        instance = this;

        CurrentRespawnPoint = transform.position;

        timeManager.enabled                   = false;
        playerRigidbody.useGravity            = false;
        InputManager.instance.OnAnyInputDown += () =>
        {
            if (pausedGameAtSpawn)
            {
                UnfreezeGame();
            }
        };
        InputManager.instance.OnRespawn += () => { teleportPlayerToLastRespawnPoint(); };
        initialized = true;
        if (triedToTeleportToRespawnPointBeforeInitialized)
        {
            teleportPlayerToLastRespawnPoint();
        }
    }
 public void Initialise()
 {
     SetScore(DefaultScore);
     SetHealth(DefaultHealth);
     SetLives(DefaultLives);
     respawnPointController = GameObject.FindObjectOfType <RespawnPointController>();
     playerController       = GameObject.FindObjectOfType <PlayerController>();
     mainController         = GameObject.FindObjectOfType <MainController>();
     CheckLivesRemain();
 }
示例#3
0
    // Use this for initialization
    void Start()
    {
        sr = GetComponent <SpriteRenderer>();
        sr.transform.localScale = Vector3.one * lazerRadius * 2f;
        player = GameObject.Find("Player");
        rb     = player.GetComponent <Rigidbody>();
        rpc    = GameObject.Find("RespawnPoint").GetComponent <RespawnPointController>();

        //start the infinite coroutine
        StartCoroutine(FireLazer());
    }
示例#4
0
 void Start()
 {
     GameDifficulty = PlayerPrefs.GetInt(GameDifficultyPrefs, 0);
     StartCoroutine(StartTimer());
     UpdateWaveDisplay();
     totalEnemiesInWave = initialNumberOfEnemies;
     MoveSpawner();
     StartCoroutine(SpawnEnemies());
     respawnPointController = GameObject.FindObjectOfType <RespawnPointController>();
     respawnPointController.Respawn();
 }