Ejemplo n.º 1
0
    void Start()
    {
        fireRateHZ      = 1f;
        hzText.text     = "1.00HZ";
        healthText.text = "Health: " + health;
        muzzleFlashBullet.StartPlayback();
        muzzleFlashPlasma.StartPlayback();
        muzzleAnimation = muzzleFlashBullet;
        shipAudioSource = GetComponent <AudioSource> ();

                #if UNITY_ANDROID
        myBody.GetComponent <MeshRenderer>().material     = Resources.Load("SilverMaterialAndroid", typeof(Material)) as Material;
        myGlass.GetComponent <MeshRenderer>().material    = Resources.Load("GlassMaterialAndroid", typeof(Material)) as Material;
        myLeftEng.GetComponent <MeshRenderer>().material  = Resources.Load("RedMaterialAndroid", typeof(Material)) as Material;
        myRightEng.GetComponent <MeshRenderer>().material = Resources.Load("RedMaterialAndroid", typeof(Material)) as Material;
                #endif

        persObj   = GameObject.Find("Persister");
        pers      = persObj.GetComponent <Persister>();
        gyroInput = pers.GetComponent <GyroToText> ();
    }
Ejemplo n.º 2
0
    void Awake()
    {
        Debug.Log("Awake in Persister()");
        pathToSaveFile = Application.persistentDataPath + "/" + dataFileName;
        Debug.Log("pathToSaveFile = " + pathToSaveFile);

        fadeOut = fadeOutObject.GetComponent <FadeInOut> ();
        fadeIn  = fadeInObject.GetComponent <FadeInOut> ();
        myGyro  = GetComponent <GyroToText> ();
        bgMusic = GetComponent <AudioSource> ();

        if (persister == null)
        {
            Debug.Log("persister is null");
            DontDestroyOnLoad(gameObject);
            persister = this;
            LoadSettings();
        }
        else if (persister != this)
        {
            Debug.Log("persister is not null and not this.  Destroying self.");
            Destroy(gameObject);
        }
    }