예제 #1
0
        private void SetHintArrowByScreenPos(MonoHintArrow arrow, BaseMonoEntity entity)
        {
            bool flag = (((entity != null) && entity.IsActive()) && !Singleton <AvatarManager> .Instance.IsLocalAvatar(entity.GetRuntimeID())) && !Singleton <CameraManager> .Instance.GetMainCamera().IsEntityVisible(entity);

            bool isArrowVisibleBefore = (arrow.state == MonoHintArrow.State.Visible) || (arrow.state == MonoHintArrow.State.FadingIn);
            bool flag3 = (entity == null) || entity.IsToBeRemove();

            if ((arrow.state == MonoHintArrow.State.Hidden) && flag3)
            {
                UnityEngine.Object.Destroy(arrow.gameObject);
            }
            else if (isArrowVisibleBefore && !flag)
            {
                arrow.SetVisible(false);
                if (flag3)
                {
                    arrow.SetDestroyUponFadeOut();
                }
            }
            else if (!isArrowVisibleBefore && flag)
            {
                arrow.SetVisible(true);
            }
            if (flag)
            {
                this.UpdateHintArrow(arrow.transform, entity.XZPosition, isArrowVisibleBefore);
            }
        }
예제 #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (((this._collisionMask.value & (((int)1) << other.gameObject.layer)) != 0) && this._collisionEnabled)
     {
         BaseMonoEntity componentInParent = other.GetComponentInParent <BaseMonoEntity>();
         if (Singleton <RuntimeIDManager> .Instance.ParseCategory(componentInParent.GetRuntimeID()) == 4)
         {
             if (this._enteredIDs.Contains(componentInParent.GetRuntimeID()))
             {
                 return;
             }
         }
         else if (!componentInParent.IsActive() || this._enteredIDs.Contains(componentInParent.GetRuntimeID()))
         {
             return;
         }
         BaseMonoEntity owner = componentInParent;
         if (componentInParent is BaseMonoDynamicObject)
         {
             BaseMonoDynamicObject obj2 = (BaseMonoDynamicObject)componentInParent;
             if ((obj2.dynamicType == BaseMonoDynamicObject.DynamicType.EvadeDummy) && (obj2.owner != null))
             {
                 this._enteredIDs.Add(obj2.owner.GetRuntimeID());
             }
         }
         else if (componentInParent is MonoBodyPartEntity)
         {
             owner = ((MonoBodyPartEntity)componentInParent).owner;
         }
         if (!(owner is BaseMonoAbilityEntity) || !((BaseMonoAbilityEntity)owner).isGhost)
         {
             this._enteredIDs.Add(owner.GetRuntimeID());
             EvtBulletHit evt = new EvtBulletHit(base._runtimeID, owner.GetRuntimeID())
             {
                 ownerID = base.ownerID
             };
             Vector3 position = base.transform.position - ((Vector3)((Time.deltaTime * this.BulletTimeScale) * this._rigidbody.velocity));
             AttackResult.HitCollsion collsion = new AttackResult.HitCollsion {
                 hitPoint = other.ClosestPointOnBounds(position),
                 hitDir   = this.CreateHitForward()
             };
             evt.hitCollision = collsion;
             Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal);
         }
     }
 }
예제 #3
0
        private BaseFollowBaseState GetTargetBaseState(bool checkHasAnyControl, BaseMonoEntity attackTarget = null)
        {
            bool flag = false;

            if (this.lastBaseState == this.followAvatarAndBossState)
            {
                BaseMonoEntity bossTarget = ((FollowAvatarAndBossState)this.lastBaseState).bossTarget;
                if ((bossTarget != null) && bossTarget.IsActive())
                {
                    this.followAvatarAndBossState.bossTarget = bossTarget;
                    return(this.followAvatarAndBossState);
                }
                flag = true;
            }
            else
            {
                if (this.lastBaseState == this.followAvatarAndCrowdState)
                {
                    return(this.followAvatarAndCrowdState);
                }
                flag = true;
            }
            if (flag)
            {
                if ((attackTarget != null) && attackTarget.IsActive())
                {
                    return(this.followAvatarAndTargetState);
                }
                if (this.avatar.IsLockDirection)
                {
                    this.followAvatarAndTargetState.SwitchMode(FollowAvatarAndTargetState.FollowMode.DirectionMode);
                }
                if (checkHasAnyControl)
                {
                    if (this.avatar.GetActiveControlData().hasAnyControl)
                    {
                        return(this.followAvatarState);
                    }
                }
                else
                {
                    return(this.followAvatarState);
                }
            }
            return(null);
        }
예제 #4
0
 private void OnTriggerEnter(Collider other)
 {
     if ((this._collisionMask.value & (((int)1) << other.gameObject.layer)) != 0)
     {
         BaseMonoEntity componentInParent = other.GetComponentInParent <BaseMonoEntity>();
         if (Singleton <RuntimeIDManager> .Instance.ParseCategory(componentInParent.GetRuntimeID()) == 4)
         {
             if (this._enteredIDs.Contains(componentInParent.GetRuntimeID()))
             {
                 return;
             }
         }
         else if (!componentInParent.IsActive() || this._enteredIDs.Contains(componentInParent.GetRuntimeID()))
         {
             return;
         }
         if (componentInParent is MonoDummyDynamicObject)
         {
             BaseMonoDynamicObject obj2 = (BaseMonoDynamicObject)componentInParent;
             if ((obj2.dynamicType == BaseMonoDynamicObject.DynamicType.EvadeDummy) && (obj2.owner != null))
             {
                 this._enteredIDs.Add(obj2.owner.GetRuntimeID());
             }
         }
         this._enteredIDs.Add(componentInParent.GetRuntimeID());
         this.OnEntityEntered(other, componentInParent);
         if (this._stopOnFirstContact)
         {
             this._animation.Stop();
             this._rigidbody.detectCollisions = false;
         }
         if (this.triggerEnterCallback != null)
         {
             if (this._follow)
             {
                 base.StartCoroutine(this.WaitEndOfFrameTriggerHit(other, componentInParent));
             }
             else
             {
                 this.FireTriggerCallback(other, componentInParent);
             }
         }
     }
 }
예제 #5
0
        protected virtual void OnEffectiveTriggerEnter(Collider other)
        {
            for (int i = 0; i < this._insideColliders.Count; i++)
            {
                if (((this._insideColliders[i] != null) && (this._insideColliders[i].Item1 != null)) && (this._insideColliders[i].Item1.gameObject == other.gameObject))
                {
                    return;
                }
            }
            BaseMonoEntity componentInParent = other.GetComponentInParent <BaseMonoEntity>();

            if ((componentInParent != null) && componentInParent.IsActive())
            {
                Singleton <EventManager> .Instance.FireEvent(new EvtFieldEnter(base._runtimeID, componentInParent.GetRuntimeID()), MPEventDispatchMode.Normal);

                int num2 = this._insideColliders.SeekAddPosition <Tuple <Collider, uint> >();
                this._insideColliders[num2] = Tuple.Create <Collider, uint>(other, componentInParent.GetRuntimeID());
            }
        }
        protected BaseMonoEntity SelectTarget()
        {
            List <BaseMonoMonster> allMonsters = Singleton <MonsterManager> .Instance.GetAllMonsters();

            BaseMonoEntity entity   = null;
            float          maxValue = float.MaxValue;

            for (int i = 0; i < allMonsters.Count; i++)
            {
                BaseMonoMonster monster = allMonsters[i];
                if (monster.IsActive() && !monster.denySelect)
                {
                    List <BaseMonoAbilityEntity> allHitboxEnabledBodyParts = monster.GetAllHitboxEnabledBodyParts();
                    if (allHitboxEnabledBodyParts.Count > 0)
                    {
                        foreach (BaseMonoAbilityEntity entity2 in allHitboxEnabledBodyParts)
                        {
                            float num3 = Miscs.DistancForVec3IgnoreY(entity2.XZPosition, this._avatar.XZPosition);
                            if ((!this.hasDistanceLimit || ((num3 >= this.minDistance) && (num3 <= this.maxDistance))) && (num3 < maxValue))
                            {
                                maxValue = num3;
                                entity   = entity2;
                            }
                        }
                    }
                    else
                    {
                        float num4 = Miscs.DistancForVec3IgnoreY(monster.XZPosition, this._avatar.XZPosition);
                        if ((!this.hasDistanceLimit || ((num4 >= this.minDistance) && (num4 <= this.maxDistance))) && (num4 < maxValue))
                        {
                            maxValue = num4;
                            entity   = monster;
                        }
                    }
                }
            }
            if ((entity != null) && entity.IsActive())
            {
                return(entity);
            }
            return(null);
        }
예제 #7
0
        private bool OnFieldHit(EvtFieldHit evt)
        {
            for (int i = 0; i < this._triggerFieldPlugin.insideIDs.Count; i++)
            {
                uint           runtimeID = this._triggerFieldPlugin.insideIDs[i];
                BaseMonoEntity entity    = Singleton <EventManager> .Instance.GetEntity(runtimeID);

                if (entity != null)
                {
                    if (!entity.IsActive())
                    {
                        this._triggerFieldPlugin.insideIDs.Remove(runtimeID);
                    }
                    else
                    {
                        Singleton <EventManager> .Instance.FireEvent(new EvtHittingOther(base.runtimeID, this._triggerFieldPlugin.insideIDs[i], evt.animEventID), MPEventDispatchMode.Normal);
                    }
                }
            }
            return(true);
        }
예제 #8
0
 private void OnAvatarAttackTargetChanged(BaseMonoEntity attackTarget)
 {
     if (this._baseState == this.followAvatarControlledRotate)
     {
         this.TryToTransitToOtherBaseState(false, attackTarget);
     }
     else if (((attackTarget != null) && attackTarget.IsActive()) && (this._baseState == this.followAvatarState))
     {
         this.TransitBaseState(this.followAvatarAndTargetState, false);
     }
     else if (attackTarget == null)
     {
         if (this.avatar.IsLockDirection)
         {
             this.followAvatarAndTargetState.SwitchMode(FollowAvatarAndTargetState.FollowMode.DirectionMode);
         }
         else
         {
             this.TransitBaseState(this.followAvatarState, false);
         }
     }
 }
예제 #9
0
 private void OnTriggerEnter(Collider other)
 {
     if ((this._collisionMask.value & (((int)1) << other.gameObject.layer)) != 0)
     {
         BaseMonoEntity componentInParent = other.GetComponentInParent <BaseMonoEntity>();
         if (componentInParent.IsActive() && !this._enteredIDs.Contains(componentInParent.GetRuntimeID()))
         {
             if (componentInParent is MonoDummyDynamicObject)
             {
                 BaseMonoDynamicObject obj2 = (BaseMonoDynamicObject)componentInParent;
                 if ((obj2.dynamicType == BaseMonoDynamicObject.DynamicType.EvadeDummy) && (obj2.owner != null))
                 {
                     this._enteredIDs.Add(obj2.owner.GetRuntimeID());
                 }
             }
             this._enteredIDs.Add(componentInParent.GetRuntimeID());
             if (this.triggerEnterCallback != null)
             {
                 this.triggerEnterCallback(other);
             }
         }
     }
 }
예제 #10
0
        public override TaskStatus OnUpdate()
        {
            BaseMonoEntity attackTarget = this._entity.GetAttackTarget();

            if ((attackTarget != null) && attackTarget.IsActive())
            {
                if (attackTarget is BaseMonoAvatar)
                {
                    BaseMonoAvatar avatar = (BaseMonoAvatar)attackTarget;
                    if (avatar.IsAnimatorInTag(AvatarData.AvatarTagGroup.AttackOrSkill) && !avatar.IsAnimatorInTag(AvatarData.AvatarTagGroup.AttackWithNoTarget))
                    {
                        return(TaskStatus.Success);
                    }
                    return(TaskStatus.Failure);
                }
                if (attackTarget is BaseMonoMonster)
                {
                    BaseMonoMonster monster = (BaseMonoMonster)attackTarget;
                    return(!monster.isGoingToAttack(0.5f) ? TaskStatus.Failure : TaskStatus.Success);
                }
            }
            return(TaskStatus.Failure);
        }
예제 #11
0
        public static void TestAndActHit(string attackName, ConfigEntityAttackPattern patternConfig, IAttacker attacker, List <CollisionResult> results)
        {
            AttackResult.HitCollsion collsion4;
            List <CollisionResult>   list = FilterRealAttackeesByBodyParts(attackName, patternConfig, attacker, results);

            switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(attacker.GetRuntimeID()))
            {
            case 3:
                foreach (CollisionResult result in list)
                {
                    BaseMonoEntity entity = result.entity;
                    if (((entity != null) && (entity.GetRuntimeID() != attacker.GetRuntimeID())) && (entity.IsActive() || (Singleton <RuntimeIDManager> .Instance.ParseCategory(entity.GetRuntimeID()) == 4)))
                    {
                        switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(entity.GetRuntimeID()))
                        {
                        case 3:
                        case 4:
                        case 6:
                        case 7:
                            if (Singleton <LevelManager> .Instance.gameMode.IsEnemy(attacker.GetRuntimeID(), entity.GetRuntimeID()))
                            {
                                goto Label_0103;
                            }
                            break;
                        }
                    }
                    continue;
Label_0103:
                    collsion4          = new AttackResult.HitCollsion();
                    collsion4.hitDir   = result.hitForward;
                    collsion4.hitPoint = result.hitPoint;
                    AttackResult.HitCollsion hitCollision = collsion4;
                    SendHitEvent(attacker.GetRuntimeID(), entity.GetRuntimeID(), attackName, hitCollision, null, false, MPEventDispatchMode.CheckRemoteMode);
                }
                return;

            case 4:
                foreach (CollisionResult result2 in list)
                {
                    BaseMonoEntity entity2 = result2.entity;
                    if (((entity2 != null) && (entity2.GetRuntimeID() != attacker.GetRuntimeID())) && entity2.IsActive())
                    {
                        switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(entity2.GetRuntimeID()))
                        {
                        case 3:
                        case 4:
                        case 6:
                            if (Singleton <LevelManager> .Instance.gameMode.IsEnemy(attacker.GetRuntimeID(), entity2.GetRuntimeID()))
                            {
                                goto Label_021F;
                            }
                            break;
                        }
                    }
                    continue;
Label_021F:
                    collsion4          = new AttackResult.HitCollsion();
                    collsion4.hitDir   = result2.hitForward;
                    collsion4.hitPoint = result2.hitPoint;
                    AttackResult.HitCollsion collsion2 = collsion4;
                    SendHitEvent(attacker.GetRuntimeID(), entity2.GetRuntimeID(), attackName, collsion2, null, false, MPEventDispatchMode.CheckRemoteMode);
                }
                return;

            case 7:
                foreach (CollisionResult result3 in list)
                {
                    BaseMonoEntity entity3 = result3.entity;
                    if (((entity3 != null) && (entity3.GetRuntimeID() != attacker.GetRuntimeID())) && entity3.IsActive())
                    {
                        switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(entity3.GetRuntimeID()))
                        {
                        case 3:
                        case 4:
                        case 6:
                            if (Singleton <LevelManager> .Instance.gameMode.IsEnemy(attacker.GetRuntimeID(), entity3.GetRuntimeID()))
                            {
                                goto Label_033F;
                            }
                            break;
                        }
                    }
                    continue;
Label_033F:
                    collsion4          = new AttackResult.HitCollsion();
                    collsion4.hitDir   = result3.hitForward;
                    collsion4.hitPoint = result3.hitPoint;
                    AttackResult.HitCollsion collsion3 = collsion4;
                    SendHitEvent(attacker.GetRuntimeID(), entity3.GetRuntimeID(), attackName, collsion3, null, false, MPEventDispatchMode.CheckRemoteMode);
                }
                return;
            }
            throw new Exception("Invalid Type or State!");
        }