public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); if (control.MoveLeft || control.MoveRight) { animator.SetBool(TransitionParameter.Move.ToString(), true); } else { animator.SetBool(TransitionParameter.Move.ToString(), false); } }
private void CheckTurn(CharacterControl control) { if (!LockDirection) { if (control.MoveRight) { control.transform.rotation = Quaternion.Euler(0f, 0f, 0f); } if (control.MoveLeft) { control.transform.rotation = Quaternion.Euler(0f, 180f, 0f); } } }
public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); if (control.aiProgress.findingAgent == null) { GameObject pathfindingAgent_Prefab = Instantiate(Resources.Load("PathFindingAgent", typeof(GameObject)) as GameObject); control.aiProgress.findingAgent = pathfindingAgent_Prefab.GetComponent <PathFindingAgent>(); } control.aiProgress.findingAgent.GetComponent <NavMeshAgent>().enabled = false; control.aiProgress.findingAgent.transform.position = control.transform.position; control.aiProgress.findingAgent.GoToTarget(); }
public void CheckCombo(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { if (stateInfo.normalizedTime >= StartAttackTime + ((EndAttackTime - StartAttackTime) / 3f)) { if (stateInfo.normalizedTime < EndAttackTime + ((EndAttackTime - StartAttackTime) / 2f)) { CharacterControl control = characterState.GetCharacterControl(animator); if (control.Attack) { Debug.Log("upper cut is done"); animator.SetBool(TransitionParameter.Attack.ToString(), true); } } } }
public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); if (stateInfo.normalizedTime >= CheckTime) { if (isGrounded(control)) { animator.SetBool(TransitionParameter.Grounded.ToString(), true); } else { animator.SetBool(TransitionParameter.Grounded.ToString(), false); } } }
public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); control.Jump = true; control.MoveUp = true; if (control.aiProgress.findingAgent.startSphere.transform.position.z < control.aiProgress.findingAgent.endSphere.transform.position.z) { control.FaceForward(true); } else { control.FaceForward(false); } }
public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); if (AllowEarlyTurn && !control.animationProgress.thisAllowEarlyTurn) { if (control.MoveLeft) { control.FaceForward(false); } if (control.MoveRight) { control.FaceForward(true); } } control.animationProgress.thisAllowEarlyTurn = false; control.animationProgress.AirMomentum = 0f; }
public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); if (control.isFacingForward()) { if (control.MoveLeft) { animator.SetBool(TransitionParameter.RunningTurn180.ToString(), true); } } if (!control.isFacingForward()) { if (control.MoveRight) { animator.SetBool(TransitionParameter.RunningTurn180.ToString(), true); } } }
public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); Vector3 dir = control.aiProgress.findingAgent.startSphere.transform.position - control.transform.position; if (dir.z > 0f) { control.MoveRight = true; control.MoveLeft = false; } else { control.MoveLeft = true; control.MoveRight = false; } // Debug.Log(dir); }
bool isBodyPart(Collider col) { CharacterControl control = col.transform.root.GetComponent <CharacterControl>(); if (control == null) { return(false); } if (control.gameObject == col.gameObject) { return(false); } if (control.RagdollParts.Contains(col)) { return(true); } return(false); }
private void UpdateMomentum(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); if (control.MoveRight) { control.animationProgress.AirMomentum += speedGraph.Evaluate(stateInfo.normalizedTime) * Time.deltaTime; } if (control.MoveLeft) { control.animationProgress.AirMomentum -= speedGraph.Evaluate(stateInfo.normalizedTime) * Time.deltaTime; } if (Mathf.Abs(control.animationProgress.AirMomentum) >= maxMomentum) { if (control.animationProgress.AirMomentum > 0f) { control.animationProgress.AirMomentum = maxMomentum; } else if (control.animationProgress.AirMomentum < 0f) { control.animationProgress.AirMomentum = -maxMomentum; } } if (control.animationProgress.AirMomentum > 0f) { control.FaceForward(true); } else if (control.animationProgress.AirMomentum < 0f) { control.FaceForward(false); } if (!CheckFront(control)) { control.MoveForward(speed, Mathf.Abs(control.animationProgress.AirMomentum)); } }
bool CheckFront(CharacterControl control) { foreach (GameObject o in control.FrontSpheres) { Debug.DrawRay(o.transform.position, control.transform.forward * 0.3f, Color.red); RaycastHit hit; if (Physics.Raycast(o.transform.position, control.transform.forward, out hit, BlockDistance)) { if (!control.RagdollParts.Contains(hit.collider)) { if (!isBodyPart(hit.collider) && !Ledge.isLedge(hit.collider.gameObject) && !Ledge.isLedgeChecker(hit.collider.gameObject)) { return(true); } } } } return(false); }
bool TransitionTONextAI(CharacterControl characterControl) { if (aITransition == AI_TransitionType.RUN_TO_WALK) { Vector3 dist = characterControl.aiProgress.findingAgent.startSphere.transform.position - characterControl.transform.position; if (Vector3.SqrMagnitude(dist) < 2f) { return(true); } } else if (aITransition == AI_TransitionType.WALK_TO_RUN) { Vector3 dist = characterControl.aiProgress.findingAgent.startSphere.transform.position - characterControl.transform.position; if (Vector3.SqrMagnitude(dist) > 2f) { return(true); } } return(false); }
public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); if (control.isFacingForward()) { if (control.transform.position.z < control.aiProgress.findingAgent.endSphere.transform.position.z) { control.MoveRight = true; control.MoveLeft = false; } else { control.MoveRight = false; control.MoveLeft = false; animator.gameObject.SetActive(false); animator.gameObject.SetActive(true); } } else { if (control.transform.position.z > control.aiProgress.findingAgent.endSphere.transform.position.z) { control.MoveRight = false; control.MoveLeft = true; } else { control.MoveRight = false; control.MoveLeft = false; animator.gameObject.SetActive(false); animator.gameObject.SetActive(true); } } }
private void OnTriggerEnter(Collider col) { if (owner.RagdollParts.Contains(col)) { return; } CharacterControl attacker = col.transform.root.GetComponent <CharacterControl>(); if (attacker == null) { return; } if (col.gameObject == attacker.gameObject) { return; } if (!CollidingParts.Contains(col)) { CollidingParts.Add(col); } }
private void Awake() { characterControl = this.gameObject.GetComponent <CharacterControl>(); }
private void Awake() { DamageTaken = 0; control = GetComponent <CharacterControl>(); }
public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); control.animationProgress.thisAllowEarlyTurn = true; }
private void ToggleBoxCol(CharacterControl control) { control.RIGIBODY.velocity = Vector3.zero; control.GetComponent <BoxCollider>().enabled = on; }
public override void OnExit(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); control.animationProgress.AirMomentum = 0f; }
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.Attack) { return(false); } } break; case TransitionConditionType.JUMP: { if (!control.Jump) { return(false); } } break; case TransitionConditionType.GRABBING_LEDGE: { if (!control.ledgeChecker.isGrabbingLedge) { return(false); } } break; } } return(true); }
private void Awake() { owner = this.GetComponentInParent <CharacterControl>(); }
public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); }
public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); Vector3 dist = control.aiProgress.findingAgent.startSphere.transform.position - control.transform.position; //Jumping, if startsphere is on lower platform than endphere if (control.aiProgress.findingAgent.startSphere.transform.position.y < control.aiProgress.findingAgent.endSphere.transform.position.y) { if (Vector3.SqrMagnitude(dist) < 0.01f) { control.MoveLeft = false; control.MoveRight = false; animator.SetBool(EnemyTransitions.JumpPlatform.ToString(), true); } } //Fall, if endsphere is on lower platform than startsphere if (control.aiProgress.findingAgent.startSphere.transform.position.y > control.aiProgress.findingAgent.endSphere.transform.position.y) { animator.SetBool(EnemyTransitions.FallPlatform.ToString(), true); } //Go straignt if Endsphere and startphare are on same platform if (control.aiProgress.findingAgent.startSphere.transform.position.y == control.aiProgress.findingAgent.endSphere.transform.position.y) { if (Vector3.SqrMagnitude(dist) < 0.7f) { control.MoveLeft = false; control.MoveRight = false; Vector3 playerDist = control.transform.position - CharacterManager.Instance.GetPlayableCharacter().transform.position; if (playerDist.sqrMagnitude > 1f) { animator.gameObject.SetActive(false); animator.gameObject.SetActive(true); } //temp attack /* else * { * if(CharacterManager.Instance.GetPlayableCharacter().damageDetector.DamageTaken == 0) * { * if(control.isFacingForward()) * { * control.MoveRight = false; * control.MoveLeft = false; * control.Attack = true; * } * else * { * control.MoveRight = false; * control.MoveLeft = false; * control.Attack = true; * } * } * else * { * control.Attack = false; * control.MoveLeft = false; * control.MoveRight = false; * } * * }*/ } } }
private void ToggleGrav(CharacterControl control) { // control.SkinnedMeshedAnimator control.RIGIBODY.velocity = Vector3.zero; control.RIGIBODY.useGravity = on; }
public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo) { CharacterControl control = characterState.GetCharacterControl(animator); }