public void CreateChunk(int x, int y, int z)
        {
            WorldPos worldPos = new WorldPos(x, y, z);

            //Instantiate the chunk at the coordinates using the chunk prefab
            GameObject newChunkObject = Instantiate(
                chunkPrefab, new Vector3(x, y, z),
                Quaternion.Euler(Vector3.zero)
                ) as GameObject;
            Chunk newChunk = newChunkObject.GetComponent <Chunk>();

            newChunkObject.name = "Chunk: " + x / 16f + ":" + y / 16f + ":" + z / 16f;
            newChunk.pos        = worldPos;
            newChunk.world      = this;

            //Add it to the chunks dictionary with the position as the key
            chunks.Add(worldPos, newChunk);

            bool HasLoadedChunk = false;


            if ((Network.isServer || (!Network.isServer && !Network.isClient)) && IsLoadChunks)
            {
                HasLoadedChunk = Serialization.Load(newChunk);
            }
            if (!HasLoadedChunk)
            {
                newChunk = MyTerrainGen.ChunkGen(newChunk);
            }
            newChunk.transform.parent = gameObject.transform;
            newChunk.SetBlocksUnmodified();
            GetManager.GetZoneManager().LoadZones(new Vector3(x, y, z));
            DebugChunksLoadedCount++;
        }
コード例 #2
0
ファイル: CarPhysicsV3.cs プロジェクト: AkliDev/HoverCars
 private void FixedUpdate()
 {
     _VertexPositions = GlobalCarCalculations.CalculateVertexPositonsOfBoxCollider(GetManager.GetBoxCollider, 0);
     Suspension();
     Gravity();
     GetManager.TranslateTransform(_SuspensionGravityVelocity, Space.World);
 }
        public void DestroyChunk(int x, int y, int z)
        {
            Chunk chunk = null;

            if (chunks.TryGetValue(new WorldPos(x, y, z), out chunk))
            {
                // atm it is saved when it is removed
                if (SaveFileName == "")                 // if default then update to the game file name
                {
                    SaveFileName = GetManager.GetGameManager().GameName;
                }
                DebugPolygonCount -= chunk.PolygonCount;
                Serialization.SaveChunk(chunk);
                Object.Destroy(chunk.gameObject);
                chunks.Remove(new WorldPos(x, y, z));
            }
            GetManager.GetZoneManager().DestroyZonesInCubeNotCentred(new Vector3(x, y, z),
                                                                     new Vector3(Chunk.chunkSize, Chunk.chunkSize, Chunk.chunkSize));
            DebugChunksLoadedCount--;
        }
コード例 #4
0
 public void TryDisconnect(Client client, DisconnectReason reason = DisconnectReason.UNKNOW_ERROR_INSTANCE)
 => GetManager.TryDisconnect(client, reason);
コード例 #5
0
 public ConnectionProtocol TryConnect(Client client) => GetManager.TryConnect(client);
コード例 #6
0
ファイル: Employee.cs プロジェクト: uranium62/Orleankka
 ActorRef <Manager> On(GetManager x) => manager;
コード例 #7
0
 ActorRef On(GetManager x)
 {
     return(manager);
 }
コード例 #8
0
 ActorRef On(GetManager x) => manager;
コード例 #9
0
ファイル: CarPhysicsV3.cs プロジェクト: AkliDev/HoverCars
 private void RotateObjectToNormal(Vector3 combinedSurviceNormal)
 {
     transform.rotation = Quaternion.FromToRotation(transform.up, (_InterpolatedNormal)) * transform.rotation;
     GetManager.SetModelRotation(Quaternion.Slerp(GetManager.GetModelTransform.rotation, transform.rotation, 20 * Time.fixedDeltaTime));
     GetManager.SetUpOrientationRotation(Quaternion.Slerp(GetManager.GetOrientationLookAtTransform.rotation, transform.rotation, 7 * Time.fixedDeltaTime));
 }