Example #1
0
    void Start()
    {
        camSetting   = (SettingsStatic.CamSettings)SettingsManager.GetCameraSetting();
        camPlayerSet = false;

        ScoreKeeper.shots       = 0;
        ScoreKeeper.hits        = 0;
        ScoreKeeper.playerKills = 0;

        // TODO figure out a better way to do this
        LevelManager.isPaused = false;
        alive = true;

        ship       = gameObject.GetComponentInParent <ShipController>();
        ship.owner = gameObject.GetComponent <PlayerController>();

        targetIndicatorEnabled = false;
        velocityVector         = gameObject.transform.Find("VelocityVector").GetComponent <LineRenderer>();
        leadLine.enabled       = false;
        fc = gameObject.GetComponent <FiringController>();
        //ship.IFF = "green";

        menuCanvas  = GameObject.Find("MenuCanvas");
        hintsCanvas = GameObject.Find("HintsCanvas");
        // Debug.Log("Canvas found with name: " + menuCanvas.name);
        if (menuCanvas != null)
        {
            menuCanvas.SetActive(false);
        }
        if (hintsCanvas != null)
        {
            hintsCanvas.SetActive(false);
        }

        levelManager = GameObject.Find("LevelManager").GetComponent <LevelManager>();

        weaponText    = GameObject.Find("UIWeaponText").GetComponent <WeaponTextScript>();
        radarText     = GameObject.Find("UIRadarText").GetComponent <UIRadarText>();
        fuelSlider    = GameObject.Find("FuelSlider").GetComponent <Slider>();
        healthSlider  = GameObject.Find("HealthSlider").GetComponent <Slider>();
        contactsText  = GameObject.Find("UIContactsText").GetComponent <UIContactsText>();
        initialHealth = ship.health;

        selectedWeapon = Weapon.plasma;
        weaponText.SetUIWeapontext("Plasma");
        radarText.SetUIRadarText("off");
        SetCursorGame();

        // float distance = transform.position.z - Camera.main.transform.position.z;
        camera.fieldOfView = initialZoom;

        InvokeRepeating("UpdateUI", 0.00001f, 0.5f);
        Invoke("LateStart", 0.5f);
        lockIndicator.SetActive(false);

        ResizeMinimap();
    }
Example #2
0
    void SetRadarText()
    {
        radarState = ship.GetRadarState();
        switch (radarState)
        {
        case RadarController.RadarState.off:
            radarText.SetUIRadarText("off");
            break;

        case RadarController.RadarState.wide:
            radarText.SetUIRadarText("wide");
            break;

        case RadarController.RadarState.narrow:
            radarText.SetUIRadarText("narrow");
            break;
        }
    }