private void OnCollisionEnter(Collision collision)
 {
     if (GooManager.WithinGoo(GooType.Bounce, transform.position + new Vector3(0, -1, 0), 0.2f))
     {
         attachedRigidbody.AddForce(collision.impulse * bouncyness, ForceMode.Impulse);
     }
 }
        //Physics methods
        private void FixedUpdate()
        {
            if (controller.Grounded)
            {
                if (GooManager.WithinGoo(GooType.Slide, transform.position + new Vector3(0, -1, 0), 0.2f))
                {
                    //Increase movement speed
                    controller.moveSpeed = slideSpeed;

                    //Remove all friction
                    material.staticFriction  = 0;
                    material.dynamicFriction = 0;
                    material.frictionCombine = PhysicMaterialCombine.Minimum;
                }
                else
                {
                    //Back to original speed
                    controller.moveSpeed = originalSpeed;

                    //Return friction
                    material.staticFriction  = originalSFriction;
                    material.dynamicFriction = originalDFriction;
                    material.frictionCombine = originalFrictionCombine;
                }
            }
        }
Exemple #3
0
 private IEnumerator Register()
 {
     while (!GooManager.Register(projection, type))
     {
         yield return(new WaitForFixedUpdate());
     }
 }
Exemple #4
0
 private void Awake()
 {
     //Initialize singleton
     if (singleton == null)
     {
         singleton = this;
     }
     else if (singleton != this)
     {
         Destroy(gameObject);
     }
 }
Exemple #5
0
 private void Deregister()
 {
     GooManager.Deregister(projection, type);
 }