예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        isComplete = false;
        isGameOver = false;
        killCount  = 0;

        if (PlayerPrefs.HasKey("CurrentGems"))
        {
            gemCount = PlayerPrefs.GetInt("CurrentGems");
        }
        else
        {
            gemCount = 0;
        }

        gemText.text = gemCount.ToString();

        if (PlayerPrefs.HasKey("CurrentLevel"))
        {
            currentLevel = PlayerPrefs.GetInt("CurrentLevel");
        }
        else
        {
            currentLevel = 1;
        }
        playerController = FindObjectOfType <PlayerController>();
        levelPortal      = FindObjectOfType <LevelPortal>();
        waveSpawner      = FindObjectOfType <WaveSpawner2>();
        weaponSwitching  = FindObjectOfType <WeaponSwitching>();
        crosshair        = FindObjectOfType <Crosshair>();

        updateKillGoal();
        killText.text  = killCount.ToString() + "/" + killGoal.ToString();
        killText.color = Color.white;
    }
예제 #2
0
 // Start is called before the first frame update
 void Start()
 {
     currentWave   = 1;
     currentLevel  = levelManager.currentLevel - 1;
     waveCountDown = levels[currentLevel].timeBetweenWaves;
     levelPortal   = FindObjectOfType <LevelPortal>();
     levelManager.updateProgress();
 }
예제 #3
0
    private void Awake()
    {
        _parentPanel     = gameObject.GetComponent <RectTransform>();
        _pickupPositions = new List <Vector3>();
        _imgList         = new List <Image>();
        _pickupOffSet    = 0;
        _mobOffSet       = 0;
        _levelPortal     = FindObjectOfType <LevelPortal>();

        if (!RadarBlip)
        {
            Debug.LogError("No RadarBlip image set in TankRadarBox!");
            Debug.LogError("You probably forgot to assign one in the Inspector");
        }

        if (!playerPosition)
        {
            Debug.LogError("No PlayerPosition set in TankRadarBox!");
            Debug.LogError("You probably forgot to assign it in the Inspector");
        }

        if (!playerRadarSphere)
        {
            Debug.LogError("No PlayerRadarSphere set in TankRadarBox!");
            Debug.LogError("You probably forgot to assign it in the Inspector");
        }

        if (_levelPortal == null)
        {
            Debug.LogError("No PortalActor found in the current scene!");
            Debug.LogError("You may have forgotten to place a PortalActor instance!");
        }

        TankRadar.OnPickupInRange        += DrawRadarBlips;
        PickupManager.OnPickupCollected  += RemoveRadarBlip;
        MobManager.OnMobDestroyed        += RemoveRadarBlip;
        LevelPortal.OnLevelPortalEnabled += ShowPortalRadarBlip;
    }