Example #1
0
    /*
     *
     *      FORMAT IS AS FOLLOWS:
     *
     *      SPELL CORES
     *      ELEMENTALS AND MODIFIERS|
     *      assembledSpellQuickBar (one list per line)|
     *      GOLD,EXP, TOWER MAX HEAL
     *
     */

    // Use this for initialization
    void Awake()
    {
        Resources.UnloadUnusedAssets();
        masterGameManager = GameObject.FindWithTag("GameController").GetComponent <MasterGameManager>();
        textFile          = (TextAsset)Resources.Load(textFileName);
        ReadAllData();
    }
    // Use this for initialization
    void Awake()
    {
        Application.SetStackTraceLogType(LogType.Log, StackTraceLogType.None);

        spellEngine       = gameObject.GetComponent <SpellEngine>();
        airsigManager     = gameObject.GetComponent <AirSigManager>();
        masterGameManager = GameObject.FindWithTag("GameController").GetComponent <MasterGameManager>();
        // Update the display text
        //textMode.text = string.Format("Mode: {0}", AirSigManager.Mode.DeveloperDefined.ToString());
        //textResult.text = defaultResultText = "Pressing trigger and write symbol in the air\nReleasing trigger when finish";
        //textResult.alignment = TextAnchor.UpperCenter;
        //instruction.SetActive(false);
        //ToggleGestureImage("All");

        // Configure AirSig by specifying target
        developerDefined = new AirSigManager.OnDeveloperDefinedMatch(HandleOnDeveloperDefinedMatch);
        airsigManager.onDeveloperDefinedMatch += developerDefined;
        airsigManager.SetMode(AirSigManager.Mode.DeveloperDefined);
        List <string> temp = new List <string>();

        temp.Add("Dot");
        temp.Add("Line");
        temp.Add("Circle");
        //temp.Add("Square");
        temp.Add("Triangle");

        airsigManager.SetDeveloperDefinedTarget(temp);
        airsigManager.SetClassifier("FinalGestureProfile", "");

        //airsigManager.SetDeveloperDefinedTarget(spellEngine.getCompleteSpellPartsNameList());
        //airsigManager.SetClassifier("GestureProfile1", "");
        //airsigManager.SetClassifier("SpellCoresV1", "");

        /*developerDefinedCore = new AirSigManager.OnDeveloperDefinedMatch(HandleOnDeveloperDefinedMatchCore);
         * airsigManager.onDeveloperDefinedMatch += developerDefinedCore;
         * airsigManager.SetMode(AirSigManager.Mode.DeveloperDefined);
         * airsigManager.SetDeveloperDefinedTarget(spellEngine.getCompleteSpellPartsNameList());
         * airsigManager.SetClassifier("GestureProfile1", "");*/



        //checkDbExist();

        airsigManager.SetTriggerStartKeys(
            AirSigManager.Controller.RIGHT_HAND,
            SteamVR_Controller.ButtonMask.Trigger,
            AirSigManager.PressOrTouch.PRESS);


        airsigManager.SetTriggerStartKeys(
            AirSigManager.Controller.LEFT_HAND,
            SteamVR_Controller.ButtonMask.Touchpad,
            AirSigManager.PressOrTouch.PRESS);
    }
    // Use this for initialization
    void Start()
    {
        masterGameManager       = GameObject.FindWithTag("GameController").GetComponent <MasterGameManager>();
        maximumHealth           = masterGameManager.towerMaximumHealth;
        currentHealth           = maximumHealth;
        upgradeHealthMultiplier = 1.5;
        repairHealthIncrement   = 50;
        currentTimeInSeconds    = 0;

        InvokeRepeating("timeIncrement", 0.0f, 1.0f);
    }
    void Start()
    {
        gameController = GameObject.FindWithTag("GameController").GetComponent <MasterGameManager>();
        if (gameController == null)
        {
            Debug.Log("Reference to gameController could not be found in EnemyManager class");
        }

        // Call the Spawn function after a delay of the spawnTime and then continue to call after the same amount of time.
        InvokeRepeating("Spawn", delay, delay);
        getElement = GetComponentInChildren <PortalSize>();
    }
    // Use this for initialization
    void Start()
    {
        gameController = GameObject.FindWithTag("GameController").GetComponent <MasterGameManager>();
        for (int i = 0; i <= 200; i++)
        {
            float   angle   = UnityEngine.Random.Range(90, 270);
            float   radians = angle * Mathf.Deg2Rad;
            float   z       = 60 * Mathf.Sin(radians);
            float   x       = 60 * Mathf.Cos(radians);
            Vector3 temp    = new Vector3(x, 0, z);
            spawnPoints.Add(temp);
        }

        InvokeRepeating("Spawn", delay, delay);
    }
    // Use this for initialization
    void Start()
    {
        currentHealth = startingHealth;
        goldGained    = 100;
        expGained     = 10;
        GameObject gameManagerObject = GameObject.FindWithTag("GameController");

        if (gameManagerObject != null)
        {
            gameManager = gameManagerObject.GetComponent <MasterGameManager>();
        }
        else
        {
            Debug.Log("Cannot find gameManager.");
        }
    }
Example #7
0
    // Use this for initialization
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
            //If instance already exists and it's not this:
        }
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }
        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);

//		currentLevel = 1;

        //set up the level array (which level can we play/access which not)
        SetUpLevels();
    }
    // Use this for initialization
    void Start()
    {
        if (GameObject.FindWithTag("dominantHand") != null)
        {
            myHand = GameObject.FindWithTag("dominantHand").GetComponent <NVRHand>();
            if (myHand == null)
            {
                Debug.Log("Could not find the dominant hand object");
            }
        }


        //myHand.LongHapticPulse(1);
        //StartCoroutine(LongVibration(1, 4000));
        //Debug.Log("AAAAAAAAAAAAAAAAHHHHH");
        currentHealth = startingHealth;
        goldGained    = 100;
        expGained     = 10;
        GameObject gameManagerObject = GameObject.FindWithTag("GameController");

        if (gameManagerObject != null)
        {
            gameManager = gameManagerObject.GetComponent <MasterGameManager>();
        }
        else
        {
            Debug.Log("Cannot find gameManager.");
        }
        ElementToWeaknesss.Add("Fire", "Water");
        ElementToWeaknesss.Add("Water", "Nature");
        ElementToWeaknesss.Add("Nature", "Fire");

        ElementToResistance.Add("Water", "Fire");
        ElementToResistance.Add("Fire", "Nature");
        ElementToResistance.Add("Nature", "Water");
        damageMultiplier = 1;
        rewardMultiplier = 1;
    }
    void Awake()
    {
        spellsQueuedUp = new Queue <string>();

        masterGameManager = GameObject.FindWithTag("GameController").GetComponent <MasterGameManager>();

        spellCoreName2PreFab.Add("ArrowV1", (GameObject)Resources.Load("ArrowPrefab", typeof(GameObject)));
        spellCoreName2PreFab.Add("ShieldV1", (GameObject)Resources.Load("ShieldPrefab", typeof(GameObject)));
        spellCoreName2PreFab.Add("BeamV1", (GameObject)Resources.Load("BeamPrefab", typeof(GameObject)));
        spellCoreName2PreFab.Add("LightningV1", (GameObject)Resources.Load("LightningPrefab", typeof(GameObject)));

        spellCoreName2PreFab.Add("WallV1", (GameObject)Resources.Load("WallSpellPrefab", typeof(GameObject)));
        spellCoreName2PreFab.Add("MeteorShowerV1", (GameObject)Resources.Load("MeteorShowerPrefab", typeof(GameObject)));
        spellCoreName2PreFab.Add("MagicBallV1", (GameObject)Resources.Load("MagicBallPrefab", typeof(GameObject)));
        spellCoreName2PreFab.Add("ShockWaveV1", (GameObject)Resources.Load("ShockWavePrefab", typeof(GameObject)));
        spellCoreName2PreFab.Add("SummonGolemsV1", (GameObject)Resources.Load("SummonGolemsPrefab", typeof(GameObject)));


        spellComponentName2UnityComponent.Add("FireV1", new FireElement());
        spellComponentName2UnityComponent.Add("WaterV1", new WaterElement());
        spellComponentName2UnityComponent.Add("NatureV1", new NatureElement());

        spellComponentName2UnityComponent.Add("DamageV1", new DamageModifier());
        spellComponentName2UnityComponent.Add("SizeV1", new SizeModifier());
        spellComponentName2UnityComponent.Add("SpeedV1", new SpeedModifier());
        spellComponentName2UnityComponent.Add("GravityV1", new GravityModifier());

        spellComponentName2UnityComponent.Add("MultiplierV1", new SpellMultiplier());
        spellComponentName2UnityComponent.Add("Add1V1", new GravityModifier());
        spellComponentName2UnityComponent.Add("PoisonV1", new PoisonModifier());
        spellComponentName2UnityComponent.Add("ExplosionV1", new ExplosionModifier());
        spellComponentName2UnityComponent.Add("ParalyzeV1", new ParalizerModifier());
        spellComponentName2UnityComponent.Add("SlowV1", new GravityModifier());

        //craftedSpells = new List<GameObject>();
    }
Example #10
0
    void Start () {
        gameController = GameObject.FindWithTag("GameController").GetComponent<MasterGameManager>();
        if (gameController == null)
        {
            Debug.Log("GameController not found in PortalSize.");
        }
        if (gameController.mostUsedSpellComponent.Equals("Fire")) {
            mostFrequentlyUsedSpellType = 0;
        } else if (gameController.mostUsedSpellComponent.Equals("Nature")){
            mostFrequentlyUsedSpellType = 1;
        } else if (gameController.mostUsedSpellComponent.Equals("Water")){ 
            mostFrequentlyUsedSpellType = 2;
        } else
        {
            mostFrequentlyUsedSpellType = UnityEngine.Random.Range(0, 3); 
        }
        //This is random right now. We need to make it dynamic given the player's histogram
        pickElement();
        
        player = GameObject.FindGameObjectWithTag("Destination").transform;
        float X = GetComponentInParent<EnemySpawning>().enemy.transform.localScale.x;
        float Y = GetComponentInParent<EnemySpawning>().enemy.transform.localScale.y;
        float Z = GetComponentInParent<EnemySpawning>().enemy.transform.localScale.z;
        float X2 = X;
        // calculates the x and y scale for portal based on enemy size
        if (GetComponentInParent<EnemySpawning>().enemy == Golem)
        {
            X = X * 6;
            Y = Y * 6;
        }
        else if (GetComponentInParent<EnemySpawning>().enemy == Rhino)
        {
            X = X / 6;
            Y = Y / 5;
        }
        else if (GetComponentInParent<EnemySpawning>().enemy == Drone)
        {
            
            Y = Y * 2;
        }
        else
        {
            X = X * 2;
            Y = Y * 3;
        }
        
        //creates portal
        transform.localScale = new Vector3(X, Y, .1f);
        //adjusts portal postioning based on its personal size
        transform.localPosition = new Vector2(0, Y / 2);
        
        Vector3 targetPosition = new Vector3(player.position.x, transform.position.y, player.position.z);
        transform.LookAt(targetPosition);

        //pushes the portal X2/2 units away from portal to give appearance of moving through portal
        if (GetComponentInParent<EnemySpawning>().enemy == Golem)
        {
            transform.position = Vector3.MoveTowards(transform.position, player.position, X2 / 2 + 3f);
        }
        else if (GetComponentInParent<EnemySpawning>().enemy == Rhino)
        {
            transform.position = Vector3.MoveTowards(transform.position, player.position, X2 / 5 - 5f);
        }
        else
        {
            transform.position = Vector3.MoveTowards(transform.position, player.position, X2 / 2 + .1f);
        }

    }
Example #11
0
 // Use this for initialization
 void Awake()
 {
     spellEngine = GameObject.FindWithTag("GameController").GetComponent <SpellEngine>();
     gameManager = GameObject.FindWithTag("GameController").GetComponent <MasterGameManager>();
 }
Example #12
0
    // Update is called once per frame
    void Update()
    {
        //Level 1 WIn Con
        if (AnyDeadFishVal >= 3 && currentLevel == 1)
        {
            if (particleSpawned == false)
            {
                GameObject particleInstance1 = endParticle;
                GameObject partInst1         = Instantiate(particleInstance1, new Vector3(0, 0, -10), particleInstance1.transform.rotation) as GameObject;

                audioSource.PlayOneShot(winMusic);

                particleSpawned = true;
            }

            if (endLevelTime > 3.0)
            {
                StartCoroutine(StoryWheelSuccess());

                AnyDeadFishVal   = 0;
                TunaDeadFishVal  = 0;
                AngelDeadFishVal = 0;
                SharkDeadFishVal = 0;

                endLevelTime    = 0.0f;
                particleSpawned = false;
            }

            MasterGameManager.LevelCompleted(1);
            endLevelTime += Time.deltaTime;
        }

        //Level 2 Win Con
        if (currentLevel == 2 && AngelDeadFishVal >= 3)
        {
            if (particleSpawned == false)
            {
                GameObject particleInstance2 = endParticle;
                GameObject partInst2         = Instantiate(particleInstance2, new Vector3(0, -0, -10), particleInstance2.transform.rotation) as GameObject;

                audioSource.PlayOneShot(winMusic);

                particleSpawned = true;
            }

            if (endLevelTime > 3.0)
            {
                StartCoroutine(StoryWheelSuccess());

                AnyDeadFishVal   = 0;
                TunaDeadFishVal  = 0;
                AngelDeadFishVal = 0;
                SharkDeadFishVal = 0;

                endLevelTime    = 0.0f;
                particleSpawned = false;
            }
            MasterGameManager.LevelCompleted(2);
            endLevelTime += Time.deltaTime;
        }

        //Level 3 Win Con
        if (currentLevel == 3 && man.health <= 50.0f)
        {
            if (level3switch == false)
            {
                level3switch = true;
            }
        }

        if (level3switch == true)
        {
            if (particleSpawned == false)
            {
                GameObject particleInstance3 = endParticle;
                GameObject partInst3         = Instantiate(particleInstance3, new Vector3(0, -0, -10), particleInstance3.transform.rotation) as GameObject;

                audioSource.PlayOneShot(winMusic);

                particleSpawned = true;
            }

            if (endLevelTime > 3.0)
            {
                StartCoroutine(StoryWheelSuccess());

                AnyDeadFishVal   = 0;
                TunaDeadFishVal  = 0;
                AngelDeadFishVal = 0;
                SharkDeadFishVal = 0;

                level3switch    = false;
                endLevelTime    = 0.0f;
                particleSpawned = false;
            }
            MasterGameManager.LevelCompleted(3);
            endLevelTime += Time.deltaTime;
        }

        //Level 4 Win Con
        if (currentLevel == 4 && SharkDeadFishVal >= 1 && ring.destroyedRings >= 2)
        {
            if (particleSpawned == false)
            {
                GameObject particleInstance4 = endParticle;
                GameObject partInst4         = Instantiate(particleInstance4, new Vector3(0, -0, -10), particleInstance4.transform.rotation) as GameObject;

                audioSource.PlayOneShot(winMusic);

                particleSpawned = true;
            }

            if (endLevelTime > 3.0)
            {
                StartCoroutine(StoryWheelSuccess());

                AnyDeadFishVal   = 0;
                TunaDeadFishVal  = 0;
                AngelDeadFishVal = 0;
                SharkDeadFishVal = 0;

                endLevelTime    = 0.0f;
                particleSpawned = false;
            }
            MasterGameManager.LevelCompleted(4);
            endLevelTime += Time.deltaTime;
        }

        //Level 5 Win Con
        if (currentLevel == 5 && ring.destroyedRings >= 4)
        {
            if (particleSpawned == false)
            {
                GameObject particleInstance5 = endParticle;
                GameObject partInst5         = Instantiate(particleInstance5, new Vector3(0, -0, -10), particleInstance5.transform.rotation) as GameObject;

                audioSource.PlayOneShot(winMusic);

                particleSpawned = true;
            }

            if (endLevelTime > 3.0)
            {
                StartCoroutine(StoryWheelSuccess());

                AnyDeadFishVal   = 0;
                TunaDeadFishVal  = 0;
                AngelDeadFishVal = 0;
                SharkDeadFishVal = 0;

                endLevelTime    = 0.0f;
                particleSpawned = false;
            }
            MasterGameManager.LevelCompleted(5);
            endLevelTime += Time.deltaTime;
        }

        //Level 6 Win Con
        if (currentLevel == 6 && SharkDeadFishVal >= 3)
        {
            if (particleSpawned == false)
            {
                GameObject particleInstance6 = endParticle;
                GameObject partInst6         = Instantiate(particleInstance6, new Vector3(0, -0, -10), particleInstance6.transform.rotation) as GameObject;

                audioSource.PlayOneShot(winMusic);

                particleSpawned = true;
            }

            if (endLevelTime > 3.0)
            {
                StartCoroutine(StoryWheelSuccess());

                AnyDeadFishVal   = 0;
                TunaDeadFishVal  = 0;
                AngelDeadFishVal = 0;
                SharkDeadFishVal = 0;

                endLevelTime    = 0.0f;
                particleSpawned = false;
            }
            MasterGameManager.LevelCompleted(6);
            endLevelTime += Time.deltaTime;
        }

        //Level 7 Win Con
        if (currentLevel == 7 && TunaDeadFishVal >= 3)
        {
            if (particleSpawned == false)
            {
                GameObject particleInstance7 = endParticle;
                GameObject partInst7         = Instantiate(particleInstance7, new Vector3(0, -0, -10), particleInstance7.transform.rotation) as GameObject;

                audioSource.PlayOneShot(winMusic);

                particleSpawned = true;
            }

            if (endLevelTime > 3.0)
            {
                StartCoroutine(StoryWheelSuccess());

                AnyDeadFishVal   = 0;
                TunaDeadFishVal  = 0;
                AngelDeadFishVal = 0;
                SharkDeadFishVal = 0;

                endLevelTime    = 0.0f;
                particleSpawned = false;
            }
            MasterGameManager.LevelCompleted(7);
            endLevelTime += Time.deltaTime;
        }

        //Level 8 Win Con
        if (currentLevel == 8 && TunaDeadFishVal >= 5)
        {
            if (particleSpawned == false)
            {
                GameObject particleInstance8 = endParticle;
                GameObject partInst8         = Instantiate(particleInstance8, new Vector3(0, -0, -10), particleInstance8.transform.rotation) as GameObject;

                audioSource.PlayOneShot(winMusic);

                particleSpawned = true;
            }

            if (endLevelTime > 3.0)
            {
                StartCoroutine(StoryWheelSuccess());

                AnyDeadFishVal   = 0;
                TunaDeadFishVal  = 0;
                AngelDeadFishVal = 0;
                SharkDeadFishVal = 0;

                endLevelTime    = 0.0f;
                particleSpawned = false;
            }
            MasterGameManager.LevelCompleted(8);
            endLevelTime += Time.deltaTime;
        }

        //Level 9 Win Con
        if (currentLevel == 9 && ring.destroyedRings >= 4)
        {
            if (particleSpawned == false)
            {
                GameObject particleInstance9 = endParticle;
                GameObject partInst9         = Instantiate(particleInstance9, new Vector3(0, -0, -10), particleInstance9.transform.rotation) as GameObject;

                audioSource.PlayOneShot(winMusic);

                particleSpawned = true;
            }

            if (endLevelTime > 3.0)
            {
                StartCoroutine(StoryWheelSuccess());

                AnyDeadFishVal   = 0;
                TunaDeadFishVal  = 0;
                AngelDeadFishVal = 0;
                SharkDeadFishVal = 0;

                endLevelTime    = 0.0f;
                particleSpawned = false;
            }
            MasterGameManager.LevelCompleted(9);
            endLevelTime += Time.deltaTime;
        }

        //Level 10 Win Con
        if (currentLevel == 10 && ring.destroyedRings >= 8)
        {
            if (particleSpawned == false)
            {
                GameObject particleInstance10 = endParticle;
                GameObject partInst10         = Instantiate(particleInstance10, new Vector3(0, 0, -10), particleInstance10.transform.rotation) as GameObject;

                audioSource.PlayOneShot(winMusic);

                particleSpawned = true;
            }

            if (endLevelTime > 3.0)
            {
                StartCoroutine(StoryWheelSuccess());

                AnyDeadFishVal   = 0;
                TunaDeadFishVal  = 0;
                AngelDeadFishVal = 0;
                SharkDeadFishVal = 0;

                endLevelTime    = 0.0f;
                particleSpawned = false;
            }
            MasterGameManager.LevelCompleted(10);
            endLevelTime += Time.deltaTime;
        }
        //Cheat function to end level successfully.
        if (Input.GetKey(KeyCode.C))
        {
            MasterGameManager.LevelCompleted(currentLevel);
            StartCoroutine(StoryWheelSuccess());
        }
    }
Example #13
0
 public void Button_RestePlayerStats()
 {
     MasterGameManager.ResetPlayerStats();
 }
Example #14
0
 // Use this for initialization
 void Start()
 {
     gameManager = GameObject.FindWithTag("GameController").GetComponent <MasterGameManager>();
 }