public bool IsFacingAttacker() { Vector3 vec = control.damageDetector.Attacker.transform.position - control.transform.position; if (vec.z < 0f) { if (control.IsFacingForward()) { return(false); } else { return(true); } } else if (vec.z > 0f) { if (control.IsFacingForward()) { return(true); } else { return(false); } } return(true); }
public void DropWeapon() { MeleeWeapon w = control.animationProgress.HoldingWeapon; if (w != null) { w.transform.parent = null; if (control.IsFacingForward()) { w.transform.rotation = Quaternion.Euler(90f, 0f, 0f); } else { w.transform.rotation = Quaternion.Euler(-90f, 0f, 0f); } RemoveWeaponFromDictionary(control); w.transform.position = control.transform.position + (Vector3.up * 0.0225f); control.animationProgress.HoldingWeapon = null; control = null; w.triggerDetector.control = null; } }
bool IsBlocked(AttackInfo info) { if (info == BlockedAttack && BlockedAttack != null) { return(true); } if (control.animationProgress.IsRunning(typeof(Block))) { Vector3 dir = info.Attacker.transform.position - control.transform.position; if (dir.z > 0f) { if (control.IsFacingForward()) { return(true); } } else if (dir.z < 0f) { if (!control.IsFacingForward()) { return(true); } } } return(false); }
bool OffsetPosition(GameObject platform) { BoxCollider boxCollider = platform.GetComponent <BoxCollider>(); if (boxCollider == null) { return(false); } if (IsGrabbingLedge) { return(false); } IsGrabbingLedge = true; control.RIGID_BODY.useGravity = false; control.RIGID_BODY.velocity = Vector3.zero; float y, z; y = platform.transform.position.y + (boxCollider.size.y / 2f); if (control.IsFacingForward()) { z = platform.transform.position.z - (boxCollider.size.z / 2f); } else { z = platform.transform.position.z + (boxCollider.size.z / 2f); } Vector3 platformEdge = new Vector3(0f, y, z); GameObject TestingSphere = GameObject.Find("TestingSphere"); TestingSphere.transform.position = platformEdge; if (control.IsFacingForward()) { control.RIGID_BODY.MovePosition( platformEdge + LedgeCalibration); } else { control.RIGID_BODY.MovePosition( platformEdge + new Vector3(0f, LedgeCalibration.y, -LedgeCalibration.z)); } return(true); }
public bool IsFacingTarget() { if ((control.aiProgress.pathfindingAgent.target.transform.position - control.transform.position).z > 0f) { if (control.IsFacingForward()) { return(true); } } else { if (!control.IsFacingForward()) { return(true); } } return(false); }
private bool MakeTransition(CharacterControl control) { foreach (TransitionConditionType c in transitionConditions) { switch (c) { case TransitionConditionType.UP: { if (!control.MoveUp) { return(false); } } break; case TransitionConditionType.DOWN: { if (!control.MoveDown) { return(false); } } break; case TransitionConditionType.LEFT: { if (!control.MoveLeft) { return(false); } } break; case TransitionConditionType.RIGHT: { if (!control.MoveRight) { return(false); } } break; case TransitionConditionType.ATTACK: { if (!control.animationProgress.AttackTriggered) { return(false); } } break; case TransitionConditionType.JUMP: { if (!control.Jump) { return(false); } } break; case TransitionConditionType.GRABBING_LEDGE: { if (!control.ledgeChecker.IsGrabbingLedge) { return(false); } } break; case TransitionConditionType.NOT_GRABBING_LEDGE: { if (control.ledgeChecker.IsGrabbingLedge) { return(false); } } break; case TransitionConditionType.LEFT_OR_RIGHT: { if (!control.MoveLeft && !control.MoveRight) { return(false); } if (control.MoveLeft && control.MoveRight) { return(false); } } break; case TransitionConditionType.GROUNDED: { if (control.SkinnedMeshAnimator.GetBool(HashManager.Instance.DicMainParams[TransitionParameter.Grounded]) == false) { return(false); } } break; case TransitionConditionType.MOVE_FORWARD: { if (control.IsFacingForward()) { if (!control.MoveRight) { return(false); } } else { if (!control.MoveLeft) { return(false); } } } break; case TransitionConditionType.AIR: { if (!control.SkinnedMeshAnimator.GetBool(HashManager.Instance.DicMainParams[TransitionParameter.Grounded]) == false) { return(false); } } break; case TransitionConditionType.BLOCKED_BY_WALL: { foreach (OverlapChecker oc in control.collisionSpheres.FrontOverlapCheckers) { if (!oc.ObjIsOverlapping) { return(false); } } } break; case TransitionConditionType.NOT_BLOCKED_BY_WALL: { bool AllIsOverlapping = true; foreach (OverlapChecker oc in control.collisionSpheres.FrontOverlapCheckers) { if (!oc.ObjIsOverlapping) { AllIsOverlapping = false; } } if (AllIsOverlapping) { return(false); } } break; case TransitionConditionType.CAN_WALLJUMP: { if (!control.animationProgress.CanWallJump) { return(false); } } break; case TransitionConditionType.MOVING_TO_BLOCKING_OBJ: { foreach (KeyValuePair <GameObject, GameObject> data in control.animationProgress.BlockingObjs) { Vector3 dir = data.Value.transform.position - control.transform.position; if (dir.z > 0f && !control.MoveRight) { return(false); } if (dir.z < 0f && !control.MoveLeft) { return(false); } } } break; case TransitionConditionType.DOUBLE_TAP_UP: { if (!control.manualInput.DoubleTaps.Contains(InputKeyType.KEY_MOVE_UP)) { return(false); } } break; case TransitionConditionType.DOUBLE_TAP_DOWN: { if (!control.manualInput.DoubleTaps.Contains(InputKeyType.KEY_MOVE_DOWN)) { return(false); } } break; case TransitionConditionType.DOUBLE_TAP_LEFT: { return(false); } break; case TransitionConditionType.DOUBLE_TAP_RIGHT: { return(false); } break; case TransitionConditionType.TOUCHING_WEAPON: { if (control.animationProgress.CollidingWeapons.Count == 0) { if (control.animationProgress.HoldingWeapon == null) { return(false); } } } break; case TransitionConditionType.HOLDING_AXE: { if (control.animationProgress.HoldingWeapon == null) { return(false); } if (!control.animationProgress.HoldingWeapon.name.Contains("Axe")) { return(false); } } break; case TransitionConditionType.NOT_MOVING: { if (control.MoveLeft || control.MoveRight) { if (!(control.MoveLeft && control.MoveRight)) { return(false); } } } break; case TransitionConditionType.RUN: { if (!control.Turbo) { return(false); } if (control.MoveLeft && control.MoveRight) { return(false); } if (!control.MoveLeft && !control.MoveRight) { return(false); } } break; case TransitionConditionType.NOT_RUN: { if (control.Turbo) { if (control.MoveLeft || control.MoveRight) { if (!(control.MoveLeft && control.MoveRight)) { return(false); } } } } break; } } return(true); }