| | |
| | | TouchingDirections touchingDirections; |
| | | |
| | | // Time it takes to drill |
| | | public float drillingTime = 1f; |
| | | private float drillingTime = 1f; |
| | | private float timeSinceDrill = 0f; |
| | | private bool drillToPosition; |
| | | private Vector3 drillTilePosition; |
| | | private Vector3 drillOriginalPosition; |
| | | |
| | | |
| | | [SerializeField] |
| | | private bool _isMoving; |
| | | public bool IsMoving |
| | |
| | | animator_rotor.SetBool(AnimationStrings.Player.isFlying, value); |
| | | } |
| | | } |
| | | [SerializeField] |
| | | private bool _isDrilling; |
| | | public bool IsDrilling |
| | | { |
| | | get { return _isDrilling; } |
| | | get { return IsDrillingDown || IsDrillingLeftRight; } |
| | | set |
| | | { |
| | | _isDrilling = value; |
| | | //animator.SetBool(AnimationStrings.Player.isDrilling, value); |
| | | if (value) |
| | | { |
| | | Debug.Assert(false, "Can't set IsDrilling this way, use IsDrillingLeftRight or IsDrillingDown!"); |
| | | } |
| | | if (IsDrillingDown) |
| | | { |
| | | IsDrillingDown = false; |
| | | } |
| | | if (IsDrillingLeftRight) |
| | | { |
| | | IsDrillingLeftRight = false; |
| | | } |
| | | } |
| | | } |
| | | [SerializeField] |
| | | private bool _isDrillingLeftRight; |
| | | public bool IsDrillingLeftRight |
| | | { |
| | | get { return _isDrillingLeftRight; } |
| | | set |
| | | { |
| | | _isDrillingLeftRight = value; |
| | | animator.SetBool(AnimationStrings.Player.isDrillingLeftRight, value); |
| | | animator_rotor.SetBool(AnimationStrings.Player.isFlying, false); |
| | | if (value) |
| | | { |
| | | animator.speed = 1 / drillingTime; |
| | | } |
| | | else |
| | | { |
| | | animator.speed = 1f; |
| | | } |
| | | } |
| | | } |
| | | [SerializeField] |
| | | private bool _isDrillingDown; |
| | | public bool IsDrillingDown |
| | | { |
| | | get { return _isDrillingDown; } |
| | | set |
| | | { |
| | | _isDrillingDown = value; |
| | | animator.SetBool(AnimationStrings.Player.isDrillingDown, value); |
| | | animator_rotor.SetBool(AnimationStrings.Player.isFlying, false); |
| | | if (value) |
| | | { |
| | | animator.speed = 1 / drillingTime; |
| | | } |
| | | else |
| | | { |
| | | animator.speed = 1f; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | case DrillDirection.Down: |
| | | touchingDirections.groundHits[0].collider.GetContacts(contactPoints); |
| | | break; |
| | | default: |
| | | Debug.Assert(false, "Add DrillDirection here!"); |
| | | break; |
| | | } |
| | | //Debug.Log(contactPoints[0].otherRigidbody?.gameObject.name); |
| | | if (contactPoints[0].otherRigidbody?.name == "Tilemap") |
| | | { |
| | | boxCollider.enabled = false; |
| | | IsDrilling = true; |
| | | 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); |
| | | } |
| | | } |