| | |
| | | private void OnEnable() |
| | | { |
| | | CharacterEvents.characterDrillingToPosition += (DrillingToPosition); |
| | | //CharacterEvents.characterDrillingToPositionAbort += (DrillingToPositionAbort); |
| | | } |
| | | |
| | | private void OnDisable() |
| | | { |
| | | CharacterEvents.characterDrillingToPosition -= (DrillingToPosition); |
| | | //CharacterEvents.characterDrillingToPositionAbort -= (DrillingToPositionAbort); |
| | | } |
| | | |
| | | private void Awake() |
| | |
| | | //Debug.Log(contactPoints[0].otherRigidbody?.gameObject.name); |
| | | if (contactPoints[0].otherRigidbody?.name == "Tilemap") |
| | | { |
| | | boxCollider.enabled = false; |
| | | switch (drillDirection) |
| | | { |
| | | case DrillDirection.Left: |
| | | case DrillDirection.Right: |
| | | IsDrillingLeftRight = true; |
| | | break; |
| | | case DrillDirection.Down: |
| | | IsDrillingDown = true; |
| | | break; |
| | | default: |
| | | Debug.Assert(false, "Add DrillDirection here!"); |
| | | break; |
| | | } |
| | | CharacterEvents.characterDrill.Invoke(contactPoints[0], drillDirection); |
| | | } |
| | | } |
| | | |
| | | private void DrillingToPosition(Vector3 tilePosition) |
| | | private void DrillingToPosition(Vector3 tilePosition, DrillDirection drillDirection) |
| | | { |
| | | boxCollider.enabled = false; |
| | | switch (drillDirection) |
| | | { |
| | | case DrillDirection.Left: |
| | | case DrillDirection.Right: |
| | | IsDrillingLeftRight = true; |
| | | break; |
| | | case DrillDirection.Down: |
| | | IsDrillingDown = true; |
| | | break; |
| | | default: |
| | | Debug.Assert(false, "Add DrillDirection here!"); |
| | | break; |
| | | } |
| | | //Debug.Log("DrillingToPosition() called"); |
| | | //Debug.Log(gameObject.transform.position); |
| | | drillToPosition = true; |
| | |
| | | drillOriginalPosition = gameObject.transform.position; |
| | | //Debug.Log("drillOriginalPosition: " + drillOriginalPosition); |
| | | } |
| | | //private void DrillingToPositionAbort() |
| | | //{ |
| | | // IsDrilling = false; |
| | | // //Debug.Log("DrillingToPosition() called"); |
| | | // //Debug.Log(gameObject.transform.position); |
| | | // drillToPosition = false; |
| | | // //drillTilePosition = null; |
| | | // //Debug.Log("drillTilePosition: " + drillTilePosition); |
| | | // drillOriginalPosition = gameObject.transform.position; |
| | | // //Debug.Log("drillOriginalPosition: " + drillOriginalPosition); |
| | | //} |
| | | |
| | | //private void DrillLeftOrRight() |
| | | //{ |