Example #1
0
        /// <summary>
        /// When an object collides with the grip, we check to see if it's a compatible character, and if yes, we change its state to Gripping
        /// </summary>
        /// <param name="collider">Collider.</param>
        protected virtual void OnTriggerEnter2D(Collider2D collider)
        {
            CharacterGrip characterGrip = collider.gameObject.GetComponentNoAlloc <CharacterGrip>();

            if (characterGrip == null)
            {
                return;
            }

            characterGrip.StartGripping(this);
        }
        /// <summary>
        /// When an object collides with the grip, we check to see if it's a compatible character, and if yes, we change its state to Gripping
        /// </summary>
        /// <param name="collider">Collider.</param>
        protected virtual void OnTriggerEnter2D(Collider2D collider)
        {
            CharacterGrip characterGrip = collider.gameObject.MMGetComponentNoAlloc <Character>()?.FindAbility <CharacterGrip>();

            if (characterGrip == null)
            {
                return;
            }

            characterGrip.StartGripping(this);

            if (_mmPathMovement != null)
            {
                _mmPathMovement.CanMove = true;
            }
        }