// Token: 0x06001E6E RID: 7790 RVA: 0x0008FA40 File Offset: 0x0008DC40
 public void OnClientProjectileReceived(ProjectileController projectile)
 {
     if (projectile.predictionId != 0 && projectile.hasAuthority)
     {
         this.predictionManager.OnAuthorityProjectileReceived(projectile);
     }
 }
            // Token: 0x06001E7D RID: 7805 RVA: 0x0008FE70 File Offset: 0x0008E070
            public void ReleasePredictionId(ushort predictionId)
            {
                ProjectileController projectileController = this.predictions[predictionId];

                this.predictions.Remove(predictionId);
                if (projectileController && projectileController.gameObject)
                {
                    UnityEngine.Object.Destroy(projectileController.gameObject);
                }
            }
 // Token: 0x06001E6D RID: 7789 RVA: 0x0008FA14 File Offset: 0x0008DC14
 public void OnServerProjectileDestroyed(ProjectileController projectile)
 {
     if (projectile.predictionId != 0)
     {
         NetworkConnection clientAuthorityOwner = projectile.clientAuthorityOwner;
         if (clientAuthorityOwner != null)
         {
             this.ReleasePredictionId(clientAuthorityOwner, projectile.predictionId);
         }
     }
 }
            // Token: 0x06001E7C RID: 7804 RVA: 0x0008FE14 File Offset: 0x0008E014
            public void OnAuthorityProjectileReceived(ProjectileController authoritativeProjectile)
            {
                ProjectileController projectileController;

                if (authoritativeProjectile.hasAuthority && authoritativeProjectile.predictionId != 0 && this.predictions.TryGetValue(authoritativeProjectile.predictionId, out projectileController))
                {
                    authoritativeProjectile.ghost = projectileController.ghost;
                    if (authoritativeProjectile.ghost)
                    {
                        authoritativeProjectile.ghost.authorityTransform = authoritativeProjectile.transform;
                    }
                }
            }
Example #5
0
 // Token: 0x06001EA3 RID: 7843 RVA: 0x00090934 File Offset: 0x0008EB34
 private void Awake()
 {
     if (NetworkServer.active)
     {
         this.projectileController = base.GetComponent <ProjectileController>();
         ProjectileController projectileController = this.projectileController;
         this.teamFilter       = ((projectileController != null) ? projectileController.teamFilter : null);
         this.projectileDamage = base.GetComponent <ProjectileDamage>();
         this.attackTimer      = 0f;
         this.previousTargets  = new List <HealthComponent>();
         return;
     }
     base.enabled = false;
 }
        // Token: 0x06001E6C RID: 7788 RVA: 0x0008F9C8 File Offset: 0x0008DBC8
        private void FireProjectileServer(FireProjectileInfo fireProjectileInfo, NetworkConnection clientAuthorityOwner = null, ushort predictionId = 0, double fastForwardTime = 0.0)
        {
            GameObject           gameObject = UnityEngine.Object.Instantiate <GameObject>(fireProjectileInfo.projectilePrefab, fireProjectileInfo.position, fireProjectileInfo.rotation);
            ProjectileController component  = gameObject.GetComponent <ProjectileController>();

            component.NetworkpredictionId = predictionId;
            ProjectileManager.InitializeProjectile(component, fireProjectileInfo);
            if (clientAuthorityOwner != null)
            {
                NetworkServer.SpawnWithClientAuthority(gameObject, clientAuthorityOwner);
                return;
            }
            NetworkServer.Spawn(gameObject);
        }
        // Token: 0x06001E6B RID: 7787 RVA: 0x0008F888 File Offset: 0x0008DA88
        private static void InitializeProjectile(ProjectileController projectileController, FireProjectileInfo fireProjectileInfo)
        {
            GameObject                 gameObject = projectileController.gameObject;
            ProjectileDamage           component  = gameObject.GetComponent <ProjectileDamage>();
            TeamFilter                 component2 = gameObject.GetComponent <TeamFilter>();
            ProjectileNetworkTransform component3 = gameObject.GetComponent <ProjectileNetworkTransform>();
            MissileController          component4 = gameObject.GetComponent <MissileController>();
            ProjectileSimple           component5 = gameObject.GetComponent <ProjectileSimple>();

            projectileController.Networkowner  = fireProjectileInfo.owner;
            projectileController.procChainMask = fireProjectileInfo.procChainMask;
            if (component2)
            {
                component2.teamIndex = TeamComponent.GetObjectTeam(fireProjectileInfo.owner);
            }
            if (component3)
            {
                component3.SetValuesFromTransform();
            }
            if (component4)
            {
                component4.target = (fireProjectileInfo.target ? fireProjectileInfo.target.transform : null);
            }
            if (fireProjectileInfo.useSpeedOverride && component5)
            {
                component5.velocity = fireProjectileInfo.speedOverride;
            }
            if (fireProjectileInfo.useFuseOverride)
            {
                ProjectileImpactExplosion component6 = gameObject.GetComponent <ProjectileImpactExplosion>();
                if (component6)
                {
                    component6.lifetime = fireProjectileInfo.fuseOverride;
                }
                ProjectileFuse component7 = gameObject.GetComponent <ProjectileFuse>();
                if (component7)
                {
                    component7.fuse = fireProjectileInfo.fuseOverride;
                }
            }
            if (component)
            {
                component.damage           = fireProjectileInfo.damage;
                component.force            = fireProjectileInfo.force;
                component.crit             = fireProjectileInfo.crit;
                component.damageColorIndex = fireProjectileInfo.damageColorIndex;
            }
        }
Example #8
0
 // Token: 0x06001E11 RID: 7697 RVA: 0x0008DA18 File Offset: 0x0008BC18
 public void OnCollisionEnter(Collision collision)
 {
     if (NetworkServer.active || this.isPrediction)
     {
         ContactPoint[]       contacts   = collision.contacts;
         ProjectileImpactInfo impactInfo = new ProjectileImpactInfo
         {
             collider = collision.collider,
             estimatedPointOfImpact = ProjectileController.EstimateContactPoint(contacts, collision.collider),
             estimatedImpactNormal  = ProjectileController.EstimateContactNormal(contacts)
         };
         IProjectileImpactBehavior[] components = base.GetComponents <IProjectileImpactBehavior>();
         for (int i = 0; i < components.Length; i++)
         {
             components[i].OnProjectileImpact(impactInfo);
         }
     }
 }
        // Token: 0x06001E6A RID: 7786 RVA: 0x0008F6F8 File Offset: 0x0008D8F8
        private void FireProjectileClient(FireProjectileInfo fireProjectileInfo, NetworkClient client)
        {
            int num = this.FindProjectilePrefabIndex(fireProjectileInfo.projectilePrefab);

            if (num == -1)
            {
                Debug.LogErrorFormat(fireProjectileInfo.projectilePrefab, "Prefab {0} is not a registered projectile prefab.", new object[]
                {
                    fireProjectileInfo.projectilePrefab
                });
                return;
            }
            bool   allowPrediction = ProjectileManager.projectilePrefabProjectileControllers[num].allowPrediction;
            ushort predictionId    = 0;

            if (allowPrediction)
            {
                ProjectileController component = UnityEngine.Object.Instantiate <GameObject>(fireProjectileInfo.projectilePrefab, fireProjectileInfo.position, fireProjectileInfo.rotation).GetComponent <ProjectileController>();
                ProjectileManager.InitializeProjectile(component, fireProjectileInfo);
                this.predictionManager.RegisterPrediction(component);
                predictionId = component.predictionId;
            }
            this.fireMsg.sendTime         = (double)Run.instance.time;
            this.fireMsg.prefabIndex      = (byte)num;
            this.fireMsg.position         = fireProjectileInfo.position;
            this.fireMsg.rotation         = fireProjectileInfo.rotation;
            this.fireMsg.owner            = fireProjectileInfo.owner;
            this.fireMsg.predictionId     = predictionId;
            this.fireMsg.damage           = fireProjectileInfo.damage;
            this.fireMsg.force            = fireProjectileInfo.force;
            this.fireMsg.crit             = fireProjectileInfo.crit;
            this.fireMsg.damageColorIndex = fireProjectileInfo.damageColorIndex;
            this.fireMsg.speedOverride    = fireProjectileInfo.speedOverride;
            this.fireMsg.fuseOverride     = fireProjectileInfo.fuseOverride;
            this.fireMsg.target           = HurtBoxReference.FromRootObject(fireProjectileInfo.target);
            NetworkWriter networkWriter = new NetworkWriter();

            networkWriter.StartMessage(49);
            networkWriter.Write(this.fireMsg);
            networkWriter.FinishMessage();
            client.SendWriter(networkWriter, 0);
        }
 // Token: 0x06001E7C RID: 7804 RVA: 0x0008390C File Offset: 0x00081B0C
 private void Update()
 {
     this.timer          += Time.deltaTime;
     this.nextSpawnTimer += Time.deltaTime;
     if (this.timer >= this.duration)
     {
         UnityEngine.Object.Destroy(base.gameObject);
     }
     if (this.nextSpawnTimer >= this.duration / (float)this.count)
     {
         this.nextSpawnTimer -= this.duration / (float)this.count;
         GameObject           gameObject = UnityEngine.Object.Instantiate <GameObject>(this.childProjectilePrefab, base.transform.position, Util.QuaternionSafeLookRotation(base.transform.forward));
         ProjectileController component  = gameObject.GetComponent <ProjectileController>();
         if (component)
         {
             component.procChainMask   = this.projectileController.procChainMask;
             component.procCoefficient = this.projectileController.procCoefficient * this.childProcCoefficient;
             component.Networkowner    = this.projectileController.owner;
         }
         gameObject.GetComponent <TeamFilter>().teamIndex = base.GetComponent <TeamFilter>().teamIndex;
         ProjectileDamage component2 = gameObject.GetComponent <ProjectileDamage>();
         if (component2)
         {
             component2.damage           = this.projectileDamage.damage * this.childDamageCoefficient;
             component2.crit             = this.projectileDamage.crit;
             component2.force            = this.projectileDamage.force;
             component2.damageColorIndex = this.projectileDamage.damageColorIndex;
         }
         if (!this.ignoreParentForChainController)
         {
             ChainController component3 = gameObject.GetComponent <ChainController>();
             if (component3)
             {
                 component3.pastTargetList.Add(base.transform.parent);
             }
         }
         NetworkServer.Spawn(gameObject);
     }
 }
Example #11
0
        // Token: 0x06001E47 RID: 7751 RVA: 0x0008EBE0 File Offset: 0x0008CDE0
        private void FireChild(Vector3 direction)
        {
            GameObject           gameObject = UnityEngine.Object.Instantiate <GameObject>(this.childrenProjectilePrefab, base.transform.position, Util.QuaternionSafeLookRotation(direction));
            ProjectileController component  = gameObject.GetComponent <ProjectileController>();

            if (component)
            {
                component.procChainMask   = this.projectileController.procChainMask;
                component.procCoefficient = this.projectileController.procCoefficient;
                component.Networkowner    = this.projectileController.owner;
            }
            gameObject.GetComponent <TeamFilter>().teamIndex = base.GetComponent <TeamFilter>().teamIndex;
            ProjectileDamage component2 = gameObject.GetComponent <ProjectileDamage>();

            if (component2)
            {
                component2.damage           = this.projectileDamage.damage * this.childrenDamageCoefficient;
                component2.crit             = this.projectileDamage.crit;
                component2.force            = this.projectileDamage.force;
                component2.damageColorIndex = this.projectileDamage.damageColorIndex;
            }
            NetworkServer.Spawn(gameObject);
        }
 // Token: 0x06001E7E RID: 7806 RVA: 0x0008FEB7 File Offset: 0x0008E0B7
 public void RegisterPrediction(ProjectileController predictedProjectile)
 {
     predictedProjectile.NetworkpredictionId            = this.RequestPredictionId();
     this.predictions[predictedProjectile.predictionId] = predictedProjectile;
     predictedProjectile.isPrediction = true;
 }