コード例 #1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
コード例 #2
0
        public SimpleCameraShake shake;                                     // the reference to our camera shake script on the MainCam

        void Awake()
        {
            //cache a reference to this gameObject.
            thisGameObject = this.gameObject;

            //Setup Shake and Chroma Script References... both scripts are on the main camera
            shake  = Camera.main.GetComponent <SimpleCameraShake>();
            chroma = Camera.main.GetComponent <ChromaticAberration>();
        }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        //use mainCamera reference to get the Chromatic Abberation and Camera Shake References setup;
        chromo = mainCam.GetComponent <ChromaticAberration>();

        shake = mainCam.GetComponent <SimpleCameraShake>();

        //get a count of the colors and store in numOfColors(another integer variable from the enum that will helps us later)
        numOfColors = System.Enum.GetValues(typeof(PlayerColor)).Length;
    }
コード例 #4
0
ファイル: CameraShakeEditor.cs プロジェクト: scottbass47/gsts
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        SimpleCameraShake shake = (SimpleCameraShake)target;


        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Preview parameters");
        duration = EditorGUILayout.FloatField("Duration", duration);

        noise = (NoiseSettings)EditorGUILayout.ObjectField("Noise", noise, typeof(NoiseSettings), true);

        if (GUILayout.Button("Preview"))
        {
            shake.EditorPreviewShake(duration, noise);
        }
    }
コード例 #5
0
    void Awake()
    {
        //I usually use awake for setting up references, so we will do that first.
        //the next three lines will get a reference to the 3 gameObjects in the game scenes that control the powerUp
        //effects.  These gameObjects each have a spriteRenderer that is used to display the powerUp labels and some have
        //borders (like Freeze Effect).

        //all of the tags in the game are stored in [const readonly strings], in our Tags Class.  There was quite a few
        //different tags, and since I would prefer the scripts to autoComplete, I created read only strings for them.
        freezeEffectGameObject        = GameObject.FindGameObjectWithTag(Tags.freezeEffectGameObjectTag).GetComponent <FreezeEffect>();
        frenzyEffectGameObject        = GameObject.FindGameObjectWithTag(Tags.frenzyEffectGameObjectTag).GetComponent <FrenzyEffect>();
        twoTimesScoreEffectGameObject = GameObject.FindGameObjectWithTag(Tags.twoTimesScoreEffectGameObjectTag).GetComponent <TwoTimesScoreEffect>();

        //cache a reference to this gameObject.
        thisGameObject = this.gameObject;

        //Setup Shake and Chroma Script References... both scripts are on the main camera
        shake  = Camera.main.GetComponent <SimpleCameraShake>();
        chroma = Camera.main.GetComponent <ChromaticAberration>();
    }
コード例 #6
0
 void Start()
 {
     chromo      = mainCam.GetComponent <ChromaticAberration>();
     shake       = mainCam.GetComponent <SimpleCameraShake>();
     numOfColors = System.Enum.GetValues(typeof(PlayerColor)).Length;
 }
コード例 #7
0
 void Awake()
 {
     //Setup Shake and Chroma Script References... both scripts are on the main camera
     shake  = Camera.main.GetComponent <SimpleCameraShake>();
     chroma = Camera.main.GetComponent <ChromaticAberration>();
 }