Ejemplo n.º 1
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var inputDepsA = new AutoExplosionByRaycastJob
            {
                OnDestroyMessage = typeof(OnDestroyMessage),
                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }.Schedule(this, inputDeps);

            var inputDepsB = new AutoExplosionByAngleJob
            {
                OnDestroyMessage = typeof(OnDestroyMessage),
                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }.Schedule(this, inputDeps);

            var inputDepsC = new AutoExplosionByTouchJob
            {
                OnDestroyMessage = typeof(OnDestroyMessage),
                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }.Schedule(this, inputDeps);

            var ds = JobHandle.CombineDependencies(inputDepsA, inputDepsB, inputDepsC);

            endBarrier.AddJobHandleForProducer(ds);

            return(ds);
        }
Ejemplo n.º 2
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var actorOwnerFromEntity       = GetComponentDataFromEntity <ActorOwner>(true);
            var playerActorArrayFromEntity = GetComponentDataFromEntity <PlayerActorArray>();
            var slotFromEntity             = GetComponentDataFromEntity <Slot>(true);

            inputDeps = new WeaponUninstallJob
            {
                actorOwnerFromEntity       = actorOwnerFromEntity,
                playerActorArrayFromEntity = playerActorArrayFromEntity,
                slotFromEntity             = slotFromEntity,
            }
            .ScheduleSingle(this, inputDeps);

            inputDeps = new WeaponInstallJob
            {
                actorOwnerFromEntity       = actorOwnerFromEntity,
                playerActorArrayFromEntity = playerActorArrayFromEntity,
                slotFromEntity             = slotFromEntity,
            }
            .ScheduleSingle(this, inputDeps);


            inputDeps = new ShipDestroyMessageJob
            {
                Player_OnShipDestroy_NextFrameMessage = typeof(Player_OnShipDestroyMessage),
                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDeps);

            endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Ejemplo n.º 3
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            inputDeps = new FireInputJob
            {
                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDeps);

            endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Ejemplo n.º 4
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            inputDeps = new LifetimeJob
            {
                fixedDeltaTime   = Time.fixedDeltaTime,
                OnDestroyMessage = typeof(OnDestroyMessage),
                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDeps);

            endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Ejemplo n.º 5
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            inputDeps = new WeaponUninstallJob
            {
                SlotUsingState = typeof(SlotUsingState),

                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDeps);

            endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Ejemplo n.º 6
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            inputDeps = new AMJob
            {
                hpModifyFromEntity = GetBufferFromEntity <ActorAttribute3Modifys <_HP> >(),

                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .ScheduleSingle(this, inputDeps);

            endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Ejemplo n.º 7
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            if (zeroToActorDeath)
            {
                if (modifyHandleType == ModifyHandleType.Sample)
                {
                    inputDeps = new SampleAttribute3ModifysAndZeroToActorDeathJob
                    {
                        OnDestroyMessage = typeof(OnDestroyMessage),
                        endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
                    }
                    .Schedule(this, inputDeps);
                }
                else if (modifyHandleType == ModifyHandleType.Default)
                {
                    inputDeps = new Attribute3ModifysAndZeroToActorDeathJob
                    {
                        OnDestroyMessage = typeof(OnDestroyMessage),
                        endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
                    }
                    .Schedule(this, inputDeps);
                }

                endBarrier.AddJobHandleForProducer(inputDeps);
            }
            else
            {
                if (modifyHandleType == ModifyHandleType.Sample)
                {
                    inputDeps = new SampleAttribute3ModifysJob {
                    }.Schedule(this, inputDeps);
                }
                else if (modifyHandleType == ModifyHandleType.Default)
                {
                    inputDeps = new Attribute3ModifysJob {
                    }.Schedule(this, inputDeps);
                }
            }

            if (regainEnable)
            {
                inputDeps = new Attribute3RegainJob
                {
                    fixedDeltaTime = Time.fixedDeltaTime,
                }
                .Schedule(this, inputDeps);
            }

            return(inputDeps);
        }
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            inputDeps = new WeaponByShipDestroyJob
            {
                OnDestroyMessage = typeof(OnDestroyMessage),
                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDeps);



            endBarrier.AddJobHandleForProducer(inputDeps);
            return inputDeps;
        }
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            inputDeps = new AMJob
            {
                random = new Unity.Mathematics.Random((uint)UnityEngine.Random.Range(1, int.MaxValue)),
                translationFromEntity = GetComponentDataFromEntity <Translation>(true),
                hpModifyFromEntity    = GetBufferFromEntity <ActorAttribute3Modifys <_HP> >(),

                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .ScheduleSingle(this, inputDeps);

            endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Ejemplo n.º 10
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            inputDeps = new PhysicsTriggerFxJob
            {
                withoutBullet         = withoutBullet,
                bulletFromEntity      = GetComponentDataFromEntity <Bullet>(true),
                translationFromEntity = GetComponentDataFromEntity <Translation>(true),

                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDeps);

            endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Ejemplo n.º 11
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            //
            var inputDepsA = new PowerLevelJob
            {
            }
            .Schedule(this, inputDeps);


            //
            var inputDepsB = new DisableInputTimeJob
            {
                fixedDeltaTime        = Time.fixedDeltaTime,
                ShipDisableInputState = typeof(ShipLostInputState),
                endCommandBuffer      = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDeps);


            //
            inputDepsA = new ActorAttribute3ServerSystem <_Power> .SampleAttribute3ModifysJob
            {
            }
            .Schedule(this, inputDepsA);

            //
            inputDepsA = new DisableInputJob
            {
                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDepsA);

            //
            inputDepsA = new PowerRegainJob
            {
                fixedDeltaTime = Time.fixedDeltaTime,
            }
            .Schedule(this, inputDepsA);

            //
            inputDeps = JobHandle.CombineDependencies(inputDepsA, inputDepsB);
            endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Ejemplo n.º 12
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            //
            inputDeps = new CloseJob
            {
                commandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
                driver        = driver,
            }
            .ScheduleSingle(this, inputDeps);


            //
            inputDeps = _driver.ScheduleUpdate(inputDeps);


            //
            if (_listening)
            {
                inputDeps = new AcceptJob()
                {
                    NetworkInBuffer            = typeof(NetworkInBuffer),
                    NetworkReliableOutBuffer   = typeof(NetworkReliableOutBuffer),
                    NetworkUnreliableOutBuffer = typeof(NetworkUnreliableOutBuffer),
                    endCommandBuffer           = endBarrier.CreateCommandBuffer(),
                    driver = _driver,
                }
                .Schedule(inputDeps);


#if UNITY_EDITOR
                OnRename();
#endif
            }
            else if (connectEntity != Entity.Null)
            {
                OnClose();
            }


            endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Ejemplo n.º 13
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            //
            if (enterGameQuery.IsEmptyIgnoreFilter == false)
            {
                //var endCommandBuffer = endBarrier.CreateCommandBuffer();
                using (var enterGamePlayerEntitys = enterGameQuery.ToEntityArray(Allocator.TempJob))
                {
                    for (var i = 0; i < enterGamePlayerEntitys.Length; ++i)
                    {
                        EntityManager.AddComponentData(enterGamePlayerEntitys[i], new PlayerGameReady {
                            countdown = gameReadyTime
                        });
                        //endCommandBuffer.AddComponent(enterGamePlayerEntitys[i], new PlayerGameReady { countdown = gameReadyTime });
                    }
                }
            }


            //
            inputDeps = new FindGameReadyPlayerJob
            {
                gameReadyTime = gameReadyTime,
            }
            .Schedule(this, inputDeps);


            //
            inputDeps = new GameReadyCountdownJob
            {
                gameReadyTime  = gameReadyTime,
                fixedDeltaTime = Time.fixedDeltaTime,

                PlayerGameStartNetMessage = typeof(PlayerGameStartNetMessage),

                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDeps);

            endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Ejemplo n.º 14
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            inputDeps = new ShieldControlJobA
            {
                weaponInstalledStateFromEntity = GetComponentDataFromEntity <WeaponInstalledState>(true),
                weaponRotationFromEntity       = GetComponentDataFromEntity <Rotation>(true),

                OnDestroyMessage = typeof(OnDestroyMessage),
                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDeps);

            inputDeps = new ShieldControlJobB
            {
            }
            .Schedule(this, inputDeps);

            endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Ejemplo n.º 15
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            //enter Game
            if (enterGameQuery.IsEmptyIgnoreFilter == false)
            {
                EntityManager.AddComponent <PlayerActorArray>(enterGameQuery);
            }


            //quit Game
            inputDeps = new QuitGameJob
            {
                //PlayerActorArray = typeof(PlayerActorArray),
                OnDestroyMessage = typeof(OnDestroyMessage),
                endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDeps);

            endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Ejemplo n.º 16
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var inputDepsA = new WeaponUninstallJobA
            {
                //uninstallInputTimeScale = uninstallInputTimeScale,
                //endCommandBuffer = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDeps);

            var inputDepsB = new WeaponUninstallJobB
            {
                WeaponInstalledState = typeof(WeaponInstalledState),
                OnDestroyMessage     = typeof(OnDestroyMessage),
                endCommandBuffer     = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDeps);

            var inputDepsAB = JobHandle.CombineDependencies(inputDepsA, inputDepsB);

            endBarrier.AddJobHandleForProducer(inputDepsAB);

            var inputDepsC = new WeaponUninstallJobC
            {
                uninstallForce = uninstallForce,
            }
            .Schedule(this, inputDeps);

            var inputDepsD = new WeaponUninstallJobD
            {
                uninstallTorque = uninstallTorque,
            }
            .Schedule(this, inputDeps);


            inputDeps = JobHandle.CombineDependencies(inputDepsAB, inputDepsC, inputDepsD);
            return(inputDeps);
        }
Ejemplo n.º 17
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            //EnterGameMessage
            if (enterGameQuery.IsEmptyIgnoreFilter == false)
            {
                var enterGamePlayerEntitys = enterGameQuery.ToEntityArray(Allocator.TempJob, out var arrayJobA);
                using (var networkIds = enterGameQuery.ToComponentDataArray <NetworkId>(Allocator.TempJob, out var arrayJobB))
                {
                    var enterGamePlayers = new NativeArray <Player>(enterGamePlayerEntitys.Length, Allocator.TempJob);

                    //
                    JobHandle.CompleteAll(ref arrayJobA, ref arrayJobB);
                    for (var i = 0; i < enterGamePlayerEntitys.Length; ++i)
                    {
                        var player = new Player {
                            id = networkIds[i].value
                        };
                        enterGamePlayers[i] = player;

                        EntityManager.AddComponentData(enterGamePlayerEntitys[i], enterGamePlayers[i]);
                    }


                    //
                    inputDeps = new EnterGamePlayer2AllPlayerJob
                    {
                        enterGamePlayerEntitys = enterGamePlayerEntitys,
                        enterGamePlayers       = enterGamePlayers,
                    }
                    .Schedule(this, inputDeps);


                    //
                    inputDeps = new AllPlayer2EnterGamePlayerJob
                    {
                        enterGamePlayerEntitys = enterGamePlayerEntitys,
                        enterGameOutBuffers    = GetBufferFromEntity <NetworkReliableOutBuffer>(),
                    }
                    .ScheduleSingle(this, inputDeps);
                }
            }



            //QuitGameMessage
            if (quitGameQuery.IsEmptyIgnoreFilter == false)
            {
                var quitGamePlayers = quitGameQuery.ToComponentDataArray <Player>(Allocator.TempJob, out var arrayJob);

                //
                inputDeps = new PlayerDestroy2AllPlayerJob
                {
                    quitGamePlayers = quitGamePlayers,
                }
                .Schedule(this, JobHandle.CombineDependencies(inputDeps, arrayJob));


                //

                //需要延迟删除 其他地方需要处理
                endBarrier.CreateCommandBuffer().RemoveComponent(quitGameQuery, typeof(Player));
            }

            endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }