Exemple #1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Activator"))
     {
         other.GetComponent <Activator>();
         currentActivator = other.GetComponent <Activator>();
     }
     else if (other.CompareTag("LevelGoal"))
     {
         transform.SetParent(other.transform);
         transform.localPosition = VectorExt.OneByeOneProduct(transform.localPosition, Vector3.up);
         inputEnabled            = false;
         int goalIndex = other.GetComponent <LevelSelectorData>().levelIndex;
         GameControl.instance.StartLevelChangeProcess(goalIndex);
     }
 }
Exemple #2
0
    void OnCollisionExit(Collision collision)
    {
        if (groundCollection.Contains(collision.collider))
        {
            groundCollection.Remove(collision.collider);
            if (collision.collider.CompareTag("MovingPlatform"))
            {
                transform.SetParent(null);
                Vector3 exitMomentum = collision.collider.GetComponent <PlatformBehaviour3D>().currentMomentum;
                exitMomentum = VectorExt.OneByeOneProduct(exitMomentum, VectorExt.zeroY);
                rigBod.AddForce(exitMomentum, ForceMode.VelocityChange);
            } //lookAtThis
        }

        if (groundCollection.Count == 0)
        {
            grounded = false;
            //  playerAnimator.SetBool("Grounded", grounded);
        }
    }