public virtual void ClimbStart() { int wallHeight = 0; if (wallCheckDown.getCubeColliding() != null) { wallHeight = wallCheckDown.getCubeColliding().GetHeight(); } else { if (wallCheckTop.getCubeColliding() != null) { wallHeight = wallCheckDown.getCubeColliding().GetHeight() + 1; } } if (wallHeight > 0 && wallHeight <= climbMaxHeight) { doingSkill = true; if (moveToDirection3D.direction != Directions3D.top && moveToDirection3D.direction != Directions3D.bottom) { directionBeforeVertical = moveToDirection3D.direction; } moveToDirection3D.speed = climbSpeed; moveToDirection3D.ChangeDirection(Directions3D.top); animator.SetBool(hashAnimator.climb, true); } else { NoAction(); } }
public static Directions3D RandomDirectionGrounded(List <Directions3D> directionsToExclude) { if (arrayDirections == null) { arrayDirections = System.Enum.GetValues(typeof(Directions3D)); for (int i = 0; i < arrayDirections.Length; i++) { Directions3D directionToCheck = (Directions3D)arrayDirections.GetValue(i); if (DirectionsVectors3D.DirectionIsGrounded[directionToCheck]) { arrayDirectionsGrounded.Add(directionToCheck); } } } List <Directions3D> directionsNoExcluded = new List <Directions3D> (); for (int i = 0; i < arrayDirectionsGrounded.Count; i++) { if (!directionsToExclude.Contains(arrayDirectionsGrounded[i])) { directionsNoExcluded.Add(arrayDirectionsGrounded[i]); } } if (directionsNoExcluded.Count > 0) { direction = directionsNoExcluded[Random.Range(0, directionsNoExcluded.Count)]; } return(direction); }
public virtual void OnTriggerEnter(Collider other) { if (other.gameObject.tag == Tags.characterBlocking) { BlockSkill otherBlockSkill = other.gameObject.GetComponent <BlockSkill> (); if (otherBlockSkill != blockSkill) { if (otherBlockSkill.character.chooseBlockDirection) { Directions3D newDirection = otherBlockSkill.direction; if (newDirection != Directions3D.top && newDirection != Directions3D.bottom) { ChangeDirection(newDirection); } else { ChangeDirection(DirectionsChanges3D.GetOpositeDirection(moveToDirection3D.direction)); } } else { ChangeDirection(); } } } }
public virtual void ParachuteStart() { doingSkill = true; moveToDirection3D.speed = parachuteSpeed; directionBeforeVertical = moveToDirection3D.direction; moveToDirection3D.ChangeDirection(new Vector3(0, -(1 * (1 - parachuteAngle)), 1 * parachuteAngle)); animator.SetBool(hashAnimator.parachute, true); }
public static Directions3D RandomDirectionGrounded(Directions3D directionToExclude) { List <Directions3D> directionsToExclude = new List <Directions3D>(); directionsToExclude.Add(directionToExclude); direction = RandomDirectionGrounded(directionsToExclude); return(direction); }
public static Directions3D RandomDirection() { if (arrayDirections == null) { arrayDirections = System.Enum.GetValues(typeof(Directions3D)); } if (arrayDirections.Length > 0) { direction = (Directions3D)arrayDirections.GetValue(Random.Range(0, arrayDirections.Length)); } return(direction); }
public static Directions3D RandomDirectionGrounded90Degrees(Directions3D directionToUse) { if (Random.Range(0, 2) == 0) { direction = Get90ClockwiseDirection(directionToUse); } else { direction = Get90CounterClockwiseDirection(directionToUse); } return(direction); }
public static Directions3D RandomDirectionGrounded() { if (arrayDirections == null) { arrayDirections = System.Enum.GetValues(typeof(Directions3D)); for (int i = 0; i < arrayDirections.Length; i++) { Directions3D directionToCheck = (Directions3D)arrayDirections.GetValue(i); if (DirectionsVectors3D.DirectionIsGrounded[directionToCheck]) { arrayDirectionsGrounded.Add(directionToCheck); } } } if (arrayDirectionsGrounded.Count > 0) { direction = arrayDirectionsGrounded[Random.Range(0, arrayDirectionsGrounded.Count)]; } return(direction); }
public virtual void StartFalling() { if (!usingSkill && action != CharacterActionsEnum.climb && action != CharacterActionsEnum.parachute) { NoAction(); isFalling = true; if (moveToDirection3D.direction != Directions3D.top && moveToDirection3D.direction != Directions3D.bottom) { directionBeforeVertical = moveToDirection3D.direction; } yFallStart = transform.position.y; moveToDirection3D.ChangeDirection(Directions3D.bottom); moveToDirection3D.speed = fallSpeed; animator.SetBool(hashAnimator.falling, true); } if (usingSkill && action == CharacterActionsEnum.parachute) { ParachuteStart(); } }
public void ChangeDirection(Directions3D direction) { this.direction = direction; if (!lookAt) { directionToMoveVector = DirectionsVectors3D.directionVector3D [direction]; } if (lookAt) { if (direction != Directions3D.top && direction != Directions3D.bottom) { directionToMoveVector = DirectionsVectors3D.directionVector3D [Directions3D.north]; transform.rotation = Quaternion.Euler(new Vector3(transform.rotation.x, DirectionsVectors3D.DirectionYRotation [direction], transform.rotation.z)); } else { directionToMoveVector = DirectionsVectors3D.directionVector3D [direction]; } } }
public static Directions3D Get90CounterClockwiseDirection(Directions3D direction) { switch (direction) { case Directions3D.north: return(Directions3D.west); break; case Directions3D.east: return(Directions3D.north); break; case Directions3D.south: return(Directions3D.east); break; case Directions3D.west: return(Directions3D.south); break; case Directions3D.top: return(Directions3D.west); break; case Directions3D.bottom: return(Directions3D.east); break; default: return(Directions3D.north); break; } }
public static Directions3D GetOpositeDirection(Directions3D direction) { switch (direction) { case Directions3D.north: return(Directions3D.south); break; case Directions3D.east: return(Directions3D.west); break; case Directions3D.south: return(Directions3D.north); break; case Directions3D.west: return(Directions3D.east); break; case Directions3D.top: return(Directions3D.bottom); break; case Directions3D.bottom: return(Directions3D.top); break; default: return(Directions3D.north); break; } }
public virtual void ChangeDirection(Directions3D directionToGo) { moveToDirection3D.ChangeDirection(directionToGo); transform.position = new Vector3(Mathf.Round(transform.position.x), transform.position.y, Mathf.Round(transform.position.z)); }
public void ClockWise() { direction = DirectionsChanges3D.Get90ClockwiseDirection(character.moveToDirection3D.direction); }
public void GoBack() { direction = Directions3D.top; }