Example #1
0
    private void Start()
    {
        timer = 0;

        scoreIncreaser = targetScoreToDisable;
        powerUpSpawner = GetComponent <PowerUpSpawner>();
    }
Example #2
0
 void Start()
 {
     pointP1 = new int[3];
     pointP2 = new int[3];
     Invoke("SpawnPlayers", 0.01f);
     pUPScript = GameObject.Find("Spawner").GetComponent <PowerUpSpawner>();
 }
Example #3
0
    // Use this for initialization
    void Start()
    {
        //Start spawner
        spawnPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z) + new Vector3(0, 18, 0);
        bounds [1]    = spawnPosition.x + 3.5;
        bounds [0]    = spawnPosition.x - 3.5;

        blockSpawner   = FindObjectOfType <BlockSpawner> ();
        powerUpSpawner = FindObjectOfType <PowerUpSpawner> ();

        //Instantiate all variables to false.
        moveLeft  = false;
        moveRight = false;
        rotate    = false;

        //If the script runs on a client, spawn for that client
        if (isLocalPlayer)
        {
            FortuneWheel = Instantiate(FortuneWheel);
            FortuneWheel.transform.position = new Vector3(spawnPosition.x + 3, spawnPosition.y - 2, 0);
            fortuneWheelController          = FortuneWheel.GetComponentInChildren <FortuneWheelController> ();
            SpawnBlock();
            InvokeRepeating("SpawnPowerUp", 10f, 20f);
        }
    }
	private BombsUI m_Bomb; //Bombs

	void Start()
	{
		m_Spawner = GameObject.FindGameObjectWithTag("PowerUp").GetComponent<PowerUpSpawner> ();
		m_BulletSpawn = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerBulletSpawn> (); 
		m_lives = GameObject.FindGameObjectWithTag ("UI").GetComponentInChildren<PlayerLives> ();
		m_Bomb = GameObject.FindGameObjectWithTag ("UI").GetComponentInChildren<BombsUI> ();
	}
Example #5
0
    private BombsUI m_Bomb;                  //Bombs

    void Start()
    {
        m_Spawner     = GameObject.FindGameObjectWithTag("PowerUp").GetComponent <PowerUpSpawner> ();
        m_BulletSpawn = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerBulletSpawn> ();
        m_lives       = GameObject.FindGameObjectWithTag("UI").GetComponentInChildren <PlayerLives> ();
        m_Bomb        = GameObject.FindGameObjectWithTag("UI").GetComponentInChildren <BombsUI> ();
    }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #7
0
 // Start is called before the first frame update
 void Start()
 {
     uiManager       = GameObject.Find("UIManager").GetComponent <UIManager>();
     enemySpawner    = GameObject.Find("EnemySpawner").GetComponent <EnemySpawner>();
     powerUpSpawner  = GameObject.Find("PowerUpSpawner").GetComponent <PowerUpSpawner>();
     numberOfPlayers = numberOfPlayersAlive;
 }
Example #8
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "PowerUpSpawner")
        {
            parentSpawner = other.GetComponentInParent <PowerUpSpawner>();
        }

        if (other.tag == "Player")
        {
            if (powerUpType == Player.PowerUp.Pistol)
            {
                other.GetComponentInParent <Player>().currentPowerUp  = Player.PowerUp.Pistol;
                other.GetComponentInParent <Player>().powerUpUsesLeft = 1;
            }
            else if (powerUpType == Player.PowerUp.Crossbow)
            {
                other.GetComponentInParent <Player>().currentPowerUp  = Player.PowerUp.Crossbow;
                other.GetComponentInParent <Player>().powerUpUsesLeft = 3;
            }
            else if (powerUpType == Player.PowerUp.Shield)
            {
                other.GetComponentInParent <Player>().currentPowerUp  = Player.PowerUp.Shield;
                other.GetComponentInParent <Player>().powerUpUsesLeft = 3;
            }
            else if (powerUpType == Player.PowerUp.Blink)
            {
                other.GetComponentInParent <Player>().currentPowerUp  = Player.PowerUp.Blink;
                other.GetComponentInParent <Player>().powerUpUsesLeft = 3;
            }

            pickUp = true;
        }
    }
Example #9
0
 private void MyCached()
 {
     gameSession    = FindObjectOfType <GameSession>();
     powerUpSpawner = FindObjectOfType <PowerUpSpawner>();
     level          = FindObjectOfType <Level>();
     mySprite       = GetComponent <SpriteRenderer>();
     myCollider     = GetComponent <PolygonCollider2D>();
 }
Example #10
0
    void Start()
    {
        _spriteRenderer        = GetComponent <SpriteRenderer>();
        _spriteRenderer.sprite = PowerUp.Image;

        _powerUpUi = FindObjectOfType <PowerUpUI>();

        _spawner = FindObjectOfType <PowerUpSpawner>();
    }
Example #11
0
 void Start()
 {
     roundManager   = GameObject.Find("GameManager").GetComponent <RoundManager>();
     player         = GameObject.Find("FingerTarget");
     powerUpSpawner = GameObject.Find("PowerUpSpawner").GetComponent <PowerUpSpawner>();
     //star = GameObject.Find("Shuriken");
     starsInGame = 1;
     stars       = new List <Shuriken>();
     CreateStars();
 }
    private void Awake()
    {
        m_Instance             = this;
        m_NextSpawnMarkerIndex = -1;
        GameObject markerParentObj = GameObject.Find("SpawnMarkers");

        if (markerParentObj != null)
        {
            m_SpawnMarkersParent = markerParentObj.transform;
        }
    }
Example #13
0
 void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
Example #14
0
    void SelectPowerUpSpawner(string arenaname)
    {
        ArenaData ad = ArenaDataLoader.arenas [arenaname];

        if (ad.powerupSpawner == null)
        {
            PUS = new PowerUpSpawner();
        }
        else
        {
            PUS = new PowerUpSpawner(this, ad.powerupSpawner.powerUps, ad.powerupSpawner.spawnDistances, ad.powerupSpawner.minSpawnDuration, ad.powerupSpawner.maxSpawnDuration, ad.powerupSpawner.maxNumberOfPowerups);
        }
        //PUS = new PowerUpSpawner(ad.
    }
Example #15
0
    void Start()
    {
        Time.timeScale = 1;
        SpaceShip      = GameObject.Find("SpaceShip").GetComponent <Animator>();
        Player         = GameObject.FindGameObjectWithTag("Player").GetComponent <Animator>();
        playerJetPack  = GameObject.Find("JetPack").GetComponent <ParticleSystem>();
        ObstacleSpawn1 asteroidSpawner = GameObject.Find("Spawner").GetComponent <ObstacleSpawn1>();
        PowerUpSpawner powerUpSpawner  = GameObject.Find("Spawner").GetComponent <PowerUpSpawner>();

        asteroidSpawner.dontSpawn = true;
        powerUpSpawner.dontSpawn  = true;

        StartCoroutine(StartIntro());
        asteroidSpawner.dontSpawn = false;
        powerUpSpawner.dontSpawn  = false;
    }
    private IEnumerator Start()
    {
        tutorialID         = PlayerPrefs.GetInt("TutorialID", 0);
        tutorialBackground = GameObject.Find("TutorialTextBackground");
        tutorialBackground.SetActive(false);

        if (tutorialID >= 99)
        {
            //Debug.Log("The tutorial id is more than 99, exiting tutorial");
            yield break;
        }

        enemySpawner = GameObject.Find("EnemySpawner").GetComponent <EnemySpawner>();
        //enemySpawner.spawnRate = float.MaxValue;
        enemySpawner.maxEnemiesPerWave = int.MaxValue;

        powerUpSpawner       = GameObject.Find("PowerUpSpawner").GetComponent <PowerUpSpawner>();
        powerUpSpawner.start = false;

        tutorialBackground.SetActive(true);

        yield return(shortWait); // This is important these codes must only run after their start() is called

        canvas           = GameObject.Find("Canvas").GetComponent <Canvas>();
        playerController = GameObject.Find("Player").GetComponent <PlayerController>();
        pool             = GameObject.Find("ObjectPool").GetComponent <ObjectPool>();
        player           = playerController.GetComponentInChildren <PlayerType>();
        tutorialText     = GameObject.Find("Tutorial").GetComponent <Text>();

        tutorialText.enabled = true;
        canvas.GetComponent <BaseWorldCanvas>().IsTutorialRunning(false);


        if (tutorialID > 0)
        {
            tutorialText.text = "Continuing from the last tutorial";
            yield return(longWait);
        }

        NextTutorial(tutorialID);

        coroutine = StartCoroutine(CheckHealthRoutine());
    }
Example #17
0
    // Start is called before the first frame update
    void Start()
    {
        if (PlayerPrefs.GetInt("Tutorial") == 0)
        {
            anim = tutorial.GetComponent <Animator>();

            s   = spawner.GetComponent <Spawner>();
            bs  = spawner.GetComponent <BubbleSpawner>();
            pus = spawner.GetComponent <PowerUpSpawner>();
            es  = spawner.GetComponent <EnemySpawner>();

            s.enabled   = false;
            bs.enabled  = false;
            pus.enabled = false;
            es.enabled  = false;

            pause.interactable = false;

            StartCoroutine(Guide());
        }
    }
Example #18
0
    IEnumerator CoSpawnPowerUps()
    {
        yield return(new WaitForSeconds(4));

        while (true)
        {
            for (int j = 0; j < powerupSpawnPoints.Length; j++)
            {
                if (powerupsSpawned >= maxpowerups)
                {
                    continue;
                }
                GameObject     powerup = powerupSpawner.SpawnAt(powerupSpawnPoints[j].position, powerupSpawnPoints[j].rotation);
                PowerUpSpawner power   = powerup.GetComponent <PowerUpSpawner>();
                power.onDead.AddListener(() =>
                {
                    powerupsSpawned--;
                });
                powerupsSpawned++;
            }
            yield return(new WaitForSeconds(spawnDuration));
        }
    }
Example #19
0
 void CacheExternalReferences()
 {
     players = Game.players;
     for(int i=0; i<players.Length;++i){
         if(players[i].celestialAlignment == this.celestialAlignment)
             playerIndex = i;
         else
             enemyIndex = i;
     }
     spawner = Game.spawner;
 }
	// Use this for initialization
	void Start () {
		playerSpawnPoints = gameObject.GetComponentsInChildren<PlayerSpawnPoint>();
		powerUpSpawner = gameObject.GetComponentInChildren<PowerUpSpawner>();
	}
Example #21
0
    void Start()
    {
        Screen.showCursor = false;
        timeElapsed = 0;

        coins = PlayerPrefsManager.GetCoins();
        blockWhenNoGazeData = PlayerPrefsManager.GetControl();
        GameObject.Find("Highscore").GetComponent<HighscoreScript>().UpdateCoins(coins);
        GameObject.Find("Highscore").GetComponent<HighscoreScript>().AddScoreValue(PlayerPrefsManager.GetScore());

        lifeControl = GameObject.FindGameObjectWithTag("MainGUI").GetComponent<SubmarineLifeControl>();
        movePlayer = GameObject.FindGameObjectWithTag("Player").GetComponent<MovePlayer>();
        shooting = GameObject.Find("gun").GetComponent<PlayerShooting>();
        powerUpSpawner = GameObject.Find("GameController").GetComponent<PowerUpSpawner>();
    }
 // Start is called before the first frame update
 void Start()
 {
     enemySpawner   = GameObject.Find("EnemySpawner").GetComponent <EnemySpawner>();
     powerUpSpawner = GameObject.Find("PowerUpSpawner").GetComponent <PowerUpSpawner>();
     deathAudio     = GetComponent <AudioSource>();
 }
 private void OnDestroy()
 {
     m_Instance = null;
 }
Example #24
0
 void OnDisable()
 {
     PowerUpSpawner.powerUpDespawned();
     Debug.Log("PowerUp gone");
 }
Example #25
0
    private void Start()
    {
        spawner = GameObject.FindGameObjectWithTag("PowerUpSpawner").GetComponent <PowerUpSpawner>();

        assistantNum = 0;
    }
 //Restarts our game if player cannot continue
 public void RestartGame()
 {
     PowerUpSpawner.Reset();
     SceneManager.LoadScene(SceneManager.GetActiveScene().name);
 }
Example #27
0
 void Awake()
 {
     // Initialise variables.
     Instance = this;
 }
 // Use this for initialization
 void Start()
 {
     Instance  = this;
     spawnRate = 15f;
 }
Example #29
0
 void Start()
 {
     spawner = GameObject.FindObjectOfType<PowerUpSpawner>();
 }
Example #30
0
 public void SetSpawner(PowerUpSpawner spawner)
 {
     Debug.Log("moi");
     _spawner = spawner;
 }
 // Use this for initialization
 void Start()
 {
     playerSpawnPoints = gameObject.GetComponentsInChildren <PlayerSpawnPoint>();
     powerUpSpawner    = gameObject.GetComponentInChildren <PowerUpSpawner>();
 }
Example #32
0
    //================================================================================
    // Unity
    //================================================================================

    // Let subclasses override/extend method
    public virtual void Start()
    {
        spawner = GetComponentInParent <PowerUpSpawner>();
    }
Example #33
0
 private void Awake()
 {
     _player  = FindObjectOfType <PlayerMov>();
     _spawner = FindObjectOfType <PowerUpSpawner>();
     _sfx     = FindObjectOfType <SFXManager>();
 }
Example #34
0
	void Start() {
		scoreKeeper = GameObject.Find("Score").GetComponent<ScoreKeeper>();
		powerSpawner = GameObject.FindObjectOfType<PowerUpSpawner>();
	}
Example #35
0
    void Start()
    {
        camera2d = GameObject.Find("2D Camera");
        spawner = GameObject.Find("GameController").GetComponent<PowerUpSpawner>();

        GetNewTargetLocation();
        FindOtherObjects();
    }