protected Vector3 GetFireDirection() { Vector3 newDirection = _owner.ACOwner.ThisTransform.forward; HitTargetInfo tt = null; int weight = 99999; foreach (HitTargetInfo hti in _targetList) { int ret = hti.GetFinalWeight(_colliderRangeToStrike.radius, _owner.ACOwner); if (ret < weight) { weight = ret; tt = hti; } } if (tt != null) { Vector3 dir = (tt._target.ThisTransform.localPosition - _owner.ACOwner.ThisTransform.localPosition); dir.y = 0; dir.Normalize(); if (dir != Vector3.zero) { newDirection = dir; } } else { int angle = Random.Range(0, 360); Vector3 dir = Quaternion.Euler(new Vector3(0, angle, 0)) * Vector3.forward; newDirection = dir; } return(newDirection); }
void OnTriggerExit(Collider other) { ActionController ac = ActionControllerManager.Instance.GetACByCollider(other); if (ac != null) { HitTargetInfo tt = null; foreach (HitTargetInfo hti in _targetList) { if (hti._target == ac) { tt = hti; } } if (tt != null) { _targetList.Remove(tt); } } }
public ActionController GetFireTarget() { ActionController newAC = null; HitTargetInfo tt = null; int weight = 99999; foreach (HitTargetInfo hti in _targetList) { int ret = hti.GetFinalWeight(_colliderRangeToStrike.radius, _owner.ACOwner); if (ret < weight) { weight = ret; tt = hti; } } if (tt != null) { newAC = tt._target; tt._strikeCount++; } return(newAC); }
void OnTriggerEnter(Collider other) { ActionController ac = ActionControllerManager.Instance.GetACByCollider(other); if (ac != null && ac.IsAlived) { bool ret = false; foreach (HitTargetInfo hti in _targetList) { if (hti._target == ac) { ret = true; break; } } if (!ret) { HitTargetInfo th = new HitTargetInfo(); th._target = ac; th._strikeCount = 0; _targetList.Add(th); } } }
public override void AttackUpdate() { base.AttackUpdate(); if (_shadowStep == 0) { _lifeCount += Time.deltaTime; if (_lifeCount >= _beginCountTime) { _owner.ACOwner.ACHide(); _shadowStep = 1; _strikeCount++; _lifeCount = 0; //start effect _battleCharEffect.ShowStartEffect(true); _battleCharEffect.ResetLocation(_owner.ACOwner.ThisTransform.position); _battleCharEffect.LockLocation(true); } } else if (_shadowStep == 1) { _lifeCount += Time.deltaTime; HitTargetInfo tt = null; foreach (HitTargetInfo hti in _targetList) { if (hti._target == null || !hti._target.IsAlived) { tt = hti; } } if (tt != null) { _targetList.Remove(tt); } if (_lifeCount >= _lastTime && _strikeCount >= _strikeCountMin) { if (_strikeCount >= _strikeCountMax && _boltCount >= _boltMaxCount) { _attackCanSwitch = true; _shouldGotoNextHit = true; _inAttackDelay = true; _shadowStep = 2; } else { _shouldGotoNextHit = false; _shadowStep = 3; _owner.ACOwner.ACShow(); _owner.AnimationSwitch._aniIdx = FC_All_ANI_ENUM.shadow_show_end; _owner.ACOwner.ACPlayAnimation(_owner.AnimationSwitch); _boltCount = 0; } } else { _currentCDCounter += Time.deltaTime; if (_currentCDCounter >= _currentCDTime) { _currentCDCounter -= _currentCDTime; //_bulletLauncher.forward = GetFireDirection(); _owner.ACOwner.FireTarget = GetFireTarget(); _owner.ACOwner.ACFire(FirePortIdx); //_owner.ACOwner.FireTarget = null; _strikeCount++; } } } else if (_shadowStep == 2) { if (_delayTimeCount > 0) { _delayTimeCount -= Time.deltaTime; if (_delayTimeCount <= 0) { AttackEnd(); } } } /*Vector2 radius = Random.insideUnitCircle*0.5f; * Vector3 r3 = Vector3.zero; * r3.x += radius.x; * r3.z += radius.y; * _owner.ACOwner.SelfMoveAgent.Move(r3);*/ }