Inheritance: MonoBehaviour
Exemple #1
0
    // Use this for initialization
    void Awake()
    {
        rb          = GetComponent <Rigidbody>();
        audioSource = GetComponent <AudioSource>();
        anim        = GetComponent <Animation>();

        respawningObject = GameObject.FindWithTag("MainCamera").GetComponent <Respawning>();
        audioSource.PlayOneShot(spawnSound);
        anim.Play("Spawn");
    }
Exemple #2
0
    private void Awake()
    {
        //contains all the settings for all available difficulties
        _scriptData = Resources.LoadAll <ScriptableData>("Data");

        _gameManager     = _gameManagerObject.GetComponent <GameManager>();
        dataHandler      = _gameManager.GetComponent <DataHandler>();
        _rigidBody       = GetComponent <Rigidbody>();
        _camera          = Camera.main.GetComponent <ChaseCamera>();
        respawningSystem = _gameManager.GetComponent <Respawning>();

        _spawnPosition = transform.position;
        _spawnRotation = transform.rotation;

        playerInput = GetComponent <PlayerInput>();

        lastposition = transform.position;
        //slow down time
        slowDownSoundSource             = gameObject.AddComponent <AudioSource>();
        slowDownSoundSource.playOnAwake = false;
        slowDownSoundSource.clip        = slowDownSound;
        slowDownSoundSource.loop        = false;

        //speed up time
        speedUpSoundSource             = gameObject.AddComponent <AudioSource>();
        speedUpSoundSource.playOnAwake = false;
        speedUpSoundSource.clip        = speedUpSound;
        speedUpSoundSource.loop        = false;
        speedUpSoundSource.pitch       = 2.0f; //speeds up how fast the sound will be played. I feel it's better double the speed.

        //collect firefly
        collectFireflySoundSource             = gameObject.AddComponent <AudioSource>();
        collectFireflySoundSource.playOnAwake = false;
        collectFireflySoundSource.clip        = collectFireflySound;
        collectFireflySoundSource.loop        = false;
    }
 void Start()
 {
     instance = this;
 }
 void Start()
 {
     m_Start      = GameObject.FindWithTag("Start");
     m_Checkpoint = GameObject.FindWithTag("Checkpoint");
     r            = this;
 }