Exemplo n.º 1
0
 void Start()
 {
     currentHealth = maxHealth;
     healthBar.SetMaxHealth(maxHealth);
     audioOuch         = GetComponent <AudioSource>();
     globalScoreKeeper = GameObject.Find("globalScoreObj").GetComponent <globalScore>();
 }
Exemplo n.º 2
0
 public void Start()
 {
     scorekeeper    = globalScore.Instance;
     dialogueSystem = MainInstances.Get <DialogueSystem>();
     stringRegistry = MainInstances.Get <StringRegistry>();
     beginTutorial();
 }
Exemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     passes              = 2; //1 for odd # of passes, 2 for 0 or even # of passes
     despawnTime         = 5.0f;
     despawnTimer        = Time.time + despawnTime;
     scorekeeper         = GameObject.Find("globalScoreObj").GetComponent <globalScore>();
     rigidEnemy.velocity = transform.right * enemySpeed;
     whalePosition       = transform.position;
     whaleSprite         = gameObject.GetComponent <SpriteRenderer>();
 }
Exemplo n.º 4
0
 void Start()
 {
     passes              = 2;    // 2 if 0 or even # of passes, 1 if odd # of passes
     despawnTime         = 5.0f; //For single pass, despawns at this val; for double, check conditions after
     scorekeeper         = GameObject.Find("globalScoreObj").GetComponent <globalScore>();
     rigidEnemy.velocity = -transform.right * enemySpeed;
     shipPosition        = transform.position;
     despawnTimer        = Time.time + despawnTime;
     shipSprite          = gameObject.GetComponent <SpriteRenderer>();
 }
Exemplo n.º 5
0
 public void PlayGame()
 {
     scorekeeper = globalScore.Instance;
     if (scorekeeper.returnBlasterTutorial() == 0)
     {
         SceneManager.LoadScene("Scene_Tutorial", LoadSceneMode.Additive);
     }
     else
     {
         SceneManager.LoadScene("Scene_Game", LoadSceneMode.Additive);
     }
 }
Exemplo n.º 6
0
 void Awake()
 {
     if (Instance == null)
     {
         DontDestroyOnLoad(gameObject);
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
     blasterLevel = 1;
 }
Exemplo n.º 7
0
 void Start()
 {
     globalScoreKeeper = GameObject.Find("globalScoreObj").GetComponent <globalScore>();
     activityNum       = globalScoreKeeper.returnActivityNum();
     if (activityNum == 1)
     {
         recent = globalScoreKeeper.returnBalanceRecent();
         high   = globalScoreKeeper.returnBalanceHigh();
     }
     if (activityNum == 2)
     {
         recent = globalScoreKeeper.returnWeightRecent();
         high   = globalScoreKeeper.returnWeightHigh();
     }
     highScoreText.text   = "High Score: " + high;
     recentScoreText.text = "Recent Score: " + recent;
 }
Exemplo n.º 8
0
 void Start()
 {
     moveIncr       = 1.5f;
     speed          = 0;
     inBounds       = true;
     playerSprite   = player.GetComponent <SpriteRenderer>();
     halfRange      = 1.0f;
     outTime        = 10;
     inOutText.text = " ";
     scoreTime      = 0;
     scoreTimeInt   = 0;
     timeAtStart    = Time.time;
     gameTime       = Time.time - timeAtStart;
     Debug.Log("timeAtStart " + timeAtStart + " Time.time " + Time.time);
     startWait         = gameTime + 3.0f;
     lastIntTime       = 0;
     globalScoreKeeper = GameObject.Find("globalScoreObj").GetComponent <globalScore>();
 }
Exemplo n.º 9
0
    void Start()
    {
        scorekeeper = globalScore.Instance;
        gameLevel   = scorekeeper.returnBlasterLevel();

        /**
         * switch(gameLevel) {
         *  case 1:
         *      healIncr = UnityEngine.Random.Range(20, 30);
         *      bulwarkIncr = UnityEngine.Random.Range(60, 90);
         *      swiftIncr = UnityEngine.Random.Range(40, 60);
         *      rapidIncr = UnityEngine.Random.Range(40, 60);
         *      spreadIncr = UnityEngine.Random.Range(40, 60);
         *      break;
         *  case 2:
         *      healIncr = UnityEngine.Random.Range(40, 60);
         *      bulwarkIncr = UnityEngine.Random.Range(90, 240);
         *      swiftIncr = UnityEngine.Random.Range(60, 120);
         *      rapidIncr = UnityEngine.Random.Range(60, 120);
         *      spreadIncr = UnityEngine.Random.Range(60, 120);
         *      break;
         *  case 3:
         *      healIncr = UnityEngine.Random.Range(60, 120);
         *      bulwarkIncr = UnityEngine.Random.Range(120, 300);
         *      swiftIncr = UnityEngine.Random.Range(120, 240);
         *      rapidIncr = UnityEngine.Random.Range(120, 240);
         *      spreadIncr = UnityEngine.Random.Range(120, 240);
         *      break;
         * }**/

        var spawnFreq = SpawnFrequencyPerLevel[gameLevel - 1];

        healIncr    = GetRandomFromVector2Int(spawnFreq.HealIncreaseFreq);
        bulwarkIncr = GetRandomFromVector2Int(spawnFreq.BulwarkIncreaseFreq);
        swiftIncr   = GetRandomFromVector2Int(spawnFreq.SwiftIncreaseFreq);
        rapidIncr   = GetRandomFromVector2Int(spawnFreq.RapidFireIncreaseFreq);
        spreadIncr  = GetRandomFromVector2Int(spawnFreq.SpreadIncreaseFreq);

        healTimer    = Time.time + healIncr;
        bulwarkTimer = Time.time + bulwarkIncr;
        swiftTimer   = Time.time + swiftIncr;
        rapidTimer   = Time.time + rapidIncr;
        spreadTimer  = Time.time + spreadIncr;
    }
Exemplo n.º 10
0
 void Start()
 {
     scorekeeper = globalScore.Instance;
     if (scorekeeper.returnBlasterLevel() == 1 || scorekeeper.returnBlasterLevel() == 2)
     {
         enemyDamage       = 20;
         enemyBulletDamage = 10;
     }
     else if (scorekeeper.returnBlasterLevel() == 3)
     {
         enemyDamage       = 40;
         enemyBulletDamage = 20;
     }
     speed         = 50.0f;
     maxHealth     = rocketHealth;
     blackHoleDrag = 0.0f;
     rb2d          = GetComponent <Rigidbody2D> ();
     isSwift       = false;
 }
Exemplo n.º 11
0
    void Awake()
    {
        scorekeeper = GameObject.Find("globalScoreObj").GetComponent <globalScore>();
        if (scorekeeper.returnBlasterLevel() == 1)
        {
            spawnIncr       = UnityEngine.Random.Range(0.5f, 5.0f);
            spawnIncr_Whale = UnityEngine.Random.Range(30.0f, 60.0f);
            spawnIncr_Ship  = UnityEngine.Random.Range(55.0f, 120.0f);
            spawnIncr_Hole  = UnityEngine.Random.Range(45.0f, 240.0f);
        }
        else
        {
            spawnIncr       = UnityEngine.Random.Range(0.5f, 3.0f);
            spawnIncr_Whale = UnityEngine.Random.Range(20.0f, 45.0f);
            spawnIncr_Ship  = UnityEngine.Random.Range(30.0f, 90.0f);
            spawnIncr_Hole  = UnityEngine.Random.Range(30.0f, 180.0f);
        }

        //Debug.Log("Start time " + Time.time);

        spawnTimer       = Time.time + spawnIncr;
        spawnTimer_Whale = Time.time + spawnIncr_Whale;
        spawnTimer_Ship  = Time.time + spawnIncr_Ship;

        /** Rather than spawning a new black hole every time, Spawnscript refers
         * to a single hole that already exists in the scene— turns on/off and alters X coordinate.
         * The main reason for this is that the enemy hole behaviour influences player movement,
         * so it needs to reference the playerMovement script on the rocket.
         *
         * If spawnScript references the prefab, can't drag the rocket object into the black hole's
         * inspector (scriptableObject independent of scene, reference to rocket doesn't exist
         * outside of this scene).
         * Short of using GameObject.Find or GameObject.FindWithTag, not sure how else to work around
         * So instead of referencing black hole prefab, will just modify an object in scene
         * "Spawn" AND "despawn" will both be controlled here rather than in obj. script
         */
        holeDespawnLength = 5.0f;
        spawnTimer_Hole   = Time.time + spawnIncr_Hole;
        randomizerX       = UnityEngine.Random.Range(0.0f, 1.0f);
        Debug.Log("Initial hole spawn time " + spawnTimer_Hole);
        holeScript = enem_Hole.GetComponent <enemyScriptHole>();
    }
Exemplo n.º 12
0
 void Start()
 {
     timeAtStart       = Time.time;
     lastIntTime       = 0;
     globalScoreKeeper = GameObject.Find("globalScoreObj").GetComponent <globalScore>();
     bounceIncr        = 1.5f;
     playerInBounds    = true;
     rb = GetComponent <Rigidbody2D> ();
     rb.transform.position = new Vector3(-2.4f, 0.08f, 0.0f);
     transX = UnityEngine.Random.Range(0, 10);
     transY = UnityEngine.Random.Range(0, 10);
     if (transX < 5)
     {
         if (transY < 5)
         {
             rb.velocity = -transform.up * speed - transform.right * speed;
         }
         else
         {
             rb.velocity = transform.up * speed - transform.right * speed;
         }
     }
     else
     {
         if (transY < 5)
         {
             rb.velocity = -transform.up * speed + transform.right * speed;
         }
         else
         {
             rb.velocity = transform.up * speed + transform.right * speed;
         }
     }
     bounceTimer  = timeAtStart + bounceIncr;
     scoreTime    = timeAtStart;
     outTime      = 10;
     scoreTime    = 0;
     scoreTimeInt = 0;
 }