Ejemplo n.º 1
0
    /// <summary>
    /// Sent when another object enters a trigger collider attached to this
    /// object (2D physics only).
    /// </summary>
    /// <param name="other">The other Collider2D involved in this collision.</param>
    void OnTriggerEnter2D(Collider2D other)
    {
        ObjectController2D obj = other.GetComponent <ObjectController2D>();

        if (obj)
        {
            obj.SetForce(force);
            obj.IgnoreFriction = true;
            CharacterController2D character = obj.GetComponent <CharacterController2D>();
            if (character)
            {
                character.ResetJumpsAndDashes();
            }
            animator.SetTrigger(jumpAnimation);
            if (audioSource)
            {
                audioSource.Play();
            }
        }
    }