Ejemplo n.º 1
0
    public void GenerateEntities(Model model)
    {
        Species playerTegu     = GD.Load <Resource>("res://Crawler/Model/Species/PlayerTegu.tres") as Species;
        Species partnerAxolotl = GD.Load <Resource>("res://Crawler/Model/Species/PartnerAxolotl.tres") as Species;
        Species enemy          = GD.Load <Resource>("res://Crawler/Model/Species/Enemy.tres") as Species;

        spawnX = 0;
        spawnY = -2;
        model.AddEntity(CreateEntity(playerTegu, (spawnX, spawnY), 0));
        model.AddEntity(CreateEntity(partnerAxolotl, (spawnX, spawnY + 1), 0));

        // model.AddEntity(new Entity(playerTegu, (spawnX, spawnY), 0));
        // model.AddEntity(new Entity(partnerAxolotl, (spawnX, spawnY+1), 0));

        // // model.AddEntity(new Entity(enemy, (0, 10), 1));
        // model.AddEntity(new Entity(enemy, (1, 20), 1));
        // model.AddEntity(new Entity(enemy, (2, 20), 1));

        Array tiles = model.Map.GetUsedCellsById(3);

        tiles.Shuffle();
        for (int i = 0; i < 10; i++)
        {
            Vector2 vec = (Vector2)tiles[i + 5];
            model.AddEntity(CreateEntity(enemy, ((int)vec.x, (int)vec.y), 1));
        }
    }
Ejemplo n.º 2
0
    public void GenerateEntities(Model model)
    {
        Species playerTegu     = GD.Load <Resource>("res://Crawler/Model/Species/PlayerTegu.tres") as Species;
        Species partnerAxolotl = GD.Load <Resource>("res://Crawler/Model/Species/PartnerAxolotl.tres") as Species;
        Species enemy          = GD.Load <Resource>("res://Crawler/Model/Species/Enemy.tres") as Species;
        Species enemy2         = GD.Load <Resource>("res://Crawler/Model/Species/Enemy2.tres") as Species;

        model.AddEntity(CreateEntity(playerTegu, (0, -1), 0));
        // model.AddEntity(CreateEntity(partnerAxolotl, (-1, -1), 0));

        // model.AddEntity(new Entity(enemy, (0, 10), 1));
        // model.AddEntity(new Entity(enemy, (1, 20), 1));
        // model.AddEntity(new Entity(enemy, (2, 20), 1));


        model.AddEntity(CreateEntity(enemy, (21, 10), 1));
        model.AddEntity(CreateEntity(enemy, (8, 34), 1));
        model.AddEntity(CreateEntity(enemy, (32, 47), 1));
        model.AddEntity(CreateEntity(enemy, (-11, -5), 1));
        model.AddEntity(CreateEntity(enemy, (35, 4), 1));
        model.AddEntity(CreateEntity(enemy2, (17, -29), 1));
        model.AddEntity(CreateEntity(enemy2, (-18, -12), 1));
        model.AddEntity(CreateEntity(enemy2, (23, -17), 1));
        model.AddEntity(CreateEntity(enemy2, (9, -25), 1));
        model.AddEntity(CreateEntity(enemy2, (16, 16), 1));

        // Array tiles = model.Map.GetUsedCells();
        // tiles.Shuffle();
        // for (int i = 0; i < 10; i++)
        // {
        //     Vector2 vec = (Vector2)tiles[i+5];
        //     model.AddEntity(CreateEntity(enemy, ((int)vec.x, (int)vec.y), 1));
        //     GD.Print((int)vec.x, " ", (int)vec.y);
        // }
    }
Ejemplo n.º 3
0
        public int CreateProp(int model, Vector3 pos, Vector3 rot, int dimension)
        {
            var obj = new EntityProperties();

            obj.Position   = pos;
            obj.Rotation   = rot;
            obj.ModelHash  = model;
            obj.Dimension  = dimension;
            obj.Alpha      = 255;
            obj.EntityType = (byte)EntityType.Prop;
            int localEntityHash;

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.Prop;
            packet.Properties = obj;
            packet.NetHandle  = localEntityHash;

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Ejemplo n.º 4
0
        public int CreateBlip(Vector3 pos, float range, int dimension)
        {
            int localEntityHash;
            var obj = new BlipProperties
            {
                EntityType        = (byte)EntityType.Blip,
                Position          = pos,
                Dimension         = dimension,
                Sprite            = 0,
                Scale             = 1f,
                RangedBlip        = range,
                Alpha             = 255,
                AttachedNetEntity = 0
            };

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity
            {
                EntityType = (byte)EntityType.Blip,
                Properties = obj,
                NetHandle  = localEntityHash
            };

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Ejemplo n.º 5
0
        public int CreateBlip(Vector3 pos, float range, int dimension)
        {
            int localEntityHash;
            var obj = new BlipProperties();

            obj.EntityType        = (byte)EntityType.Blip;
            obj.Position          = pos;
            obj.Dimension         = dimension;
            obj.Sprite            = 0;
            obj.Scale             = 1f;
            obj.RangedBlip        = range;
            obj.Alpha             = 255;
            obj.AttachedNetEntity = 0;
            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.Blip;
            packet.Properties = obj;
            packet.NetHandle  = localEntityHash;

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Ejemplo n.º 6
0
        public int CreateTextLabel(string text, float size, float range, int r, int g, int b, Vector3 pos, bool entitySeethrough, int dimension)
        {
            int localEntityHash;
            var obj = new TextLabelProperties();

            obj.EntityType       = (byte)EntityType.TextLabel;
            obj.Position         = pos;
            obj.Size             = size;
            obj.Blue             = b;
            obj.Green            = g;
            obj.Range            = range;
            obj.Red              = r;
            obj.Text             = text;
            obj.Alpha            = 255;
            obj.EntitySeethrough = entitySeethrough;
            obj.Dimension        = dimension;
            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.TextLabel;
            packet.Properties = obj;
            packet.NetHandle  = localEntityHash;

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Ejemplo n.º 7
0
        public int CreatePickup(int model, Vector3 pos, Vector3 rot, int amount, uint respawnTime, int dimension, int customModel = 0)
        {
            int localEntityHash;
            var obj = new PickupProperties();

            obj.Position    = pos;
            obj.Rotation    = rot;
            obj.ModelHash   = model;
            obj.RespawnTime = respawnTime;
            obj.Amount      = amount;
            obj.Dimension   = dimension;
            obj.Alpha       = 255;
            obj.Flag        = 0;
            obj.CustomModel = customModel;
            obj.EntityType  = (byte)EntityType.Pickup;

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.Pickup;
            packet.Properties = obj;
            packet.NetHandle  = localEntityHash;

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Ejemplo n.º 8
0
        public EntityResponse CreateEntity(string workspaceId, CreateEntity body)
        {
            if (string.IsNullOrEmpty(workspaceId))
            {
                throw new ArgumentNullException(nameof(workspaceId));
            }
            if (body == null)
            {
                throw new ArgumentNullException(nameof(body));
            }

            if (string.IsNullOrEmpty(VersionDate))
            {
                throw new ArgumentNullException("versionDate cannot be null. Use 'CONVERSATION_VERSION_DATE_2017_05_26'");
            }

            EntityResponse result = null;

            try
            {
                result = this.Client.WithAuthentication(this.UserName, this.Password)
                         .PostAsync($"{this.Endpoint}/v1/workspaces/{workspaceId}/entities")
                         .WithArgument("version", VersionDate)
                         .WithBody <CreateEntity>(body)
                         .As <EntityResponse>()
                         .Result;
            }
            catch (AggregateException ae)
            {
                throw ae.Flatten();
            }

            return(result);
        }
Ejemplo n.º 9
0
        public async Task <StatusViewModel> PostEntityAsync(int solutionId, [FromBody] CreateEntity createEntity)
        {
            createEntity.SolutionId = solutionId;
            await _mediator.Send(createEntity);

            return(new StatusViewModel());
        }
Ejemplo n.º 10
0
        public int CreateTextLabel(string text, float size, float range, int r, int g, int b, Vector3 pos, bool entitySeethrough, int dimension)
        {
            int localEntityHash;
            var obj = new TextLabelProperties
            {
                EntityType       = (byte)EntityType.TextLabel,
                Position         = pos,
                Size             = size,
                Blue             = b,
                Green            = g,
                Range            = range,
                Red              = r,
                Text             = text,
                Alpha            = 255,
                EntitySeethrough = entitySeethrough,
                Dimension        = dimension
            };

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity
            {
                EntityType = (byte)EntityType.TextLabel,
                Properties = obj,
                NetHandle  = localEntityHash
            };

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Ejemplo n.º 11
0
        public int CreateVehicle(int model, Vector3 pos, Vector3 rot, int color1, int color2)
        {
            int localEntityHash = ++EntityCounter;
            var obj             = new VehicleProperties();

            obj.Position       = pos;
            obj.Rotation       = rot;
            obj.ModelHash      = model;
            obj.IsDead         = false;
            obj.Health         = 900;
            obj.EntityType     = (byte)EntityType.Vehicle;
            obj.PrimaryColor   = color1;
            obj.SecondaryColor = color2;
            ServerEntities.Add(localEntityHash, obj);

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.Vehicle;
            var props = new VehicleProperties();

            props.ModelHash      = model;
            props.Rotation       = rot;
            props.Position       = pos;
            props.PrimaryColor   = color1;
            props.SecondaryColor = color2;
            packet.NetHandle     = localEntityHash;
            packet.Properties    = props;
            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true);

            return(localEntityHash);
        }
Ejemplo n.º 12
0
        public int CreateMarker(int markerType, Vector3 pos, Vector3 dir, Vector3 rot, Vector3 scale, int alpha, int r, int g, int b)
        {
            int localEntityHash = ++EntityCounter;

            var obj = new MarkerProperties()
            {
                MarkerType = markerType,
                Position   = pos,
                Direction  = dir,
                Rotation   = rot,
                Scale      = scale,
                Alpha      = (byte)alpha,
                Red        = r,
                Green      = g,
                Blue       = b,
                EntityType = (byte)EntityType.Marker,
            };

            ServerEntities.Add(localEntityHash, obj);

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.Marker;
            packet.Properties = obj;
            packet.NetHandle  = localEntityHash;

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true);

            return(localEntityHash);
        }
Ejemplo n.º 13
0
        public int CreateBlip(NetHandle ent)
        {
            if (ent.IsNull || !ent.Exists())
            {
                return(0);
            }

            int localEntityHash = ++EntityCounter;
            var obj             = new BlipProperties();

            obj.EntityType        = (byte)EntityType.Blip;
            obj.AttachedNetEntity = ent.Value;
            obj.Position          = ServerEntities[ent.Value].Position;
            ServerEntities.Add(localEntityHash, obj);

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.Blip;
            packet.Properties = obj;
            packet.NetHandle  = localEntityHash;

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true);

            return(localEntityHash);
        }
Ejemplo n.º 14
0
        public int CreateParticleEffect(string lib, string name, Vector3 pos, Vector3 rot, float scale, int attachedEntity = 0, int boneId = 0, int dimension = 0)
        {
            int localEntityHash;
            var obj = new ParticleProperties
            {
                EntityType     = (byte)EntityType.Particle,
                Position       = pos,
                Rotation       = rot,
                Alpha          = 255,
                Library        = lib,
                Name           = name,
                Scale          = scale,
                EntityAttached = attachedEntity,
                BoneAttached   = boneId,
                Dimension      = dimension
            };

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity
            {
                EntityType = (byte)EntityType.Particle,
                Properties = obj,
                NetHandle  = localEntityHash
            };

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Ejemplo n.º 15
0
        public int CreateBlip(NetHandle ent)
        {
            if (ent.IsNull || !ent.Exists())
            {
                return(0);
            }

            int localEntityHash;
            var obj = new BlipProperties();

            obj.EntityType        = (byte)EntityType.Blip;
            obj.AttachedNetEntity = ent.Value;
            obj.Dimension         = ServerEntities[ent.Value].Dimension;
            obj.Position          = ServerEntities[ent.Value].Position;
            obj.Sprite            = 0;
            obj.Alpha             = 255;
            obj.Scale             = 1f;
            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.Blip;
            packet.Properties = obj;
            packet.NetHandle  = localEntityHash;

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Ejemplo n.º 16
0
        public int CreateParticleEffect(string lib, string name, Vector3 pos, Vector3 rot, float scale, int attachedEntity = 0, int boneId = 0, int dimension = 0)
        {
            int localEntityHash;
            var obj = new ParticleProperties();

            obj.EntityType     = (byte)EntityType.Particle;
            obj.Position       = pos;
            obj.Rotation       = rot;
            obj.Alpha          = 255;
            obj.Library        = lib;
            obj.Name           = name;
            obj.Scale          = scale;
            obj.EntityAttached = attachedEntity;
            obj.BoneAttached   = boneId;
            obj.Dimension      = dimension;

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.Particle;
            packet.Properties = obj;
            packet.NetHandle  = localEntityHash;

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Ejemplo n.º 17
0
        public int CreatePickup(int model, Vector3 pos, Vector3 rot, int amount, uint respawnTime, int dimension, int customModel = 0)
        {
            int localEntityHash;
            var obj = new PickupProperties
            {
                Position    = pos,
                Rotation    = rot,
                ModelHash   = model,
                RespawnTime = respawnTime,
                Amount      = amount,
                Dimension   = dimension,
                Alpha       = 255,
                Flag        = 0,
                CustomModel = customModel,
                EntityType  = (byte)EntityType.Pickup
            };

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity
            {
                EntityType = (byte)EntityType.Pickup,
                Properties = obj,
                NetHandle  = localEntityHash
            };

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Ejemplo n.º 18
0
        public int CreateStaticPed(int model, Vector3 pos, float heading, int dimension = 0)
        {
            int localEntityHash;
            var obj = new PedProperties
            {
                EntityType = (byte)EntityType.Ped,
                Position   = pos,
                Alpha      = 255,
                ModelHash  = model,
                Rotation   = new Vector3(0, 0, heading),
                Dimension  = dimension
            };

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity
            {
                EntityType = (byte)EntityType.Ped,
                Properties = obj,
                NetHandle  = localEntityHash
            };

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Ejemplo n.º 19
0
        public int CreateProp(int model, Vector3 pos, Quaternion rot, int dimension)
        {
            var obj = new EntityProperties
            {
                Position   = pos,
                Rotation   = rot,
                ModelHash  = model,
                Dimension  = dimension,
                Alpha      = 255,
                EntityType = (byte)EntityType.Prop
            };

            int localEntityHash;

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity
            {
                EntityType = (byte)EntityType.Prop,
                Properties = obj,
                NetHandle  = localEntityHash
            };

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Ejemplo n.º 20
0
    private void OnApplicationQuit()
    {
        CreateEntity.Empty()
        .isOnApplicationQuit = true;

        systems.Execute();
        systems.Cleanup();
    }
        protected override void CreateScene()
        {
            EntityManager.Add(CreateEntity.Background());

            _achievements = WaveServices.GetService <AchievementService>().Achievements;

            CreateUI();
        }
Ejemplo n.º 22
0
 public AbstractFileRepository(string v, CreateEntity <TIP_ENTITATE> createEntity)
 {
     this.fileName = v;
     if (createEntity != null)
     {
         loadFromFile(createEntity);
     }
 }
Ejemplo n.º 23
0
        protected override void OnAwake()
        {
            base.OnAwake();
            entity = CreateEntity.Empty();

            View.Initialize(Contexts.sharedInstance.game, entity);
            gameObject.RegisterListeners(entity);
        }
Ejemplo n.º 24
0
        protected override void CreateScene()
        {
            EntityManager.Add(CreateEntity.Background());

            CreateUI();

            WaveServices.GetService <AnalyticsService>().TagEvent("Page opened", "Page", "Options");
        }
Ejemplo n.º 25
0
 public EnemyGeneric(BaseValues patk, BaseValues matk, BaseValues armor, BaseValues magarmor, CreateEntity th)
 {
     thePlayer           = th;
     jobName             = "Enemies";
     physicalWeaponValue = patk;
     magicalWeaponValue  = matk;
     armorValue          = armor;
     magArmorValue       = magarmor;
 }
Ejemplo n.º 26
0
 public InFileRepository(IValidator <E> validator, string filename, CreateEntity <E> createEntity) : base(validator)
 {
     this.filename     = filename;
     this.createEntity = createEntity;
     if (createEntity != null)
     {
         loadFromFile();
     }
 }
Ejemplo n.º 27
0
 public void Execute()
 {
     foreach (var map in mapFinished)
     {
         CreateEntity
         .Empty()
         .With(x => x.SpawnZombie = true);
     }
 }
 public AbstractFileRepo(Validator <E> vali, String fileName, CreateEntity <E> createEntity) : base(vali)
 {
     this.fileName     = fileName;
     this.createEntity = createEntity;
     if (createEntity != null)
     {
         loadFromFile();
     }
 }
Ejemplo n.º 29
0
        public async Task <EntityCreated> Handle(CreateEntity command)
        {
            await HandleCommandFor(command.EntityId);

            Verify.EntityNameIsUnique(command.Name);
            var events = new EntityCreated(command.EntityId, command.Name);

            return(events);
        }
Ejemplo n.º 30
0
        public IActionResult Index()
        {
            var model = new CreateEntity();

            model.Connections       = _optionsService.ConnectionStrings.GetConnectionFilters().ToList();
            model.ExistingDatabases = _databaseEntityRepository.GetCommonDatabases(_optionsService.ConnectionStrings.GetConnectionStrings()).OrderBy(x => x);
            model.Database          = model.ExistingDatabases.Contains(_optionsService.DatabaseSettings.DefaultDatabase) ? _optionsService.DatabaseSettings.DefaultDatabase : null;

            return(View(model));
        }