Exemple #1
0
            public static GameObject Create(Vector3 pos)
            {
                var obj = new GameObject();

                SpawnBlockEntity block = obj.AddComponent <SpawnBlockEntity>();

                block.transform.position = pos;
                return(block.gameObject);
            }
 Task IHandle <SpawnBlockEntity> .Handle(SpawnBlockEntity message)
 {
     AttachedObject.GetComponent <WorldComponent>().SetWorld(message.World);
     AttachedObject.GetComponent <BlockWorldPositionComponent>().SetBlockWorldPosition(message.Position);
     AttachedObject.QueueOperation(async() =>
     {
         await AttachedObject.Tell(Enable.Default);
         if (AttachedObject.ValueStorage.IsDirty)
         {
             await AttachedObject.WriteStateAsync();
         }
     });
     return(Task.CompletedTask);
 }
Exemple #3
0
        void OnEntityBuilt(Planner planner, GameObject gameobject)
        {
            if (planner == null || gameobject == null)
            {
                return;
            }
            var        player = planner.GetOwnerPlayer();
            BaseEntity entity = gameobject.ToBaseEntity();

            if (entity == null)
            {
                return;
            }
            if (SpawnBlockEntity.IsBlock(entity))
            {
                player.ChatMessage("Строительство запрещено!!!\nВы находитесь в зоне возрождения, двигайтесь к центру или к полюсам карты!");
                entity.Kill();
            }
        }
 async Task IHandle <SpawnBlockEntity> .Handle(SpawnBlockEntity message)
 {
     State.IsCooking = (await AttachedObject.World.GetBlockState(GrainFactory, AttachedObject.Position))
                       .IsId(BlockId.BlastFurnace);
     MarkDirty();
 }
Exemple #5
0
 bool InSpawnZone(BaseEntity entity) => SpawnBlockEntity.IsBlock(entity);
Exemple #6
0
 void CreateBlock(Vector3 position)
 {
     blocks.Add(SpawnBlockEntity.Create(position));
 }
Exemple #7
0
 bool IsValidSpawn(Vector3 point)
 {
     return(spawns.All(spawn => !(Vector3.Distance(point, spawn) < spawnRadius)) &&
            SpawnBlockEntity.CanPlaceSpawn(point));
 }
Exemple #8
0
        async Task IHandle <SpawnBlockEntity> .Handle(SpawnBlockEntity message)
        {
            await AttachedObject.GetComponent <WorldComponent>().SetWorld(message.World);

            await AttachedObject.GetComponent <BlockWorldPositionComponent>().SetBlockWorldPosition(message.Position);
        }