コード例 #1
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);
    }
コード例 #2
0
ファイル: Navigation.cs プロジェクト: sohailmehra7/Free-Gilly
    // 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);
    }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        // Set camera controller
        SetOVRCameraController(ref CameraController);

        uniWii = gameObject.GetComponent<UniWiiCheck>();
        audioScript = gameObject.GetComponent<Level1_Audio>();

        currentHealth = 100;
        maxHealth = 100;
        currentStamina = 100.0f;
        maxStamina = 100.0f;

        storedHealthPU = false;
        storedStaminaPU = false;

        bubblesLeft = Constants.MAX_BUBBLES;
        bubbleRegenTimer = Constants.BUBBLE_REGEN_TIME;
        staminaRegenTimer = Constants.STAMINA_REGEN_TIME;
        shootTimer = Constants.SHOOT_TIME;
        shootEnabled = true;

        pauseTimer = Constants.PAUSE_TOGGLE_DELAY;
        pauseEnabled = true;

        // Default setting = easy
        branchDiff = 0;

        score = 0;
        startTime = Time.time;

        smObsDestroyed = 0;

        // Ignore appropriate collisions
        setUpPhysics();

        // Achievements
        LEVEL1_ACH = new string[] {	"Complete the level in under 10 minutes",
                                    "Shoot and destroy 25 small obstacles",
                                    "Complete the level without using any health power-ups",
                                    "Complete the level while selecting the industrial pipes at each junction"};

        LEVEL1_ACH_TRACKER = new int[] {1, 0, 1, 1};

        PlayerPrefs.SetInt("Complete", 0);
        PlayerPrefs.SetInt("Score", score);
        PlayerPrefs.SetFloat("Time", timer);
        PlayerPrefs.SetString("SceneToLoad", "Level1");
        PlayerPrefsX.SetStringArray("AchievementList", LEVEL1_ACH);
        PlayerPrefsX.SetIntArray("AchievementTracker", LEVEL1_ACH_TRACKER);
    }