00001 using System;
00002 using System.Collections.Generic;
00003 using System.Text;
00004 using DXGfxLib;
00005
00006 namespace Game
00007 {
00012 public class World
00013 {
00014 private static World globalInstance = null;
00015
00016 public World()
00017 {
00018 if (globalInstance == null)
00019 {
00020 globalInstance = this;
00021 }
00022 else
00023 {
00024 throw new InvalidOperationException("There shouldn't be more than one World per game !");
00025 }
00026 }
00027
00028 public static World GetGlobalInstance()
00029 {
00030 if (globalInstance == null)
00031 {
00032 globalInstance = new World();
00033 }
00034
00035 return globalInstance;
00036 }
00037
00038 private OutDoorScene currentOutDoorScene = null;
00039
00040 public void Attach(OutDoorScene outdoor)
00041 {
00042 if (currentOutDoorScene != null)
00043 {
00044 throw new InvalidOperationException("At the moment only one outdoorscene per world is supported");
00045 }
00046
00047 currentOutDoorScene = outdoor;
00048 }
00049
00050 public float TerrainHeigth(float x, float z)
00051 {
00052 float res = 0;
00053
00054 if (currentOutDoorScene != null)
00055 {
00056 res = currentOutDoorScene.SceneTerrain.GetHeigth(currentOutDoorScene, x, z);
00057 }
00058
00059 return res;
00060 }
00061
00065 public float priceStone = 10.0f;
00066 public float priceWood = 10.0f;
00067 public float priceMetal = 10.0f;
00068 }
00069 }