void OnTriggerEnter2D(Collider2D collider) { if (PhotonNetwork.isMasterClient) { var target = collider.gameObject.GetComponent <IPhoton>(); if (target == null) { return; } if (TeamChecker.IsSameTeam(collider.gameObject, _skillUserObj)) { return; } if (_hitRistrictor.ShouldRistrict(collider.gameObject)) { return; } DamageCalculator.Calculate(_skillUserObj, _attackInfo); if (_isSecond) { _synchronizer.SyncAttack(_skillUserViewID, target.PhotonView.viewID, (int)(DamageCalculator.Damage * _secondRatio), DamageCalculator.IsCritical, HitEffectType.Helena); } else { _synchronizer.SyncAttack(_skillUserViewID, target.PhotonView.viewID, DamageCalculator.Damage, DamageCalculator.IsCritical, HitEffectType.Helena); _isSecond = true; } } }
void OnTriggerStay2D(Collider2D collider) { if (PhotonNetwork.isMasterClient && _animator.GetCurrentAnimatorStateInfo(0).IsName("CtrlBreak")) { var target = collider.gameObject.GetComponent <IPhoton>(); if (target == null) { return; } if (TeamChecker.IsSameTeam(collider.gameObject, _skillUserObj)) { return; } if (_hitRistrictor.ShouldRistrict(collider.gameObject)) { return; } DamageCalculator.Calculate(_skillUserObj, _attackInfo); _synchronizer.SyncAttack(_skillUserViewID, target.PhotonView.viewID, DamageCalculator.Damage, DamageCalculator.IsCritical, HitEffectType.Warrior); _synchronizer.SyncDebuff(target.PhotonView.viewID, DebuffType.Stun, _stunSec); } }
void OnTriggerEnter2D(Collider2D collider) { if (PhotonNetwork.isMasterClient) { var target = collider.gameObject.GetComponent <IPhoton>(); if (target == null) { return; } if (TeamChecker.IsSameTeam(collider.gameObject, _skillUserObj)) { return; } if (_hitRistrictor.ShouldRistrict(collider.gameObject)) { return; } DamageCalculator.Calculate(_skillUserObj, _attackInfo); var direction = transform.eulerAngles.y == 180 ? Vector2.right : Vector2.left; _synchronizer.SyncAttack(_skillUserViewID, target.PhotonView.viewID, DamageCalculator.Damage, DamageCalculator.IsCritical, HitEffectType.Magician); _synchronizer.SyncDebuff(target.PhotonView.viewID, DebuffType.Slip, _duration); _synchronizer.SyncForce(target.PhotonView.viewID, _force, direction, false); } }
void OnTriggerEnter2D(Collider2D collider) { if (PhotonNetwork.isMasterClient) { var target = collider.gameObject.GetComponent <IPhoton>(); if (target == null) { return; } if (TeamChecker.IsSameTeam(collider.gameObject, _skillUserObj)) { return; } if (_hitRistrictor.ShouldRistrict(collider.gameObject)) { return; } DamageCalculator.Calculate(_skillUserObj, _attackInfo); _synchronizer.SyncAttack(_skillUserViewID, target.PhotonView.viewID, DamageCalculator.Damage, DamageCalculator.IsCritical, HitEffectType.Panda); _synchronizer.SyncDebuff(target.PhotonView.viewID, DebuffType.Slow, _duration); } }
private IPhoton GetMostNearestTarget() { Collider2D[] colliders = new Collider2D[32]; int overlapCount = _collider.OverlapCollider(_filter, colliders); if (overlapCount == 0) { return(null); } var candidates = colliders.Where(candidate => candidate != null) .Where(candidate => TeamChecker.IsNotSameTeam(candidate.gameObject, _skillUserObj)); if (candidates.Count() == 0) { return(null); } var targetCollider = candidates.Select(candidate => new { Candidate = candidate, Distance = Vector3.Distance(candidate.transform.position, _skillUserObj.transform.position) }) .Aggregate((min, tmp) => (min.Distance < tmp.Distance) ? min : tmp).Candidate; var target = targetCollider.gameObject.GetComponent <IPhoton>(); return(target); }
void OnTriggerEnter2D(Collider2D collider) { var target = collider.gameObject.GetComponent <IPhoton>(); if (target == null) { return; } if (TeamChecker.IsSameTeam(collider.gameObject, _skillUserObj)) { return; } if (_hitRistrictor.ShouldRistrict(collider.gameObject)) { return; } var marginTime = 0.1f; Observable.Timer(TimeSpan.FromSeconds(marginTime)) .Where(_ => this != null) .Subscribe(_ => { GetComponent <SpriteRenderer>().enabled = false; GetComponent <BoxCollider2D>().enabled = false; }); if (PhotonNetwork.isMasterClient) { DamageCalculator.Calculate(_skillUserObj, _attackInfo); _synchronizer.SyncAttack(_skillUserViewID, target.PhotonView.viewID, DamageCalculator.Damage, DamageCalculator.IsCritical, HitEffectType.Helena); _synchronizer.SyncDebuff(target.PhotonView.viewID, DebuffType.Ice, _duration); } }
void OnTriggerStay2D(Collider2D collider) { var target = collider.gameObject.GetComponent <IPhoton>(); if (target == null) { return; } if (TeamChecker.IsSameTeam(collider.gameObject, _skillUserObj)) { var teammate = (Player)target; var damageReactor = teammate.DamageReactor; if (damageReactor.Slot.GetType() == typeof(Shield)) { return; } if (damageReactor.Slot.GetType() == typeof(Passing)) { damageReactor.SetSlot(_reduce); return; } if (damageReactor.Slot.GetType() == typeof(Reduce)) { var reduce = (Reduce)(damageReactor.Slot); if (reduce.ReduceRatio < _reduceRatio) { damageReactor.SetSlot(_reduce); } return; } if (damageReactor.Slot.GetType() == typeof(ReduceCritical)) { damageReactor.SetSubSlot(_reduce); return; } } if (PhotonNetwork.isMasterClient) { if (_hitRistrictor.ShouldRistrict(collider.gameObject)) { return; } DamageCalculator.Calculate(_skillUserObj, _attackInfo); _synchronizer.SyncAttack(_skillUserViewID, target.PhotonView.viewID, DamageCalculator.Damage, DamageCalculator.IsCritical, HitEffectType.Nage); } }
void OnTriggerExit2D(Collider2D collider) { var target = collider.gameObject.GetComponent <IPhoton>(); if (target == null) { return; } if (TeamChecker.IsSameTeam(collider.gameObject, _skillUserObj)) { var teammate = (Player)target; var damageReactor = teammate.DamageReactor; if (damageReactor.Slot.GetType() == typeof(Shield)) { return; } if (damageReactor.Slot.GetType() == typeof(ReduceCritical)) { damageReactor.SetSubSlot(new Passing()); return; } if (damageReactor.Slot.GetType() == typeof(Reduce)) { if (damageReactor.Slot == _reduce) { damageReactor.SetSlot(new Passing()); return; } else { return; } } damageReactor.SetSlot(new Passing()); } }
void OnTriggerStay2D(Collider2D collider) { var target = collider.gameObject.GetComponent <IPhoton>(); if (target == null) { return; } if (target.PhotonView.isMine) { if (TeamChecker.IsNotSameTeam(collider.gameObject, _skillUserObj)) { return; } if (_hitRistrictor.ShouldRistrict(collider.gameObject)) { return; } _synchronizer.SyncHeal(target.PhotonView.viewID, _quantity); } }