// 单例的使用 private ControllerCenter() { renderSystem = new RendererSystem(); playerSystem = new PlayerSystem(); ActionSystem = new ActionSystem(); gameobjectSystem = new GameObjectSystem(); itemSystem = new ItemSystem(); skillitemSystem = new SkillItemSystem(); }
void Start() { if (Camera.main == null) { GameObject go = new GameObject("Camera"); mainCamera = go.AddComponent <Camera>(); } else { mainCamera = Camera.main; } mainCamera.clearFlags = CameraClearFlags.Color; mainCamera.backgroundColor = Color.black; mainCamera.orthographic = true; mainCamera.orthographicSize = 1f; mainCamera.nearClipPlane = 0f; screenRect = Rect.MinMaxRect(-mainCamera.aspect, -1f, mainCamera.aspect, 1f); entitys = new DList <Entity>(); playerEntitys = new DList <MoveAbleEntity>(); speeds = new DList <SpeedComponent>(); eatings = new DList <EatingComponent>(); entitySystem = new EntitySystem(this); moveSystem = new MoveSystem(this); gameObjectSystem = new GameObjectSystem(this); inputSystem = new InputSystem(this); eatSystem = new EatSystem(this); eatingSystem = new EatingSystem(this); circlePushSystem = new CirclePushSystem(this); entitySystem.InitScene(); ApplyDelayCommands();//执行延迟增删数组内容的操作 }