public void CreateHealthPickupByPos(Vector3 pos)
        {
            var exampleEntity = FpsEntityTemplates.HealthPickup(Vector3f.FromUnityVector(pos), 100);
            var request       = new WorldCommands.CreateEntity.Request(exampleEntity);

            m_CommandSender.SendCreateEntityCommand(request, OnCreateEntityResponse);
        }
Esempio n. 2
0
        private static Snapshot GenerateDefaultSnapshot()
        {
            var snapshot = new Snapshot();

            snapshot.AddEntity(FpsEntityTemplates.Spawner(Coordinates.Zero));
            return(snapshot);
        }
Esempio n. 3
0
        private static Snapshot GenerateSessionSnapshot()
        {
            var snapshot = new Snapshot();

            snapshot.AddEntity(FpsEntityTemplates.Spawner(Coordinates.Zero));
            snapshot.AddEntity(FpsEntityTemplates.DeploymentState());
            return(snapshot);
        }
Esempio n. 4
0
        private static void AddHealthPacks(Snapshot snapshot)
        {
            // Invoke our static function to create an entity template of our health pack with 100 heath.
            var healthPack = FpsEntityTemplates.HealthPickup(new Vector3f(5, 0, 0), 100);

            // Add the entity template to the snapshot.
            snapshot.AddEntity(healthPack);
        }
Esempio n. 5
0
        private static void GenerateDefaultSnapshot()
        {
            var snapshot = new Snapshot();

            var spawner = FpsEntityTemplates.Spawner();

            snapshot.AddEntity(spawner);

            var SimulatedPlayerCoordinatorTrigger = FpsEntityTemplates.SimulatedPlayerCoordinatorTrigger();

            snapshot.AddEntity(SimulatedPlayerCoordinatorTrigger);

            SaveSnapshot(snapshot);
        }
        private static void GenerateFpsSnapshot()
        {
            var localSnapshot = new Snapshot();
            var cloudSnapshot = new Snapshot();

            GenerateSnapshot(localSnapshot);
            GenerateSnapshot(cloudSnapshot);

            // The local snapshot is identical to the cloud snapshot, but also includes a simulated player coordinator
            // trigger.
            var simulatedPlayerCoordinatorTrigger = FpsEntityTemplates.SimulatedPlayerCoordinatorTrigger();

            localSnapshot.AddEntity(simulatedPlayerCoordinatorTrigger);

            SaveSnapshot(DefaultSnapshotPath, localSnapshot);
            SaveSnapshot(CloudSnapshotPath, cloudSnapshot);
        }
Esempio n. 7
0
        private void OnRequestSpawnSoldier(PlayerRes.SpawnSoldier.ReceivedRequest request)
        {
            //扣除资源生成士兵,100资源一个
            uint needResValue = 100;

            if (writer.Data.ResValue < needResValue)
            {
                return;
            }

            uint newvale = writer.Data.ResValue - needResValue;
            var  update  = new PlayerRes.Update
            {
                ResValue = new Improbable.Gdk.Core.Option <uint>(newvale)
            };

            writer.SendUpdate(update);

            var exampleEntity = FpsEntityTemplates.Soldier(new Vector3f(request.Payload.X, request.Payload.Y, request.Payload.Z), entityID.Id);
            var request1      = new WorldCommands.CreateEntity.Request(exampleEntity);

            worldCommandSender.SendCreateEntityCommand(request1, OnCreateEntityResponse);
        }
Esempio n. 8
0
        private static void GenerateFpsSnapshot()
        {
            var localSnapshot = new Snapshot();
            var cloudSnapshot = new Snapshot();

            GenerateSnapshot(localSnapshot);
            GenerateSnapshot(cloudSnapshot);

            // The local snapshot is identical to the cloud snapshot, but also includes a simulated player coordinator
            // trigger.
            var simulatedPlayerCoordinatorTrigger = FpsEntityTemplates.SimulatedPlayerCoordinatorTrigger();
            var polController = FpsEntityTemplates.PolControllerEntity(new Improbable.Vector3f(5, 0, 0));

            cloudSnapshot.AddEntity(polController);
            cloudSnapshot.AddEntity(simulatedPlayerCoordinatorTrigger);
            AddPolEntities(cloudSnapshot, 100);

            localSnapshot.AddEntity(polController);
            AddPolEntities(localSnapshot, 100);
            localSnapshot.AddEntity(simulatedPlayerCoordinatorTrigger);

            SaveSnapshot(DefaultSnapshotPath, localSnapshot);
            SaveSnapshot(CloudSnapshotPath, cloudSnapshot);
        }
 private static void GenerateSnapshot(Snapshot snapshot)
 {
     snapshot.AddEntity(FpsEntityTemplates.Spawner(Coordinates.Zero));
 }
Esempio n. 10
0
        private static void GenerateSnapshot(Snapshot snapshot)
        {
            var spawner = FpsEntityTemplates.Spawner();

            snapshot.AddEntity(spawner);
        }