示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        infoDisplay   = GameObject.FindWithTag("PlayerScreen").GetComponentInChildren <InfoDisplayScript>();
        activeEnemies = new Dictionary <GameObject, EnemyType>();
        enemySet      = new List <GameObject>();

        waveNumber = 0;
        rotation   = Quaternion.Euler(new Vector3(0, 90, 0));
    }
示例#2
0
    // Start is called before the first frame update
    void Start()
    {
        // Find references to required components
        characterController = GetComponent <CharacterController>();
        if (cameraTransform == null)
        {
            cameraTransform = GetComponentInChildren <Camera>().transform;
        }

        // Set health bar UI element for health script
        healthScript = GetComponent <HealthScript>();
        HealthBarScript healthBar = GameObject.FindWithTag("PlayerScreen").GetComponentInChildren <HealthBarScript>();

        healthScript.SetHealthBar(healthBar);
        healthScript.ResetHealth();

        // Set default text for player info
        PlayerScore = 0;
        if (infoDisplay == null)
        {
            infoDisplay = GameObject.FindWithTag("PlayerScreen").GetComponentInChildren <InfoDisplayScript>();
            infoDisplay.ResetWave();
            infoDisplay.ResetScore();
        }
        if (announcement == null)
        {
            announcement = GameObject.FindWithTag("PlayerScreen").GetComponentInChildren <AnnouncementScript>();
        }

        // Setup switch timer and weapon player will be spawned with
        switchTimeLeft = timeToSwitch;
        if (timeDisplay == null)
        {
            timeDisplay = GameObject.FindWithTag("PlayerScreen").GetComponentInChildren <TimeDisplayScript>();
            timeDisplay.SetMaxTime(timeToSwitch);
            timeDisplay.ResetTime();
        }
        if (weaponDisplay == null)
        {
            weaponDisplay = GameObject.FindWithTag("PlayerScreen").GetComponentInChildren <WeaponDisplayScript>();
        }
        SwitchWeapon();
    }
示例#3
0
 void Awake()
 {
     highScore   = transform.parent.GetComponentInChildren <HighScoreScript>();
     infoDisplay = GetComponent <InfoDisplayScript>();
 }