Example #1
0
    // Use this for initialization
    void Start()
    {
        GameObject gl = GameObject.Find("Global");

        nav           = GameObject.FindGameObjectWithTag("NavAgent");
        nav_obj       = nav.GetComponent <NavMeshAgent>();
        globalObj     = gl.GetComponent <Level1_Global>();
        uniWii        = gl.GetComponent <UniWiiCheck>();
        spawn_nav_obj = GameObject.FindGameObjectWithTag("ObsNavAgent").GetComponent <NavMeshAgent>();

        cameraController = GameObject.Find("OVRCameraController");
        so = cameraController.GetComponentsInChildren <ScreenOverlay>();

        // Set the screen overlay parameters
        so[0].enabled   = false;
        so[0].blendMode = ScreenOverlay.OverlayBlendMode.AlphaBlend;
        so[0].intensity = 1.0f;

        so[1].enabled   = false;
        so[1].blendMode = ScreenOverlay.OverlayBlendMode.AlphaBlend;
        so[1].intensity = 1.0f;

        overlayTimer  = 0.5f;
        overlayToggle = false;

        //gameObject.rigidbody.AddForce(0, 0, -1000);//new Vector3(Random.Range (-10,10),0,Random.Range (-4,-5)));//
        // Avoid collision between the navAgent and the obstacles
        Physics.IgnoreLayerCollision(11, 20, true);
        Physics.IgnoreLayerCollision(10, 20, true);
        Physics.IgnoreLayerCollision(20, 20, true);
    }
    // Use this for initialization
    void Start()
    {
        nav = GameObject.FindGameObjectWithTag("NavAgent");
        nav_obj = nav.GetComponent<NavMeshAgent>();
        spawn_nav_obj = GameObject.FindGameObjectWithTag("ObsNavAgent").GetComponent<NavMeshAgent>();

        globalObj = GameObject.Find("Global").GetComponent<Level1_Global>();

        destination = endPoint.transform.position;
    }
    // Start
    new public virtual void Start()
    {
        base.Start();

        InitializeInputs();
        SetCameras();

        //getting uniwiicheck script
        GameObject gl = GameObject.Find("Global");

        uniWii    = gl.GetComponent <UniWiiCheck>();
        globalObj = gl.GetComponent <Level1_Global>();

        nav_obj     = GameObject.FindGameObjectWithTag("NavAgent").GetComponent <NavMeshAgent>();
        obs_nav_obj = GameObject.FindGameObjectWithTag("ObsNavAgent").GetComponent <NavMeshAgent>();
    }
Example #4
0
    // Use this for initialization
    void Start()
    {
        // Get the aim direction and add force to the bubble object
        GameObject gl = GameObject.Find("Global");

        globalObj      = gl.GetComponent <Level1_Global>();
        shootDirection = globalObj.direction;
        gameObject.rigidbody.AddForce(shootDirection * 500.0f);

        //Debug.Log("bullet force is " + (shootDirection*5000.0f).ToString());

        // Remove collision with other bubbles
        Physics.IgnoreLayerCollision(14, 14, true);

        // Remove collision with player
        Physics.IgnoreLayerCollision(14, 8, true);
    }
    // Start
    public new virtual void Start()
    {
        base.Start();

        InitializeInputs();
        SetCameras();

        //getting uniwiicheck script
        GameObject gl = GameObject.Find("Global");
        uniWii = gl.GetComponent<UniWiiCheck>();

        if(PlayerPrefs.GetInt("Level") == 1)
            globalObj = gl.GetComponent<Level1_Global>();

        else if(PlayerPrefs.GetInt("Level") == 2)
            globalObj2 = gl.GetComponent<Level2_Global>();

        nav_obj = GameObject.FindGameObjectWithTag("NavAgent").GetComponent<NavMeshAgent>();
        obs_nav_obj = GameObject.FindGameObjectWithTag("ObsNavAgent").GetComponent<NavMeshAgent>();
    }
Example #6
0
 // Use this for initialization
 void Start()
 {
     globalObj = gameObject.GetComponent <Level1_Global>();
     //audio2.Play();
 }
Example #7
0
    // Use this for initialization
    void Start()
    {
        GameObject gl = GameObject.Find("Global");

        globalObj     = gl.GetComponent <Level1_Global>();
        healthString  = (globalObj.currentHealth) + "/" + (globalObj.maxHealth);
        staminaString = (int)(globalObj.currentStamina) + "/" + (globalObj.maxStamina);
        scoreString   = globalObj.score + "";

        healthBarLength  = 100.0f * (float)((float)globalObj.currentHealth / (float)globalObj.maxHealth);
        staminaBarLength = 100.0f * (float)((float)globalObj.currentStamina / (float)globalObj.maxStamina);

        healthPUStored  = globalObj.storedHealthPU;
        staminaPUstored = globalObj.storedStaminaPU;

        bubbleNum = globalObj.bubblesLeft;

        timer = globalObj.timer;

        int minutes = (int)(timer / 60);
        int seconds = (int)(timer % 60);

        timeString = string.Format("{0:00}:{1:00}", minutes, seconds);

        // Ensure that camera controller variables have been properly
        // initialized before we start reading them
        if (CameraController != null)
        {
            CameraController.InitCameraControllerVariables();
            GuiHelper.SetCameraController(ref CameraController);
        }

        // Set the GUI target
        GUIRenderObject = GameObject.Instantiate(Resources.Load("OVRGUIObjectMain")) as GameObject;

        if (GUIRenderObject != null)
        {
            if (GUIRenderTexture == null)
            {
                int w = Screen.width;
                int h = Screen.height;

                if (CameraController.PortraitMode == true)
                {
                    int t = h;
                    h = w;
                    w = t;
                }

                // We don't need a depth buffer on this texture
                GUIRenderTexture = new RenderTexture(w, h, 0);
                GuiHelper.SetPixelResolution(w, h);
                GuiHelper.SetDisplayResolution(OVRDevice.HResolution, OVRDevice.VResolution);
            }
        }

        // Attach GUI texture to GUI object and GUI object to Camera
        if (GUIRenderTexture != null && GUIRenderObject != null)
        {
            GUIRenderObject.renderer.material.mainTexture = GUIRenderTexture;

            if (CameraController != null)
            {
                // Grab transform of GUI object
                Transform t = GUIRenderObject.transform;
                // Attach the GUI object to the camera
                CameraController.AttachGameObjectToCamera(ref GUIRenderObject);
                // Reset the transform values (we will be maintaining state of the GUI object
                // in local state)
                OVRUtils.SetLocalTransform(ref GUIRenderObject, ref t);
                // Deactivate object until we have completed the fade-in
                // Also, we may want to deactive the render object if there is nothing being rendered
                // into the UI
                // we will move the position of everything over to the left, so get
                // IPD / 2 and position camera towards negative X
                Vector3 lp  = GUIRenderObject.transform.localPosition;
                float   ipd = 0.0f;
                CameraController.GetIPD(ref ipd);
                lp.x -= ipd * 0.5f;
                GUIRenderObject.transform.localPosition = lp;

                GUIRenderObject.SetActive(false);
            }
        }
    }
Example #8
0
    // Use this for initialization
    void Start()
    {
        GameObject gl = GameObject.Find("Global");
        nav = GameObject.FindGameObjectWithTag("NavAgent");
        navObj = nav.GetComponent<NavMeshAgent>();
        globalObj = gl.GetComponent<Level1_Global>();
        uniWii = gl.GetComponent<UniWiiCheck>();
        obstacleNavObj = GameObject.FindGameObjectWithTag("ObsNavAgent").GetComponent<NavMeshAgent>();
        audioScript = gl.GetComponent<Level1_Audio>();

        cameraController = GameObject.Find("OVRCameraController");
        so = cameraController.GetComponentsInChildren<ScreenOverlay>();

        // Set the screen overlay parameters
        so[0].enabled = false;
        so[0].blendMode = ScreenOverlay.OverlayBlendMode.AlphaBlend;
        so[0].intensity = 1.0f;

        so[1].enabled = false;
        so[1].blendMode = ScreenOverlay.OverlayBlendMode.AlphaBlend;
        so[1].intensity = 1.0f;

        overlayTimer = 0.5f;
        overlayToggle = false;

        bubbleParticleSpawnTimer = Constants.BUBBLE_PARTICLE_SPAWN_TIMER;

        powerUpSpawnTimer = UnityEngine.Random.Range(15.0f, 20.0f);

        playGrindSound = false;
        grindTimer = 0.0f;

        // Easy
        if(globalObj.branchDiff == 0)
            obstacleTimer = UnityEngine.Random.Range(0.5f, 2.0f);

        // Hard
        else if(globalObj.branchDiff == 1)
            obstacleTimer = UnityEngine.Random.Range(0.5f, 1.0f);

        // Avoid collision between the navAgent and the obstacles
        Physics.IgnoreLayerCollision(11, 20, true);
        Physics.IgnoreLayerCollision(10, 20, true);
        Physics.IgnoreLayerCollision(20, 20, true);

        Physics.IgnoreLayerCollision(17, 20, true);
    }
Example #9
0
    // Use this for initialization
    void Start()
    {
        GameObject gl = GameObject.Find("Global");
        globalObj = gl.GetComponent<Level1_Global>();
        healthString = (globalObj.currentHealth) + "/" +(globalObj.maxHealth);
        staminaString = (int)(globalObj.currentStamina) + "/" +(globalObj.maxStamina);
        scoreString = globalObj.score + "";

        healthBarLength = healthBarDefault * (float)((float)globalObj.currentHealth/(float)globalObj.maxHealth);
         	staminaBarLength = healthBarDefault * (float)((float)globalObj.currentStamina/(float)globalObj.maxStamina);

        healthPUStored = globalObj.storedHealthPU;
        staminaPUstored = globalObj.storedStaminaPU;

        bubbleNum = globalObj.bubblesLeft;

        timer = globalObj.timer;

        int minutes = (int)(timer / 60);
           		int seconds = (int)(timer % 60);

           		timeString = string.Format("{0:00}:{1:00}", minutes, seconds);

        // Ensure that camera controller variables have been properly
          	// initialized before we start reading them
          	if(CameraController != null)
          	{
         	CameraController.InitCameraControllerVariables();
         	GuiHelper.SetCameraController(ref CameraController);
          	}

          	// Set the GUI target
          	GUIRenderObject = GameObject.Instantiate(Resources.Load("OVRGUIObjectMain")) as GameObject;

          	if(GUIRenderObject != null)
          	{
         	if(GUIRenderTexture == null)
         	{
                int w = Screen.width;
                int h = Screen.height;

                if(CameraController.PortraitMode == true)
                {
               		int t = h;
               		h = w;
               		w = t;
                }

                // We don't need a depth buffer on this texture
                GUIRenderTexture = new RenderTexture(w, h, 0);
                GuiHelper.SetPixelResolution(w, h);
                GuiHelper.SetDisplayResolution(OVRDevice.HResolution, OVRDevice.VResolution);
         	}
          	}

          	// Attach GUI texture to GUI object and GUI object to Camera
          	if(GUIRenderTexture != null && GUIRenderObject != null)
          	{
         	GUIRenderObject.renderer.material.mainTexture = GUIRenderTexture;

         	if(CameraController != null)
         	{
                // Grab transform of GUI object
                Transform t = GUIRenderObject.transform;
                // Attach the GUI object to the camera
                CameraController.AttachGameObjectToCamera(ref GUIRenderObject);
                // Reset the transform values (we will be maintaining state of the GUI object
                // in local state)
                OVRUtils.SetLocalTransform(ref GUIRenderObject, ref t);
                // Deactivate object until we have completed the fade-in
                // Also, we may want to deactive the render object if there is nothing being rendered
                // into the UI
                // we will move the position of everything over to the left, so get
                // IPD / 2 and position camera towards negative X
                Vector3 lp = GUIRenderObject.transform.localPosition;
                float ipd = 0.0f;
                CameraController.GetIPD(ref ipd);
                lp.x -= ipd * 0.5f;
                GUIRenderObject.transform.localPosition = lp;

                GUIRenderObject.SetActive(false);
         	}
          	}
    }
Example #10
0
    // Use this for initialization
    void Start()
    {
        // Get the aim direction and add force to the bubble object
        GameObject gl = GameObject.Find("Global");
        globalObj = gl.GetComponent<Level1_Global>();
        audioScript = gl.GetComponent<Level1_Audio>();

        navObj = GameObject.FindGameObjectWithTag("NavAgent").GetComponent<NavMeshAgent>();
        shootDirection = globalObj.direction;

        gameObject.rigidbody.AddForce(shootDirection * Constants.BUBBLE_FORCE * (navObj.speed/Constants.DEFAULT_FLOW_SPEED));

        // Remove collision with other bubbles
        Physics.IgnoreLayerCollision(14, 14, true);

        // Remove collision with player
        Physics.IgnoreLayerCollision(14, 8, true);
    }
Example #11
0
 // Use this for initialization
 void Start()
 {
     globalObj = gameObject.GetComponent<Level1_Global>();
     //audio2.Play();
 }