Exemplo n.º 1
0
 private void Update()
 {
     if (!_curPos.EqualOther(CurCamera.Pos))
     {
         _curPos  = CurCamera.Pos;
         _inBlock = World.world.GetBlock(_curPos.x, _curPos.y, _curPos.z);
     }
 }
Exemplo n.º 2
0
 public override bool Equals(object obj)
 {
     if (obj is WorldPos)
     {
         return(pos.EqualOther((WorldPos)obj));
     }
     return(false);
 }
Exemplo n.º 3
0
 public void Update()
 {
     if (player == null)
     {
         player = HasActionObjectManager.Instance.playerManager.getMyPlayer();
     }
     else
     {
         WorldPos playerPos   = Terrain.GetWorldPos(player.transform.position);
         WorldPos curChunkPos = Terrain.GetChunkPos(playerPos.x, 0, playerPos.z);
         if (!curChunkPos.EqualOther(_curChunkPos))
         {
             _curChunkPos = curChunkPos;
             world.WorldGenerator.DataProcessorManager.UpdateChunkPriority(_curChunkPos);
             ChangeAllEntityVisible();
             LoadChunks();
             RemoveChunks();
             UpdatePersistanceOperate();
         }
     }
 }
Exemplo n.º 4
0
        public void UpdateState()
        {
            WorldPos pos = Terrain.GetWorldPos(_controller.transform.position);

            if (!_curPos.EqualOther(pos))
            {
                _curPos = pos;
                CheckAndResetPos();
                WorldPos chunkPos = Terrain.GetChunkPos(_curPos.x, 0, _curPos.z);
                if (!chunkPos.EqualOther(_attachChunk.worldPos))
                {
                    Chunk chunk = World.world.GetChunk(chunkPos.x, chunkPos.y, chunkPos.z);
                    AttachChunk(chunk);
                }

                _inBlock         = _attachChunk.GetBlock(_curPos.x - chunkPos.x, _curPos.y - chunkPos.y, _curPos.z - chunkPos.z, true);
                _standBlock      = _attachChunk.GetBlock(_curPos.x - chunkPos.x, _curPos.y - chunkPos.y - 1, _curPos.z - chunkPos.z, true);
                _blockLightLevel = _attachChunk.GetBlockLight(_curPos.x - chunkPos.x, _curPos.y - chunkPos.y, _curPos.z - chunkPos.z, true);
                _sunLightLevel   = _attachChunk.GetSunLight(_curPos.x - chunkPos.x, _curPos.y - chunkPos.y, _curPos.z - chunkPos.z, true);
            }
            UpdateRenderLight(_sunLightLevel, _blockLightLevel);
        }