private IEnumerator OnDetecting() { mainEvents.OnAnimEvent(AnimationController.AnimationType.Start); yield return(new WaitForSeconds(timeAfterDetect)); while (detection.AlreadyDetect) { var detectionObjects = detection.DetectionsObjects; if (detectionObjects != null) { foreach (var obj in detectionObjects) { if (obj.CompareTag("Player")) { if (!isAttackRecently) { StartCoroutine(AttackLogic()); } MovementLogic(obj.transform); break; } } } yield return(new WaitForEndOfFrame()); } }
public override void Move(Vector3 direction) { bool isCallAlready = false; direction = direction.normalized; foreach (var type in moveTypeSpeeds) { if (moveType == type.Key && !isCallAlready) { isCallAlready = true; direction = new Vector3(direction.x * type.Value, direction.y * jumpForce, direction.z * type.Value); if (grounded) { var toAnim = direction.magnitude / correctToAnim; movementEvents.OnAnimEvent(AnimationController.AnimationType.Movement, toAnim); body.AddForce(direction * Time.fixedDeltaTime * 100); } else { var newDirection = direction / speedInAir; newDirection.y = -g; body.AddForce(newDirection * Time.fixedDeltaTime * 100); } } } }
public bool MoveUponDistance(Transform target, float detectionDistance, AEnemyMovement.EnemyMoveType currentType) { Vector3 toTarget = target.position - transform.position; if (toTarget.magnitude <= detectionDistance) { //var temp = target.position; foreach (var lookObj in lookingObject) { //temp.y = lookObj.position.y; //lookObj.LookAt(temp); TargetRotationFixator.Looking(lookObj, target, TargetRotationFixator.LockRotationAngle.Pitch); } mainEvents.OnAnimEvent(AnimationController.AnimationType.Movement, meshAgent.velocity.magnitude / correctSpeedToAnim); Move(currentType, target); return(true); } else { mainEvents.OnAnimEvent(AnimationController.AnimationType.Movement, 0); } return(false); }
protected override void CheckTypeAndValues(DamagebleParam.ParamType type, float value, float maxValue) { switch (type) { case DamagebleParam.ParamType.Health: if (isFirstCheck) { bossUI.InitializeBossView(bossName, bossIcon, maxValue); isFirstCheck = false; } bossUI.ViewHealth(value); if (value <= 0 && !isDeadYet) { events.OnAnimEvent(AnimationController.AnimationType.Death); isDeadYet = true; } break; } }