public SpawnPowerUpInTheHalfGame(Configuration configuration, PlayerRepository playerRepository,
                                  SpawnPowerUp spawnPowerUp)
 {
     this.configuration    = configuration;
     this.playerRepository = playerRepository;
     this.spawnPowerUp     = spawnPowerUp;
 }
Пример #2
0
    public override void Awake()
    {
        base.Awake();

        powerUp   = GameObject.Find("Planet").GetComponent <SpawnPowerUp>();
        uiManager = GameObject.Find("LevelManager").GetComponent <UIManager>();
    }
Пример #3
0
    //used to spawnPower up in a random position
    void Update()
    {
        //if the level is complete and the power up has not been created
        if (gs.full && !powerUpCreated)
        {
            //get the SpawnPowerUp instance, sets the powerups parent to be the center of the room
            //this is done so the bfs can go off of the center and not a random point
            GameObject   spawnPowerUpInstance = GameObject.Find("SpawnPowerUp");
            SpawnPowerUp spu = spawnPowerUpInstance.GetComponent <SpawnPowerUp>();

            //get a random location for the powerup
            int     randomPosition = Random.Range(0, positions.Length);
            Vector2 spawnPos       = new Vector2(positions[randomPosition].transform.position.x, positions[randomPosition].transform.position.y);

            //create the powerUp collider to get rid of any tiles in the way
            //this is destroyed after a collistion
            GameObject puCol = Instantiate(positionCollider,
                                           positions[randomPosition].transform.position,
                                           Quaternion.identity);
            //create the power up
            pu = Instantiate(go,
                             positions[randomPosition].transform.position,
                             Quaternion.identity);
            //set its parent to the center
            pu.transform.parent = spu.spawnParentTransform;

            powerUpCreated = true;
        }
    }
Пример #4
0
    public override void Start()
    {
        base.Start();
        powerUp     = GameObject.Find("Planet").GetComponent <SpawnPowerUp>();
        audioSource = GetComponent <AudioSource>();
        uiManager   = GameObject.Find("LevelManager").GetComponent <UIManager>();

        currentMovementSpeed = movementSpeed;
    }
Пример #5
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        // set ref for pause_ui, score_ui, game_over_ui
        pause_ui     = GameObject.FindWithTag("pause_ui");
        score_ui     = GameObject.FindWithTag("score_ui");
        game_over_ui = GameObject.FindWithTag("game_over_ui");

        enemyCollision = GameObject.FindObjectOfType <EnemyCollision>();
        audioManager   = (AudioManager)FindObjectOfType(typeof(AudioManager));
        audioManager.StopPlaying("ui");
        audioManager.Play("game");

        spawnPowerUp = GameObject.FindObjectOfType <SpawnPowerUp>();
    }
Пример #6
0
 private void Awake()
 {
     rb           = GetComponent <Rigidbody2D>();
     spawnPowerUp = GameObject.FindObjectOfType <SpawnPowerUp>();
 }