Example #1
0
 protected override void Dispose(bool disposing)
 {
     if (_worldStreaming != null)
     {
         _worldStreaming.Dispose();
         _worldStreaming = null;
     }
     base.Dispose(disposing);
 }
    // Use this for initialization
    void Start()
    {
        World.Streaming.StaticInit();
        MainThreadTaskQueue.maxFrameTimeMicroseconds = int.MaxValue;

        _chunkStreaming = Bowhead.WorldStreaming.NewProceduralWorldStreaming(0, _generator);

        _tick      = true;
        _streaming = new World.Streaming(_chunkPrefab, CreateGenVoxelsJob, null, null);
        _streaming.SetWorldAtlasClientData(_clientData);
        _volume          = _streaming.NewStreamingVolume(World.VOXEL_CHUNK_VIS_MAX_XZ, World.VOXEL_CHUNK_VIS_MAX_Y_UP, World.VOXEL_CHUNK_VIS_MAX_Y_DOWN);
        _volume.position = default(WorldChunkPos_t);
        _streaming.shaderQualityLevel = World.Streaming.EShaderQualityLevel.HIGH;

        _streaming.FinishTravel();
    }
Example #3
0
        ////////////
        // Spawning
        ////////////

        public override void Spawn(EntityData d, int index, Vector3 pos, float yaw, Actor instigator, Actor owner, Team team)
        {
            base.Spawn(d, index, pos, yaw, instigator, owner, team);

            playerIndex = index;

            var gameObject = GameObject.Instantiate(data.prefab.Load(), pos, Quaternion.identity, null);

            AttachExternalGameObject(gameObject);

            attackTargetPreview = null;

            // JOSEPH: this will be better once this is moved into new Actor framework, for now HACK
            _worldStreaming          = GameManager.instance.serverWorld.worldStreaming.NewStreamingVolume(World.VOXEL_CHUNK_VIS_MAX_XZ, World.VOXEL_CHUNK_VIS_MAX_Y_UP, World.VOXEL_CHUNK_VIS_MAX_Y_DOWN);
            _worldStreaming.position = World.WorldToChunk(World.Vec3ToWorld(pos));

            spawnPosition = pos;

            SetSpawnPoint(pos);

            unarmedWeaponLeft  = ItemData.Get(data.unarmedWeaponLeft.name).CreateItem() as Weapon;
            unarmedWeaponRight = ItemData.Get(data.unarmedWeaponRight.name).CreateItem() as Weapon;
            PickUp(unarmedWeaponLeft);
            PickUp(unarmedWeaponRight);
            PickUp(ItemData.Get("Rapier").CreateItem());
            PickUp(ItemData.Get("Buckler").CreateItem());
            SwapWeapons();
            PickUp(ItemData.Get("SpellMagicMissile").CreateItem());
            PickUp(ItemData.Get("SpellHeal").CreateItem());
            PickUp(ItemData.Get("TreeClimbingGear").CreateItem());
            SetMoney(50);

            //Equip(new game.items.Clothing("Cloak"));
            //AddInventory(new Clothing("Backpack"));
            //Equip(new game.items.Weapon("PickAxe"));
            //Equip(new game.items.Parachute("Parachute"));
            //AddInventory(new Jetpack("Jetpack"));
            //SetMapPos(new Vector2(spawnPoint.X, spawnPoint.Z));
            //int exploreSize = 1024;
            //Explore(this, new EventArgsExplore(){ region = new Rectangle((int)(mapPos.X - exploreSize / 2), (int)(mapPos.Y - exploreSize / 2), exploreSize, exploreSize) });
            Respawn();
        }