Exemplo n.º 1
0
    void Start()
    {
        transform.position = new Vector3(0, 0, 0);
        _powerup           = GameObject.FindGameObjectWithTag("Powerup").GetComponent <Powerup>();
        _spawnManager      = GameObject.Find("Spawn_Manager").GetComponent <SpawnManager>();
        _uiManager         = GameObject.Find("Canvas").GetComponent <UIManager>();
        _audioSource       = GetComponent <AudioSource>();
        _shakeBehavior     = GameObject.Find("Main Camera").GetComponent <ShakeBehavior>();

        if (_spawnManager == null)
        {
            Debug.LogError("Spawn_Manager is Null");
        }
        if (_uiManager == null)
        {
            Debug.LogError("UI Manager is Null");
        }
        if (_audioSource == null)
        {
            Debug.LogError("Audio source on player is Null");
        }
        else
        {
            _audioSource.clip = _laserSound;
        }
        if (_shakeBehavior == null)
        {
            Debug.LogError("Shake on Main Camera is Null");
        }
        if (_powerup == null)
        {
            Debug.LogError("Powerup null on Player");
        }
    }
Exemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        Instance            = this;
        tint                = GameObject.Find("GreenTint").GetComponent <Image>();
        tint.enabled        = false;
        roundsSurvived      = GameObject.Find("roundsSurvived").GetComponent <Text>();
        timePlayed          = GameObject.Find("timePlayed").GetComponent <Text>();
        playerLvl           = GameObject.Find("playerLevel").GetComponent <Text>();
        goldText            = GameObject.Find("goldAmount").GetComponent <Text>();
        roundsSurvived.text = "Keys Collected: " + rounds;
        timePlayed.text     = "Time Played: 00:00";
        playerLvl.text      = "Lv. " + playerLevel;
        goldText.text       = goldAmount.ToString();

        weaponSelect        = GameObject.Find("weaponSelect").GetComponent <Image>();
        weaponSelect.sprite = swordSelected;

        cameraShake = GameObject.Find("Main Camera").GetComponent <ShakeBehavior>();
        hpRegained  = GameObject.Find("HPRecoveryParticles").GetComponent <ParticleSystem>();

        expBar.fillAmount = experience;

        //UITurretPrompt = GameObject.Find("TurretPrompt").GetComponent<Image>();


        pauseMenuUI.SetActive(false);

        GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");
        foreach (GameObject enemy in enemies)
        {
            enemiesActive++;
        }
    }
Exemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        transform.position = new Vector3(0, 0, 0);
        _spawnManager      = GameObject.Find("Spawn_Manager").GetComponent <SpawnManager>();
        _uiManager         = GameObject.Find("Canvas").GetComponent <UIManager>();
        _shakeBehavior     = GameObject.Find("Main Camera").GetComponent <ShakeBehavior>();
        _audioSource       = GetComponent <AudioSource>();

        if (_spawnManager == null)
        {
            Debug.LogError("Spawn Manager is NULL");
        }
        if (_uiManager == null)
        {
            Debug.LogError("The UI Manager is NULL");
        }
        if (_shakeBehavior == null)
        {
            Debug.LogError("Main Camera Shake behavior is NULL");
        }
        if (_audioSource == null)
        {
            Debug.LogError("The Audio Source Manager is Null");
        }
        else
        {
            _audioSource.clip = _laserClip;
        }
    }
Exemplo n.º 4
0
 // Start is called before the first frame update
 void Start()
 {
     GameObject[] targets1 = GameObject.FindGameObjectsWithTag("Target1");
     GameObject[] targets2 = GameObject.FindGameObjectsWithTag("Target2");
     numberOfTarget1 = targets1.Length;
     numberOfTarget2 = targets2.Length;
     shake           = GameObject.Find("Main Camera").GetComponent <ShakeBehavior>() as ShakeBehavior;
 }
Exemplo n.º 5
0
 void Awake()
 {
     obj = this;
     if (transform == null)
     {
         transform = GetComponent(typeof(Transform)) as Transform;
     }
 }
Exemplo n.º 6
0
    public void Shake(float time = 0.1f)
    {
        if (!shake)
        {
            shake = GetComponent <ShakeBehavior>();
        }

        shake.TriggerShake(time);
    }
Exemplo n.º 7
0
    public void Start()
    {
        gb    = GetComponent <GradientBackground>();
        shake = GetComponent <ShakeBehavior>();

        //Random gradient pr level
        gb.Gradient = gradient[Random.Range(0, gradient.Length - 1)];
        gb.UpdateTheGradient();
    }
Exemplo n.º 8
0
    void Start()
    {
        this.EGLogic        = FindObjectOfType <ElevatorGameLogic>();
        this.shake          = FindObjectOfType <ShakeBehavior>();
        this.effects        = FindObjectOfType <EffectsController>();
        this.collisionCount = 0;

        elevatorDoors = GameObject.Find("ElevatorDoors");
        borders       = GameObject.FindGameObjectsWithTag("Border");
    }
Exemplo n.º 9
0
    private void Start()
    {
        poolManager  = FindObjectOfType <PoolManager>();
        uiManager    = FindObjectOfType <UIManager>();
        shake        = FindObjectOfType <ShakeBehavior>();
        keyTimeEvent = FindObjectOfType <KeyTimeEvent>();
        keyManager   = new KeyManager();
        inventory    = FindObjectOfType <Inventory>();

        Load();
    }
Exemplo n.º 10
0
    void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        //Debug.Log("Loaded scene: " + scene.name);
        if (!doneDontDestroy)
        {
            //DontDestroyOnLoad(gameObject);
            doneDontDestroy = true;
        }

        if (Shake == null)
        {
            Shake = FindObjectOfType <ShakeBehavior>();
        }

        level = FindObjectOfType <LevelManager>();

        if (level)
        {
            if (scene.buildIndex > 2)
            {
                level.SpawnPlayers();
            }
        }

        gameUI = FindObjectOfType <GameUI>();


        gameUI.HideStats();
        if (scene.buildIndex > 3 && scene.name != "leaderboard")
        {
            gameUI.UpdateScore();
            string[] sceneNameString = scene.name.Split('_');

            string name  = "";
            int    index = int.Parse(sceneNameString[sceneNameString.Length - 1]) + 1;

            for (int i = 0; i < sceneNameString.Length; i++)
            {
                if (i < sceneNameString.Length - 1)
                {
                    name += sceneNameString[i];
                }
            }


            mapShower.ShowName(name, index);
        }

        if (scene.name == "leaderboard")
        {
            gameUI.HideStats();
        }
    }
Exemplo n.º 11
0
    void Start()
    {
        poog = TheBird.GetComponent <PoopGenerator>();

        heartBar   = GameObject.Find("HeartBar").GetComponent <BarController>();
        tummyBar   = GameObject.Find("TummyBar").GetComponent <BarController>();
        tummyShake = GameObject.Find("TummyBar").GetComponent <ShakeBehavior>();
        colonBar   = GameObject.Find("ColonBar").GetComponent <BarController>();
        pooShake   = GameObject.Find("ColonBar").GetComponent <ShakeBehavior>();

        Reset();

        //eatButton.onClick.AddListener(Eat);
        //pooButton.onClick.AddListener(Poo);
        //resetButton.onClick.AddListener(Reset);
    }
Exemplo n.º 12
0
    void OnEnable()
    {
        if (transform == null)
        {
            transform = GetComponent(typeof(Transform)) as Transform;
        }
        if (instance == null)
        {
            instance = this;
        }

        else if (instance != this)
        {
            Destroy(gameObject);
        }
        initialPosition = transform.localPosition;
    }
Exemplo n.º 13
0
    private void Start()
    {
        Load();

        //Find references
        uiManager       = FindObjectOfType <UIManager>();
        spawner         = FindObjectOfType <Spawner>();
        player          = FindObjectOfType <PlayerController>();
        shake           = FindObjectOfType <ShakeBehavior>();
        upgradeDatabase = FindObjectOfType <UpgradeDatabase>();
        audioDB         = FindObjectOfType <AudioDB>();
        musicPlayer     = FindObjectOfType <MusicPlayer>();
        animations      = FindObjectOfType <UIAnimation>();
        pool            = FindObjectOfType <PoolManager>();
        uiManager.SwitchUI(UIManager.UIType.menu, false);

        streak = new List <Vector3>();
    }
Exemplo n.º 14
0
 // Start is called before the first frame update
 void Start()
 {
     fired                = false;
     ship                 = Instantiate((GameObject)Resources.Load("Prefabs/ship"), new Vector3(0, 0, 0), Quaternion.identity);
     shipScript           = ship.GetComponent <Ship>();
     input                = this.GetComponent <Input_Manager>();
     gui                  = this.GetComponent <GUI_Manager>();
     gui.ShipLives        = 3;
     asteroidM            = this.GetComponent <Asteroid_Manager>();
     bManager             = this.GetComponent <Bullet_Manager>();
     sceneChange          = gameObject.GetComponent <Scene_Changer>();
     screenShake          = Camera.main.GetComponent <ShakeBehavior>();
     isCoroutineExecuting = false;
     AudioSource[] audioSources = GetComponents <AudioSource>();
     source = audioSources[0];
     laser  = audioSources[0].clip;
     crash  = audioSources[1].clip;
 }
Exemplo n.º 15
0
    /*!
     * @pre: none
     * @post: initializes player object with initial firing time and movement properties.
     * !*/
    void Start()
    {
        //    UNCOMMENT THESE TO ENABLE TEST MODE   //

        testModeObject = GameObject.Find("TestModeManager");
        testMode       = testModeObject.GetComponent <TestModeManager>().testFlag;

        //  UNCOMMENT THE ABOVE TO ENABLE TEST MODE //

        levelUp = false;
        //forces the game window to be the resolution we want
        Screen.SetResolution(540, 960, true);
        rb2d               = GetComponent <Rigidbody2D> ();
        nextFire           = Time.time;
        gameOver           = false;
        restart            = false;
        gameOverText.text  = "";
        restartText.text   = "";
        highScoreText.text = "";
        // drag is a property of rigidbody that determines how much the object slows down.
        rb2d.drag = friction;

        score = 0;
        updateScoreString(score);
        lives = 3;
        updateLivesString(lives);
        level = 1;
        updateLevelString(level);

        shake = GameObject.FindGameObjectWithTag("Shake").GetComponent <ShakeBehavior>();

        shotPoweredUp = false;

        highScore = PlayerPrefs.GetInt(highScoreKey, 0);

        testLives            = false;
        testRestart          = false;
        testPowerUp          = false;
        testPowerDown        = false;
        testUpdatesHighScore = false;
        testGameOver         = false;
    }
Exemplo n.º 16
0
    private void Start()
    {
        _player        = GameObject.Find("Player").GetComponent <Player>();
        _shakeBehavior = GameObject.Find("Main Camera").GetComponent <ShakeBehavior>();
        _uiManager     = GameObject.Find("Canvas").GetComponent <UIManager>();
        _animator      = GetComponent <Animator>();


        if (_uiManager == null)
        {
            Debug.Log("UI Manager is NULL");
        }

        if (_player == null)
        {
            Debug.LogError("Player is NULL");
        }

        _animator = GetComponent <Animator>();

        if (_animator == null)
        {
            Debug.LogError("Animator is NULL");
        }

        if (_spawnManager == null)
        {
            Debug.LogError("Spawn Manager is NULL");
        }
        if (_shakeBehavior == null)
        {
            Debug.LogError("Main Camera Shake behavior is NULL");
        }

        pos  = transform.position;
        axis = transform.right;

        /**************Agg Enemy********************/
        playerTarget  = GameObject.Find("Player").transform;
        rotationSpeed = Random.Range(aggEnemyMinRot, aggEnemyMaxRot);
        movementSpeed = Random.Range(aggMinMoveSpeed, aggMaxMoveSpeed);
    }
Exemplo n.º 17
0
 void Start()
 {
     loader.SetActive(false);
     shakebake = FindObjectOfType <ShakeBehavior>();
     playMove  = FindObjectOfType <playerMovement>();
 }
Exemplo n.º 18
0
 private void Awake()
 {
     _shakeBehavior = GameObject.Find("MainCamera").GetComponent <ShakeBehavior>();
 }
Exemplo n.º 19
0
 /*!
  * @pre: none
  * @post: assigns GameObject Character to playerObject
  * @param playerObject: the player object we are currently interacting with
  * !*/
 public void RecievePlayerParameter(GameObject playerObject)
 {
     Character  = playerObject;
     shake      = GameObject.FindGameObjectWithTag("Shake").GetComponent <ShakeBehavior>();
     nextWobble = Time.time;
 }
Exemplo n.º 20
0
 private void Awake()
 {
     shake = Camera.main.transform.GetComponent <ShakeBehavior>();
 }
Exemplo n.º 21
0
 private void Awake()
 {
     Shaker = ShakerCameraObject.GetComponent(typeof(ShakeBehavior)) as ShakeBehavior;
 }
Exemplo n.º 22
0
    void Awake()
    {
        shake = GetComponent <ShakeBehavior>();

        myTransform = transform;
    }