コード例 #1
0
ファイル: HelenaX.cs プロジェクト: bunashibu/kikan
        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;
                }
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
ファイル: MagicianShift.cs プロジェクト: bunashibu/kikan
        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);
            }
        }
コード例 #4
0
ファイル: PandaCtrl2.cs プロジェクト: moto2002/kikan
        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);
            }
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: HelenaCtrl.cs プロジェクト: bunashibu/kikan
        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);
            }
        }
コード例 #7
0
ファイル: NageSpace.cs プロジェクト: bunashibu/kikan
        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);
            }
        }
コード例 #8
0
ファイル: NageSpace.cs プロジェクト: bunashibu/kikan
        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());
            }
        }
コード例 #9
0
ファイル: MagicianZ.cs プロジェクト: moto2002/kikan
        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);
            }
        }