Esempio n. 1
0
 protected LevelManager()
 {
     this.ResetGlobalTimeScale();
     InLevelData.InitInLevelData();
     AvatarData.InitAvatarData();
     MonsterData.InitMonsterData();
     this.CreateInLevelManagers();
 }
Esempio n. 2
0
        public virtual LayerMask GetAbilityHitboxTargettingMask(uint ownerID, MixinTargetting targetting)
        {
            ushort    num;
            ushort    enemyCategory;
            LayerMask hitboxLayerMask;

            if ((ownerID == 0x21800001) || (Singleton <RuntimeIDManager> .Instance.ParseCategory(ownerID) == 7))
            {
                num           = 4;
                enemyCategory = 3;
            }
            else
            {
                num = Singleton <RuntimeIDManager> .Instance.ParseCategory(ownerID);

                enemyCategory = this.GetEnemyCategory(num);
            }
            if ((ownerID == 0x21800001) || (Singleton <RuntimeIDManager> .Instance.ParseCategory(ownerID) == 7))
            {
                num           = 4;
                enemyCategory = 3;
            }
            switch (targetting)
            {
            case MixinTargetting.None:
                return(0);

            case MixinTargetting.Allied:
                return(InLevelData.GetHitboxLayerMask(num));

            case MixinTargetting.Enemy:
                hitboxLayerMask = InLevelData.GetHitboxLayerMask(enemyCategory);
                if (num == 3)
                {
                    hitboxLayerMask |= ((int)1) << InLevelData.PROP_HITBOX_LAYER;
                }
                return(hitboxLayerMask);

            case MixinTargetting.All:
                hitboxLayerMask = InLevelData.GetHitboxLayerMask(num) | InLevelData.GetHitboxLayerMask(enemyCategory);
                if (num == 3)
                {
                    hitboxLayerMask |= ((int)1) << InLevelData.PROP_HITBOX_LAYER;
                }
                return(hitboxLayerMask);
            }
            return(0);
        }
Esempio n. 3
0
        protected override void Update()
        {
            AttackResult.HitCollsion collsion;
            base.Update();
            if (this._resetTimer != null)
            {
                this._resetTimer.Core(1f);
                if (this._resetTimer.isTimeUp)
                {
                    this._enteredIDs.Clear();
                    this._resetTimer.Reset(false);
                }
            }
            if (this._aliveTimer.isActive)
            {
                this._aliveTimer.Core(this.BulletTimeScale);
                if (this._aliveTimer.isTimeUp)
                {
                    EvtBulletHit evt = new EvtBulletHit(base._runtimeID)
                    {
                        ownerID = base.ownerID
                    };
                    collsion = new AttackResult.HitCollsion {
                        hitDir   = this.CreateHitForward(),
                        hitPoint = base.transform.position
                    };
                    evt.hitCollision = collsion;
                    evt.hitGround    = true;
                    evt.selfExplode  = true;
                    Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal);

                    this._aliveTimer.Reset(false);
                }
            }
            if (InLevelData.IsOutOfStage(this.XZPosition))
            {
                EvtBulletHit hit2 = new EvtBulletHit(base._runtimeID)
                {
                    ownerID = base.ownerID
                };
                collsion = new AttackResult.HitCollsion {
                    hitDir   = this.CreateHitForward(),
                    hitPoint = base.transform.position
                };
                hit2.hitCollision = collsion;
                Singleton <EventManager> .Instance.FireEvent(hit2, MPEventDispatchMode.Normal);
            }
            else if ((base.transform.position.y < 0.05f) && this._collisionEnabled)
            {
                EvtBulletHit hit3 = new EvtBulletHit(base._runtimeID)
                {
                    ownerID = base.ownerID
                };
                collsion = new AttackResult.HitCollsion {
                    hitDir   = this.CreateHitForward(),
                    hitPoint = base.transform.position
                };
                hit3.hitCollision = collsion;
                hit3.hitGround    = true;
                Singleton <EventManager> .Instance.FireEvent(hit3, MPEventDispatchMode.Normal);
            }
            else if (this._state == BulletState.Linear)
            {
                this.speed += (this.acceleration * Time.deltaTime) * this.BulletTimeScale;
                this._rigidbody.velocity = (Vector3)((this.speed * base.transform.forward) * this.BulletTimeScale);
            }
            else if (this._state == BulletState.TracePosition)
            {
                this._traceLerpCoef += (this._traceLerpCoefAcc * Time.deltaTime) * this.BulletTimeScale;
                Vector3 forward = base.transform.forward;
                Vector3 vector3 = this._targetPosition - this._rigidbody.position;
                if (vector3.magnitude >= this.targetReachThreshold)
                {
                    forward = Vector3.Normalize(this._targetPosition - this._rigidbody.position);
                    float num = Vector3.Angle(forward, base.transform.forward);
                    if (!this._passBy || (num < 90.0))
                    {
                        base.transform.forward = Vector3.Slerp(base.transform.forward, forward, (Time.deltaTime * this.BulletTimeScale) * this._traceLerpCoef);
                    }
                    this.speed += (this.acceleration * Time.deltaTime) * this.BulletTimeScale;
                    this._rigidbody.velocity = (Vector3)(((this.speed * base.transform.forward) + this.speedAdd) * this.BulletTimeScale);
                }
                else
                {
                    this._rigidbody.velocity = (Vector3)(base.transform.forward * 0f);
                    if (this._collisionEnabled)
                    {
                        EvtBulletHit hit4 = new EvtBulletHit(base._runtimeID)
                        {
                            ownerID = base.ownerID
                        };
                        collsion = new AttackResult.HitCollsion {
                            hitDir   = this.CreateHitForward(),
                            hitPoint = base.transform.position
                        };
                        hit4.hitCollision = collsion;
                        hit4.hitGround    = true;
                        Singleton <EventManager> .Instance.FireEvent(hit4, MPEventDispatchMode.Normal);
                    }
                }
            }
            else if (((this._state == BulletState.Placing) && (this._placingTimer != null)) && this._placingTimer.isActive)
            {
                this._placingTimer.Core(this.BulletTimeScale);
                if (!this._placingTimer.isTimeUp)
                {
                    base.transform.position  = Vector3.Slerp(this._originalPosition, this._placingPosition, this._placingTimer.timer / this._placingTimer.timespan);
                    this._collisionEnabled   = false;
                    this._collisionMask      = -1;
                    this._rigidbody.velocity = (Vector3)((this.speed * base.transform.forward) * this.BulletTimeScale);
                }
                else
                {
                    this._state = BulletState.TracePosition;
                    this._placingTimer.Reset(false);
                    this.speed             = this._resumeSpeed;
                    this._collisionEnabled = true;
                }
            }
        }