protected virtual void DetachCharacterFromPlatform(Collider2D collider) { _topdDownController2D = collider.gameObject.MMGetComponentNoAlloc <TopDownController2D>(); if (_topdDownController2D != null) { _topdDownController2D.SetMovingPlatform(null); } }
protected virtual void AttachCharacterToMovingPlatform(Collider2D collider) { _topdDownController2D = collider.gameObject.MMGetComponentNoAlloc <TopDownController2D>(); if (_topdDownController2D != null) { _topdDownController2D.SetMovingPlatform(this); } // if (UseSafeDistance) { float distance = Vector3.Distance(collider.transform.position, this.transform.position); if (distance > ForcedSafeDistance) { _translationVector = (this.transform.position - collider.transform.position).normalized * Mathf.Min(distance, ForcedSafeDistance); collider.transform.Translate(_translationVector); } } }