Example #1
0
 private void Awake()
 {
     m_canMove        = true;
     m_animController = transform.GetChild(0).GetComponent <animationStateController>();
     tpCam            = GameObject.Find("TPCam").transform;
     m_rb             = GetComponent <Rigidbody>();
 }
Example #2
0
  // we use IEnumerator to make the sphere
  // dissapear after its pickup
  IEnumerator Pickup(Collider player)
  {
    // spawn a cool effect
    //Instantiate(pickupEffect, transform.position, transform.rotation);

    // Apply effect to the Player
    animationStateController stats = player.GetComponent<animationStateController>();
    stats.jumpHeight *= multiplier;
    /*
    if(stats.jumpHeight > 3)
    {
      iconJump.enabled = true;
    }
    */

    // Wait x amount of seconds
    GetComponent<MeshRenderer>().enabled = false;
    GetComponent<Collider>().enabled = false;
    yield return new WaitForSeconds(duration);
    stats.jumpHeight /= multiplier;
    // Reverse the effect on our Player


    // Remove power up object
    Destroy(gameObject);
  }