static void Main(string[] args) { // STBMipGenerator.InstallGlobally(); using (DemoGame game = new DemoGame()) game.Run(); }
/// 描画処理 public override bool DoDraw2( DemoGame.GraphicsDevice graphDev ,Vector3 BasePos ) { // useMdlHdl.Render( graphDev, baseMtx * Matrix4.Scale(new Vector3(0.15f, 0.15f, 0.15f)) ); // Matrix4 mtx = GetBoneMatrix( 2 ); // Common.VectorUtil.Set( ref BodyPos, mtx.M41, mtx.M42, mtx.M43 ); // boundingShape.SetMult( mtx ); var currentMatrix = CalcSpriteMatrix(graphDev.GetCurrentCamera().Pos ,BasePos); var worldViewProj = graphDev.GetCurrentCamera().Projection * graphDev.GetCurrentCamera().View * currentMatrix; spriteShader.SetUniformValue(0, ref worldViewProj); graphDev.Graphics.SetShaderProgram(spriteShader); graphDev.Graphics.SetVertexBuffer(0, vertices); graphDev.Graphics.SetTexture(0, StaticDataList.textureUnified); // graphDev.Graphics.Enable(EnableMode.Blend); // graphDev.Graphics.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.SrcAlpha, BlendFuncFactor.OneMinusSrcAlpha); graphDev.Graphics.Disable(EnableMode.DepthTest); graphDev.Graphics.Enable(EnableMode.CullFace); graphDev.Graphics.SetCullFace(CullFaceMode.Back, CullFaceDirection.Ccw); graphDev.Graphics.DrawArrays(DrawMode.TriangleFan, 0, 4); return true; }
/// public メソッド ///--------------------------------------------------------------------------- /// シーンの初期化 public bool Init( DemoGame.SceneManager sceneMgr ) { taskId = 0; useSceneMgr = sceneMgr; return true; }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (DemoGame game = new DemoGame()) { game.Run(); } }
/// チェック public bool Check( GameActorCollManager collMgr, DemoGame.GeometryLine moveMoveLine ) { collMgr.StartCollision(); for( int i=0; i<collMgr.TrgContainer.Num; i++ ){ GameObjProduct trgObj = collMgr.TrgContainer.GetEntryObj( i ); for( int x=0; x<trgObj.GetCollisionShapeMax(moveType); x++ ){ GameShapeProduct trgShape = trgObj.GetCollisionShape( moveType, x ); /// 衝突 if( calCollPointMove.Check( moveMoveLine, trgShape ) ){ collMgr.SetCollParam( i, x, calCollPointMove.BestId, calCollPointMove.BestDis ); } } } /// 衝突座標をセット setScrapedMovePos( collMgr, moveMoveLine ); /// 衝突した return collMgr.CheckCollHit(); }
/// 描画処理 public override bool DoDraw2( DemoGame.GraphicsDevice graphDev ,Vector3 BasePos ) { CalcSpriteMatrix(graphDev.GetCurrentCamera().Pos ,BasePos); ctrlResMgr.SetSpriteData(BasePos,rotation,uvPos,uvSize,texSize); return true; }
/// 描画処理 public override bool DoDraw( DemoGame.GraphicsDevice graphDev ) { if( drawFlg ){ useMdlHdl.RenderNoAnim( graphDev, baseMtx ); } return true; }
/// 描画処理 public bool Draw( DemoGame.GraphicsDevice graphDev ) { if( plDrawFlg ){ actorCh.Draw( graphDev ); } return true; }
public override void Initialize() { base.Initialize(); OptimizeFor2D(); GUI.Skin = DemoGame.CreateSkin(Application.Content, false); m_Camera.AddComponent <MenuBehaviour>(); }
private static void Main() { var urhoOptions = new ApplicationOptions("Data"); var _app = new DemoGame(urhoOptions); _app.Run(); }
internal static void RunGame() { StaticServiceLocator.AddService <ISaveAndLoad>(new SaveAndLoad()); StaticServiceLocator.AddService <IControllerSettings>(new ControllerSettings()); StaticServiceLocator.AddService <IPossibleMovements>(new EightWayPossibleMovement(new CrowDistance())); game = new DemoGame(); game.Run(); }
/// 描画処理 public override bool DoDraw( DemoGame.GraphicsDevice graphDev ) { useMdlHdl.Render( graphDev, baseMtx, Brightness); useMdlSkyHdl.Render( graphDev, baseMtx, Brightness ); /// shapeColl[(int)ShapeTypeId.MoveGround2].Draw( graphDev, 0, new Rgba(0xff,0x00,0xff,0x80), new Rgba(0xff,0x00,0xff,0x80) ); return true; }
static void Main() { StaticServiceLocator.AddService <ISaveAndLoad>(new SaveAndLoad()); StaticServiceLocator.AddService <IControllerSettings>(new ControllerSettings()); StaticServiceLocator.AddService <IPossibleMovements>(new FourWayPossibleMovement()); using (var game = new DemoGame()) game.Run(); }
public ConsoleScreen(DemoGame game) : base(game) { BlockDrawing = false; BlockUpdating = false; console = game.Services.GetService <ConsoleComponent>(); console.ToggleOpenClose(); scriptManager = game.Services.GetService <ScriptingEngine>(); }
/// 描画処理 public bool Draw( DemoGame.GraphicsDevice graphDev ) { for( int i=0; i<actorChList.Count; i++ ){ actorChList[i].Draw( graphDev); } Clear(); return true; }
public bool DrawAlpha( DemoGame.GraphicsDevice graphDev ) { Matrix4 mtx = BaseMtx; mtx.M41 = GetBodyPos().X; mtx.M43 = GetBodyPos().Z; mtx.M42 += 0.01f; return true; }
void Start() { Application.runInBackground = true; CustomTypes.Register(); this.GameInstance = new DemoGame(); this.GameInstance.MasterServerAddress = "app.exitgamescloud.com:5055"; this.GameInstance.ConnectToMaster("<insert your app id here>", "1.0", "unityPlayer"); }
public void OnApplicationQuit() { if (this.GameInstance != null && this.GameInstance.loadBalancingPeer != null) { this.GameInstance.Disconnect(); this.GameInstance.loadBalancingPeer.StopThread(); } this.GameInstance = null; }
/// 描画処理 public bool Draw( DemoGame.GraphicsDevice graphDev ) { for( int i=0; i<actorEffList.Count; i++ ){ if( actorEffList[i].Enable == true ){ GameCtrlDrawManager.GetInstance().EntryEffect( actorEffList[i], true ); } } return true; }
// Functions public void Draw(DemoGame.GraphicsDevice graphDev) { #if RESIZE_VERTEX_BUFFER ResizeBuffer() ; #endif // RESIZE_VERTEX_BUFFER UpdateVertexData() ; UpdateIndexData() ; DrawSprites(graphDev) ; }
/// 描画処理(デバック用) public bool DrawDebug( DemoGame.GraphicsDevice graphDev ) { for( int i=0; i<actorChList.Count; i++ ){ actorChList[i].Frame(); actorChList[i].Draw( graphDev ); } return true; }
public bool DrawAlpha(DemoGame.GraphicsDevice graphDev) { for( int i=0; i<activeList.Count; i++ ){ if(activeList[i].ActiveFlg == true ){ activeList[i].DrawAlpha(graphDev); } } return true; }
/// 描画処理 public bool DrawAlpha( DemoGame.GraphicsDevice graphDev ) { for( int i=0; i<activeList.Count; i++ ){ Matrix4 mtx = activeList[i].BaseMtx; mtx.M41 = activeList[i].GetBodyPos().X; mtx.M43 = activeList[i].GetBodyPos().Z; } return true; }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var mLayout = new AbsoluteLayout(this); surface = UrhoSurface.CreateSurface(this); // (this, , true); mLayout.AddView(surface); SetContentView(mLayout); app = (DemoGame)await surface.Show(typeof(DemoGame), new ApplicationOptions("Data")); }
static void Main(string[] args) { var demo = new DemoGame(); demo.Start(); Console.ReadKey(); demo.Stop(); }
/// 描画処理 public override bool DoDraw( DemoGame.GraphicsDevice graphDev ) { if( objTrg != null ){ BaseMtx = objTrg.Mtx; Common.VectorUtil.Set( ref BasePos, objTrg.Mtx ); objEff.SetMatrix( objTrg.Mtx ); objEff.Draw( graphDev ); } return true; }
public override void Initialize() { base.Initialize(); GUI.Skin = DemoGame.CreateSkin(Application.Content, false); var cameraGo = GameObjectFactory.CreateCamera(); cameraGo.AddComponent <MenuBehaviour>(); Add(cameraGo); }
/// 描画 public override bool Draw( DemoGame.GraphicsDevice graphDev ) { if( objMark.TypeId == 0 ){ SetBillboardMatrix( graphDev.GetCurrentCamera() ); } else{ SetBillboardMatrixY( graphDev.GetCurrentCamera() ); } objMark.Draw( graphDev ); return true; }
/// 描画処理 public override bool DoDraw( DemoGame.GraphicsDevice graphDev ) { if( billFlg == true ){ SetBillboardMatrix( graphDev.GetCurrentCamera() ); } else if( billYFlg == true ){ SetBillboardMatrixY( graphDev.GetCurrentCamera() ); } objEff.Draw( graphDev ); return true; }
public OptionsMenuState(DemoGame game) : base(game) { BlockUpdating = true; BlockDrawing = false; targetRect = new Rectangle((int)(0.1 * GraphicsDevice.Viewport.Width), (int)(0.1 * GraphicsDevice.Viewport.Height), (int)(0.8 * GraphicsDevice.Viewport.Width), (int)(0.8 * GraphicsDevice.Viewport.Height)); settings = game.Services.GetService <GameSettings>(); LoadContent(game.Content); Initialize(); }
public override void Initialize() { base.Initialize(); GUI.Skin = DemoGame.CreateSkin(Application.Content, false); var camera = new CameraPrefab("cam"); camera.AddComponent <MenuBehaviour>(); camera.AddComponent <PointerCoordDebug>(); Add(camera); }
public void OnGUI() { GUI.skin.button.stretchWidth = true; GUI.skin.button.fixedWidth = 0; if (gameInstance == null) { DemoGUI gui = GameObject.FindObjectOfType(typeof(DemoGUI)) as DemoGUI; gameInstance = gui.GameInstance; } if (gameInstance == null || this.gameInstance.State != ClientState.Joined) { return; } GUILayout.BeginArea(rightToolBar); GUILayout.Label("Clicks of"); int turnToShow = this.gameInstance.turnNumber; GUILayout.Label("turn " + turnToShow); string allTiles = ""; if (turnToShow > 0 && turnToShow < this.gameInstance.lastTilesClicked.Count && this.gameInstance.lastTilesClicked[turnToShow] != null) { foreach (int i in this.gameInstance.lastTilesClicked[turnToShow]) { allTiles += i + ", "; } } GUILayout.Label(allTiles); if (GUILayout.Button("Clear " + turnToShow)) { this.gameInstance.ClearTileClickEvForTurn(turnToShow); } turnToShow = turnToShow - 1; GUILayout.Label("turn " + turnToShow); allTiles = ""; if (turnToShow > 0 && turnToShow < this.gameInstance.lastTilesClicked.Count && this.gameInstance.lastTilesClicked[turnToShow] != null) { foreach (int i in this.gameInstance.lastTilesClicked[turnToShow]) { allTiles += i + ", "; } } GUILayout.Label(allTiles); if (GUILayout.Button("Clear " + turnToShow)) { this.gameInstance.ClearTileClickEvForTurn(turnToShow); } GUILayout.EndArea(); }
/// public メソッド ///--------------------------------------------------------------------------- /// カプセルと三角形との衝突 public bool Check( DemoGame.GeometryCapsule moveCap, ShapeTriangles trgShape ) { Vector3 collPos = StaticDataList.getVectorZero(); calMovePos = moveCap.EndPos; calBestDis = -1.0f; calBestId = -1; float checDis = moveCap.Line.Length + moveCap.R + collCheckDis; if( AppDebug.CollLightFlg == false ){ for( int i=0; i<trgShape.EntryNum; i++ ){ float a = (calMovePos.Dot( trgShape.Triangle[i].Plane.Nor ) + trgShape.Triangle[i].Plane.D); if( a >= checDis || a <= -checDis ){ continue; } if( DemoGame.CommonCollision.CheckSphereAndTriangle( moveCap, trgShape.Triangle[i], ref collPos ) == true ){ float dis = Common.VectorUtil.Distance( collPos, moveCap.StartPos ); if( dis < calBestDis || calBestId < 0 ){ calMovePos = collPos; calBestDis = dis; calBestId = i; } } AppDebug.CollCnt ++; } } else{ for( int i=0; i<trgShape.EntryNum; i++ ){ float a = (calMovePos.Dot( trgShape.Triangle[i].Plane.Nor ) + trgShape.Triangle[i].Plane.D); if( a >= checDis || a <= -checDis ){ continue; } if( DemoGame.CommonCollision.CheckLineAndTriangle( moveCap.Line, trgShape.Triangle[i], ref collPos ) == true ){ float dis = Common.VectorUtil.Distance( collPos, moveCap.StartPos ); if( dis < calBestDis || calBestId < 0 ){ calMovePos = collPos; calBestDis = dis; calBestId = i; } } AppDebug.CollCnt ++; } } if( calBestId >= 0 ){ return true; } return false; }
void Start() { Application.runInBackground = true; CustomTypes.Register(); this.GameInstance = new DemoGame(); this.GameInstance.MasterServerAddress = "localhost:5055"; this.GameInstance.AppId = this.AppId; // edited in Inspector! this.GameInstance.AppVersion = "1.0"; this.GameInstance.NickName = "unityPlayer"; this.GameInstance.Connect(); }
public void Awake() { s_Instance = this; // Have it let us know then the user setup in the system changes. InputUser.onChange += OnUserChange; // And have it tell us when someone uses a device not paired to any user. Note that // we do not yet turn on InputUserSupport.listenForUnpairedDeviceActivity. We do only // during certain times. InputUser.onUnpairedDeviceUsed += OnUnpairedInputDeviceUsed; }
/// ラインとカプセルとの衝突 public bool CheckCapsule( DemoGame.GeometryLine moveLine, ShapeCapsule trgCapsule ) { Vector3 collPos = new Vector3(0,0,0); calMovePos = moveLine.EndPos; if( DemoGame.CommonCollision.CheckLineAndCapsule( moveLine, trgCapsule.Capsule, ref collPos ) == true ){ calMovePos = collPos; calBestDis = Common.VectorUtil.Distance( collPos, moveLine.StartPos ); calBestId = 0; return true; } return false; }
/// デバック用 ///--------------------------------------------------------------------------- /// デバック用:描画 public void Draw( DemoGame.GraphicsDevice graphDev, Rgba color ) { DemoGame.RenderGeometry drawTri = new DemoGame.RenderGeometry(); drawTri.MakeTriangle(); DemoGame.Camera camera = graphDev.GetCurrentCamera(); for( int i=0; i<EntryNum; i++ ){ drawTri.DrawTriangle( graphDev.Graphics, Triangle[i], camera, color ); } drawTri = null; }
public GamePage() { InitializeComponent(); StaticServiceLocator.AddService <ISaveAndLoad>(new SaveAndLoad()); StaticServiceLocator.AddService <IControllerSettings>(new ControllerSettings()); StaticServiceLocator.AddService <IPossibleMovements>(new FourWayPossibleMovement()); // Create the game. var launchArguments = string.Empty; var bounds = Window.Current.Bounds; ScreenSize.Size = new MonoGame.Extended.Size((int)bounds.Width, (int)bounds.Height); _game = MonoGame.Framework.XamlGame <DemoGame> .Create(launchArguments, Window.Current.CoreWindow, swapChainPanel); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); var config = new AndroidApplicationConfig(this); _application = new AndroidApplication(config); _game = new DemoGame(_application); _application.Run(_game); SetContentView(_application.View); }
public bool DrawAlpha( DemoGame.GraphicsDevice graphDev ) { Matrix4 mtx = BaseMtx; mtx.M41 = GetBodyPos().X; mtx.M43 = GetBodyPos().Z; objShadowMax.SetMatrix( mtx ); objShadowMax.Draw( graphDev ); mtx.M42 += 0.01f; objShadow.SetMatrix( mtx ); objShadow.Draw( graphDev ); return true; }
static void Main() { var config = new WindowsApplicationConfig { WindowTitle = "Astrid Demo", WindowWidth = 360, WindowHeight = 600, }; using (var application = new WindowsApplication(config)) using (var game = new DemoGame(application)) { application.Run(game); } }
public void Start() { Application.runInBackground = true; CustomTypes.Register(); leftToolbar = new Rect(leftToolbar.x, leftToolbar.y, leftToolbar.width, Screen.height - leftToolbar.y); this.GameInstance = new DemoGame(); this.GameInstance.AppId = this.AppId; // set in Inspector this.GameInstance.AppVersion = "1.0"; this.GameInstance.PlayerName = !string.IsNullOrEmpty(NamepickerGui.NickName) ? NamepickerGui.NickName : "unityPlayer"; this.GameInstance.OnStateChangeAction += this.OnStateChanged; this.GameInstance.ConnectToRegionMaster("EU"); // Turnbased games have to use this connect via Name Server }
/// 描画処理 public bool Draw( DemoGame.GraphicsDevice graphDev ) { for( int i=0; i<actorFixList.Count; i++ ){ /// 破棄された備品はスルーする ///------------------------------------- if( !actorFixList[i].Enable ){ continue ; } // GameCtrlDrawManager.GetInstance().EntryFixture( actorFixList[i], true ); } return true; }
/// 描画 public void Draw( DemoGame.GraphicsDevice useGraphDev ) { if( effId == EffId.Non ){ return ; } switch( effId ){ case EffId.FadeIn: case EffId.FadeOut: case EffId.FadeWait: uint col = fadeColor | ((uint)fadeAlpha << 24); DemoGame.Graphics2D.FillRect( col, 0, 0, useGraphDev.DisplayWidth, useGraphDev.DisplayHeight ); break; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); StaticServiceLocator.AddService <ISaveAndLoad>(new SaveAndLoad(Assets)); StaticServiceLocator.AddService <IControllerSettings>(new ControllerSettings()); StaticServiceLocator.AddService <ITextToSpeech>(new TextToSpeechImplementation()); StaticServiceLocator.AddService(new List <StoryInterceptor> { new TextToSpeechStoryInterceptor() }); StaticServiceLocator.AddService <IPossibleMovements>(new EightWayPossibleMovement(new CrowDistance())); var g = new DemoGame(); SetContentView((View)g.Services.GetService(typeof(View))); g.Run(); }
/// 描画処理 public override bool DoDraw( DemoGame.GraphicsDevice graphDev ) { /* if( objTrg != null ){ BaseMtx = objTrg.GetBoneMatrix( boneId ); Common.VectorUtil.Set( ref BasePos, BaseMtx ); objSword.SetMatrix( BaseMtx ); objSword.Draw( graphDev ); } */ return true; }
static void Main() { var config = new WindowsApplicationConfig { Title = "Astrid Demo", Width = 800, Height = 480, }; using (var application = new WindowsApplication(config)) { var game = new DemoGame(application); application.Run(game); } }
public Rect leftToolbar; // set in inspector to position the lobby screen public void Start() { Application.runInBackground = true; CustomTypes.Register(); leftToolbar = new Rect(leftToolbar.x, leftToolbar.y, leftToolbar.width, Screen.height - leftToolbar.y); this.GameInstance = new DemoGame(); this.GameInstance.AppId = this.AppId; // set in Inspector this.GameInstance.AppVersion = "1.0"; this.GameInstance.PlayerName = !string.IsNullOrEmpty(NamepickerGui.NickName) ? NamepickerGui.NickName : "unityPlayer"; this.GameInstance.OnStateChangeAction += this.OnStateChanged; this.GameInstance.ConnectToRegionMaster("EU"); // Turnbased games have to use this connect via Name Server }
/// αの描画処理 public bool DrawAlpha( DemoGame.GraphicsDevice graphDev ) { if( plDrawFlg ){ /// ステージの地面を踏んでいるときに影を表示 if( actorCh.GetTouchGroundType() == 0 ){ Matrix4 mtx = actorCh.BaseMtx; mtx.M41 = actorCh.GetBodyPos().X; mtx.M43 = actorCh.GetBodyPos().Z; objShadow.SetMatrix( mtx ); objShadow.Draw( graphDev ); } } return true; }
public void OnGUI() { GUI.skin.button.stretchWidth = true; GUI.skin.button.fixedWidth = 0; if (gameInstance == null) { DemoGUI gui = GameObject.FindObjectOfType(typeof(DemoGUI)) as DemoGUI; gameInstance = gui.GameInstance; } if (gameInstance == null || this.gameInstance.State != ClientState.Joined) { return; } GUILayout.BeginArea(rightToolBar); GUILayout.Label("Clicks of"); int turnToShow = this.gameInstance.turnNumber; GUILayout.Label("turn " + turnToShow); string allTiles = ""; if (turnToShow > 0 && turnToShow < this.gameInstance.lastTilesClicked.Count && this.gameInstance.lastTilesClicked[turnToShow] != null) foreach (int i in this.gameInstance.lastTilesClicked[turnToShow]) { allTiles += i + ", "; } GUILayout.Label(allTiles); if (GUILayout.Button("Clear " + turnToShow)) { this.gameInstance.ClearTileClickEvForTurn(turnToShow); } turnToShow = turnToShow - 1; GUILayout.Label("turn " + turnToShow); allTiles = ""; if (turnToShow > 0 && turnToShow < this.gameInstance.lastTilesClicked.Count && this.gameInstance.lastTilesClicked[turnToShow] != null) foreach (int i in this.gameInstance.lastTilesClicked[turnToShow]) { allTiles += i + ", "; } GUILayout.Label(allTiles); if (GUILayout.Button("Clear " + turnToShow)) { this.gameInstance.ClearTileClickEvForTurn(turnToShow); } GUILayout.EndArea(); }
public void Start() { Application.runInBackground = true; CustomTypes.Register(); leftToolbar = new Rect(leftToolbar.x, leftToolbar.y, leftToolbar.width, Screen.height - leftToolbar.y); this.GameInstance = new DemoGame(); this.GameInstance.AppId = this.AppId; // set in Inspector this.GameInstance.AppVersion = "1.0"; this.GameInstance.PlayerName = !string.IsNullOrEmpty(NamepickerGui.NickName) ? NamepickerGui.NickName : "unityPlayer"; this.GameInstance.OnStateChangeAction += this.OnStateChanged; playfabComponent.LoginToPlayFab(); }
/// private メソッド ///--------------------------------------------------------------------------- /// デバック用 ///--------------------------------------------------------------------------- /// デバック用:描画 public void Draw( DemoGame.GraphicsDevice graphDev, int hitIdx, Rgba color1, Rgba color2 ) { DemoGame.RenderGeometry drawSph = new DemoGame.RenderGeometry(); drawSph.MakeCapsule(); DemoGame.Camera camera = graphDev.GetCurrentCamera(); if( hitIdx < 0 ){ drawSph.DrawCapsule( graphDev.Graphics, this.Capsule, camera, color1 ); } else{ drawSph.DrawCapsule( graphDev.Graphics, this.Capsule, camera, color2 ); } drawSph = null; }
void Start() { if (string.IsNullOrEmpty(this.AppId)) { Debug.LogError("AppId not set! Edit GameObject 'Scripts', 'Demo GUI', AppId first."); Debug.Break(); } Application.runInBackground = true; CustomTypes.Register(); this.GameInstance = new DemoGame(); this.GameInstance.AppId = this.AppId; // edited in Inspector! this.GameInstance.AppVersion = "1.0"; this.GameInstance.NickName = "unityPlayer"; this.GameInstance.ConnectToRegionMaster("eu"); }
void Start() { if (string.IsNullOrEmpty(this.AppId)) { Debug.LogError("AppId not set! Edit GameObject 'Scripts', 'Demo GUI', AppId first."); Debug.Break(); } Application.runInBackground = true; CustomTypes.Register(); this.GameInstance = new DemoGame(); this.GameInstance.MasterServerAddress = "app-eu.exitgamescloud.com:5055"; this.GameInstance.AppId = this.AppId; // edited in Inspector! this.GameInstance.AppVersion = "1.0"; this.GameInstance.PlayerName = "unityPlayer"; this.GameInstance.Connect(); }
private void Awake() { if (StateFluxClient.Instance == null) { SceneManager.LoadScene("_preload"); return; } if (_instance != null && _instance != this) { Debug.Log("DemoGame blocking double instantiate"); Destroy(this.gameObject); } else { _instance = this; Debug.Log("DemoGame is Awake"); } }
public override void Initialize() { base.Initialize(); GUI.Skin = DemoGame.CreateSkin(Application.Content, false); // Add a camera with a FPS controller var camera = GameObjectFactory.CreateCamera(new Vector3(0, 2, -10), new Vector3(0, 0, 0), Vector3.Up); m_Camera = camera.GetComponent <Camera>(); m_Camera.AddComponent <DemoBehaviour>(); m_ControllerSwitcher = m_Camera.AddComponent <ControllerSwitcher>(); m_DemoSceneMenu = m_Camera.AddComponent <DemoSceneMenu>(); // And a light var lightGo = GameObjectFactory.CreateLight(LightType.Directional, Color.White, 1f); lightGo.Transform.LocalPosition = new Vector3(500, 500, 0); lightGo.Transform.LocalRotation = new Vector3(MathHelper.PiOver2, -MathHelper.PiOver4, 0); m_DirectionalLight = lightGo.GetComponent <Light>(); // Sun Flares var content = Application.Content; var glowTexture = content.Load <Texture2D>("Textures/Flares/SunGlow"); var flareTextures = new Texture2D[] { content.Load <Texture2D>("Textures/Flares/circle"), content.Load <Texture2D>("Textures/Flares/circle_sharp_1"), content.Load <Texture2D>("Textures/Flares/circle_soft_1") }; var sunflares = m_DirectionalLight.AddComponent <LensFlare>(); sunflares.Setup(glowTexture, flareTextures); // Skybox RenderSettings.Skybox.Generate(Application.GraphicsDevice, Application.Content, DemoGame.BlueSkybox); // Fog: Setup fog mode with some value. It's still disabled, but those values are used by the post processing fog effect. RenderSettings.FogDensity = 0.0085f; RenderSettings.FogMode = FogMode.None; RenderSettings.FogColor = Color.FloralWhite; }
public PlayState(DemoGame game, string LevelFile) : base(game) { spriteBatch = game.Services.GetService <SpriteBatch>(); camera = game.Services.GetService <FocusCamera>(); settings = game.Services.GetService <GameSettings>(); scriptingEngine = game.Services.GetService <ScriptingEngine>(); context = game.Services.GetService <GameContext>(); monitor = new FpsMonitor(); lvlFile = LevelFile; //var dir = Path.Combine(DemoGame.ContentManager.RootDirectory,"Scripts"); //var files = Directory.GetFiles(dir); //scriptingEngine.LoadScript(files); hud = new HeadsUpDisplay(); LoadContent(game.ContentManager); Initialize(); }
public override void DidFinishLaunching(NSNotification notification) { game = new DemoGame(); game.Run(); }
public void OnDestroy() { InputUser.onChange -= OnUserChange; InputUser.onUnpairedDeviceUsed -= OnUnpairedInputDeviceUsed; s_Instance = null; }