// Use this for initialization void Start() { Application.targetFrameRate = 300; QualitySettings.vSyncCount = 0; RXDebug.Log ("Starting the game"); instance = this; FSoundManager.Init (); Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; FutileParams fparams = new FutileParams (true, true, false, true); fparams.AddResolutionLevel (480.0f, 1.0f, 1.0f, ""); //iPhone fparams.origin = new Vector2 (0.0f, 0.0f); Futile.instance.Init (fparams); Futile.atlasManager.LoadAtlas ("Atlases/Factory"); Futile.atlasManager.LoadAtlas("Atlases/SFB"); Futile.atlasManager.LoadFont("font", "font", "Atlases/font", 0, 0); _stage = Futile.stage; GoToPage (PageType.GamePage); }
public FRenderLayer(FStage stage, FAtlas atlas, FShader shader) { _stage = stage; _atlas = atlas; _shader = shader; _expansionAmount = Futile.quadsPerLayerExpansion; _maxEmptyQuads = Futile.maxEmptyQuadsPerLayer; batchIndex = atlas.index * 10000 + shader.index; _gameObject = new GameObject("FRenderLayer (" + _stage.name + ")"); _transform = _gameObject.transform; _transform.parent = Futile.instance.gameObject.transform; _meshFilter = _gameObject.AddComponent <MeshFilter>(); _meshRenderer = _gameObject.AddComponent <MeshRenderer>(); _meshRenderer.castShadows = false; _meshRenderer.receiveShadows = false; _mesh = _meshFilter.mesh; _material = new Material(_shader.shader); _material.mainTexture = _atlas.texture; _meshRenderer.renderer.material = _material; _gameObject.active = false; ExpandMaxQuadLimit(Futile.startingQuadsPerLayer); UpdateTransform(); }
void Start() { RXDebug.Log("Starting the demo"); instance = this; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; FutileParams fparams = new FutileParams(true,true, false,false); fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, ""); //iPhone // fparams.AddResolutionLevel(960.0f, 2.0f, 2.0f, "_Scale2"); //iPhone retina fparams.AddResolutionLevel(1024.0f, 1.0f, 1.0f, ""); //iPad // fparams.AddResolutionLevel(1280.0f, 2.0f, 2.0f, "_Scale2"); //Nexus 7 // fparams.AddResolutionLevel(2048.0f, 4.0f, 4.0f, "_Scale4"); //iPad Retina fparams.origin = new Vector2(0.5f,0.5f); Futile.instance.Init (fparams); Futile.atlasManager.LoadAtlas("Atlases/SFB"); Futile.atlasManager.LoadAtlas("Atlases/SFB_en"); Futile.atlasManager.LoadFont("font", "font", "Atlases/font", 0, 0); _stage = Futile.stage; GoToPage(PageType.MenuPage); _stage.ListenForUpdate (HandleUpdate); }
public static void SwitchToScene(SceneType sceneType) { FStage oldScene = null; oldScene = currentScene; if (sceneType == SceneType.MergeNamesScene) currentScene = new TMergeNamesScene(); else if (sceneType == SceneType.ClickHeartsScene) currentScene = new TClickHeartsScene(); else if (sceneType == SceneType.PeopleSceneGoalOne) { currentScene = new TPeopleScene(GoalType.GoalOne); goalOneTutorialIsDone = true; } else if (sceneType == SceneType.PeopleSceneGoalTwo) currentScene = new TPeopleScene(GoalType.GoalTwo); else if (sceneType == SceneType.PeopleSceneGoalThree) currentScene = new TPeopleScene(GoalType.GoalThree); else if (sceneType == SceneType.DreamSceneOne) currentScene = new TDreamScene(DreamSceneType.DreamSceneOne); else if (sceneType == SceneType.DreamSceneTwo) currentScene = new TDreamScene(DreamSceneType.DreamSceneTwo); if (oldScene != null) { currentScene.alpha = 0; Go.to(oldScene, 0.3f, new TweenConfig().floatProp("alpha", 0.0f).onComplete(OnOldSceneCompletedFadingOut)); Go.to(currentScene, 0.3f, new TweenConfig().floatProp("alpha", 1.0f)); } Futile.AddStage(currentScene); Futile.AddStage(labelDisplayLayer); // move to top }
public void GoToMenu(PageType pageType) { if(currentPageType == pageType) return; // already on this menu // Get the stage stage_ = Futile.stage; // Remove the current page if it exists if(currentPage != null && stage_ != null){ stage_.RemoveChild(currentPage); } // Set new page and page type switch(pageType){ case PageType.TitlePage: currentPageType = PageType.TitlePage; currentPage = new TitlePage(); break; case PageType.LevelSelectPage: currentPageType = PageType.LevelSelectPage; currentPage = new LevelSelectPage(); break; case PageType.CreditsPage: currentPageType = PageType.CreditsPage; currentPage = new CreditsPage(); break; } // Add the page and init it stage_.AddChild(currentPage); currentPage.Start(); }
void Start() { instance = this; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; FutileParams fparams = new FutileParams(true, true, false, false); fparams.AddResolutionLevel(960.0f, 1.0f, 1.0f, ""); //iPhone fparams.origin = new Vector2(0.5f, 0.5f); fparams.backgroundColor = new Color(18f / 100f, 13f / 100f, 28f / 100f, 1f); Futile.instance.Init(fparams); Futile.atlasManager.LoadImage("Atlases/Font"); Futile.atlasManager.LoadImage("Atlases/title"); Futile.atlasManager.LoadImage("Atlases/bg"); Futile.atlasManager.LoadAtlas("Atlases/SpriteSheet"); Futile.atlasManager.LoadFont("Minecraftia", "Atlases/Font", "Atlases/Font", 0, 0); _stage = Futile.stage; GoToPage(PageType.MainMenuPage); _stage.ListenForUpdate(HandleUpdate); }
static public void AddStageAtIndex(FStage stageToAdd, int newIndex) { int stageIndex = _stages.IndexOf(stageToAdd); if (newIndex > _stages.Count) //if it's past the end, make it at the end { newIndex = _stages.Count; } if (stageIndex == newIndex) { return; //if it's already at the right index, just leave it there } if (stageIndex == -1) //add it if it's not in the stages already { stageToAdd.HandleAddedToFutile(); _stages.Insert(newIndex, stageToAdd); } else //if stage is already in the stages, move it to the desired index { _stages.RemoveAt(stageIndex); if (stageIndex < newIndex) { _stages.Insert(newIndex - 1, stageToAdd); //gotta subtract 1 to account for it moving in the order } else { _stages.Insert(newIndex, stageToAdd); } } UpdateStageIndices(); }
public MonklandUI(FStage stage) { displayMessages = new List <QuickDisplayMessage>(); uiLabels = new List <FLabel>(); worldStage = stage; uiContainer = new FContainer(); string text = "Monkland " + Monkland.VERSION; if (!MonklandSteamManager.DEBUG) { text = ""; } statusLabel = new FLabel("font", text); statusLabel.alignment = FLabelAlignment.Left; statusLabel.SetPosition(50.01f, Futile.screen.height - 49.99f); uiContainer.AddChild(statusLabel); for (int i = 0; i < 200; i++) { FLabel displayLabel = new FLabel("font", ""); displayLabel.alignment = FLabelAlignment.Left; uiContainer.AddChild(displayLabel); uiLabels.Add(displayLabel); } displayMessages.Clear(); stage.AddChild(uiContainer); }
void Start() { RXDebug.Log("Starting the demo"); instance = this; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; FutileParams fparams = new FutileParams(true, true, false, false); fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, ""); //iPhone // fparams.AddResolutionLevel(960.0f, 2.0f, 2.0f, "_Scale2"); //iPhone retina fparams.AddResolutionLevel(1024.0f, 1.0f, 1.0f, ""); //iPad // fparams.AddResolutionLevel(1280.0f, 2.0f, 2.0f, "_Scale2"); //Nexus 7 // fparams.AddResolutionLevel(2048.0f, 4.0f, 4.0f, "_Scale4"); //iPad Retina fparams.origin = new Vector2(0.5f, 0.5f); Futile.instance.Init(fparams); Futile.atlasManager.LoadAtlas("Atlases/SFB"); Futile.atlasManager.LoadAtlas("Atlases/SFB_en"); Futile.atlasManager.LoadFont("font", "font", "Atlases/font", 0, 0); _stage = Futile.stage; GoToPage(PageType.MenuPage); _stage.ListenForUpdate(HandleUpdate); }
void Start() { instance = this; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; FutileParams fparams = new FutileParams(true, true, false, false); fparams.AddResolutionLevel(960.0f, 1.0f, 1.0f, ""); //iPhone fparams.origin = new Vector2(0.5f,0.5f); fparams.backgroundColor = new Color(18f / 100f, 13f / 100f, 28f / 100f, 1f); Futile.instance.Init (fparams); Futile.atlasManager.LoadImage("Atlases/Font"); Futile.atlasManager.LoadImage("Atlases/title"); Futile.atlasManager.LoadImage("Atlases/bg"); Futile.atlasManager.LoadAtlas("Atlases/SpriteSheet"); Futile.atlasManager.LoadFont("Minecraftia", "Atlases/Font", "Atlases/Font", 0, 0); _stage = Futile.stage; GoToPage(PageType.MainMenuPage); _stage.ListenForUpdate (HandleUpdate); }
private void Start() { instance = this; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; //Time.timeScale = 0.4f; // ======= FUTILE INIT ======= // FutileParams fparams = new FutileParams(true, true, false, false); fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, "_Scale1"); //iPhone fparams.AddResolutionLevel(960.0f, 2.0f, 2.0f, "_Scale2"); //iPhone retina fparams.AddResolutionLevel(1280.0f, 2.0f, 2.0f, "_Scale2"); //Nexus 7 fparams.origin = new Vector2(0.5f, 0.5f); Futile.instance.Init(fparams); Futile.atlasManager.LoadAtlas("Atlases/BananaLargeAtlas"); Futile.atlasManager.LoadAtlas("Atlases/BananaGameAtlas"); Futile.atlasManager.LoadFont("Franchise", "FranchiseFont" + Futile.resourceSuffix, "Atlases/FranchiseFont" + Futile.resourceSuffix, 0.0f, -4.0f); // ======= ENVIRONMENT INIT ======= // _stage = Futile.stage; FSoundManager.PlayMusic("NormalMusic", 0.5f); // ======= GAME INIT ======= // bad_foods.AddRange(new string[] { "Banana" }); // ======= SWITCH PAGE ======= // // GoToPage(BPageType.TitlePage); GoToPage(BPageType.SelectPage); }
public FRenderLayer(FStage stage, FAtlas atlas, FShader shader) { _stage = stage; _atlas = atlas; _shader = shader; _expansionAmount = Futile.quadsPerLayerExpansion; _maxEmptyQuads = Futile.maxEmptyQuadsPerLayer; batchIndex = atlas.index*10000 + shader.index; _gameObject = new GameObject("FRenderLayer ("+_stage.name+")"); _transform = _gameObject.transform; _transform.parent = Futile.instance.gameObject.transform; _meshFilter = _gameObject.AddComponent<MeshFilter>(); _meshRenderer = _gameObject.AddComponent<MeshRenderer>(); _meshRenderer.castShadows = false; _meshRenderer.receiveShadows = false; _mesh = _meshFilter.mesh; _material = new Material(_shader.shader); _material.mainTexture = _atlas.texture; _meshRenderer.renderer.material = _material; _gameObject.active = false; ExpandMaxQuadLimit(Futile.startingQuadsPerLayer); UpdateTransform(); }
void Start() { instance = this; //设置引擎参数 FutileParams fparams = new FutileParams(true, true, true, false); fparams.AddResolutionLevel(1400f, 1f, 1f, string.Empty); fparams.origin = new Vector2(0.5f, 0.5f); //RW原点在 0,0 //初始化引擎 Futile.instance.Init(fparams); //加载纹理资源 this.tentaclePlants = Resources.Load("TPlantDemo_1") as Texture2D; Futile.atlasManager.LoadAtlasFromTexture("TPlantDemo_1", tentaclePlants); _stage = Futile.stage; Debug.Log("测试运行开始"); //测试方法 TestPage testPage = new TestPage(); _stage.AddChild(testPage); testPage.Start(); TestMethod(); Debug.Log("测试路径读取:" + RootFolderDirectory()); }
public void HandleWin() { FStage UIstage = new FStage("UI"); Futile.AddStage(UIstage); UIstage.AddChild(new FLabel("Abstract", string.Format("WINNER\nSAVED: {0}", c.PersonCount))); RemoveListenForUpdate(); }
public void HandleGameOver() { FStage UIstage = new FStage("UI"); Futile.AddStage(UIstage); UIstage.AddChild(new FLabel("Abstract", "GAME OVER")); RemoveListenForUpdate(); }
private FSceneManager() : base() { mScenes = new List <FScene>(); mStage = Futile.stage; mStage.AddChild(this); mTransition = null; }
static public void RemoveStage(FStage stageToRemove) { stageToRemove.HandleRemovedFromFutile(); stageToRemove.index = -1; _stages.Remove(stageToRemove); UpdateStageIndices(); }
public void SwitchToScene(SceneType sceneType) { if (currentScene != null) Futile.RemoveStage(currentScene); if (sceneType == SceneType.Immunity) currentScene = new WTImmunity(); if (sceneType == SceneType.None) currentScene = null; if (currentScene != null) Futile.AddStage(currentScene); }
// Use this for initialization void Start() { FutileParams futileParams = new FutileParams(true, true, true, true); manager = new MouseManager(this); futileParams.AddResolutionLevel(800, 1, 1, ""); futileParams.origin = new Vector2( 0.0f, 0.0f); Futile.instance.Init(futileParams); Futile.atlasManager.LoadImage("grasstile"); Futile.atlasManager.LoadImage("foresttile"); Futile.atlasManager.LoadImage("soldier"); Futile.atlasManager.LoadImage("bluehighlight"); var tileSize = 30; var width = 50; var height = 35; var tiles = new TileProperties[width, height]; var grassTile = new TileProperties() { SpriteName = "grasstile", MovementPenalty = 1 }; var forestTile = new TileProperties() { SpriteName = "foresttile", MovementPenalty = 2 }; var actorProps = new ActorProperties() { SpriteName = "soldier", Name = "Hunkfort", MovementPoints = 5 }; var rand = new System.Random(); for (int ii = 0; ii < width; ii++) { for (int jj = 0; jj < height; jj++) { tiles[ii, jj] = (rand.NextDouble() < 0.7) ? grassTile : forestTile; } } this.map = new Map(tiles, tileSize); this.map.AddActor(actorProps, new Vector2i(5, 5)); this.map.Start(); tileStage = new FStage("test"); Futile.AddStage(tileStage); tileStage.stage.AddChild(this.map); }
public void Init(FutileParams futileParams) { enabled = true; _futileParams = futileParams; Application.targetFrameRate = _futileParams.targetFrameRate; FShader.Init(); //set up the basic shaders FFacetType.Init(); //set up the types of facets (Quads, Triangles, etc) screen = new FScreen(_futileParams); // //Camera setup from https://github.com/prime31/UIToolkit/blob/master/Assets/Plugins/UIToolkit/UI.cs // if (existingCamera != null) { _cameraHolder = existingCamera.gameObject; _camera = existingCamera; } else { _cameraHolder = new GameObject(); _camera = _cameraHolder.AddComponent <Camera>(); } _cameraHolder.transform.parent = gameObject.transform; _camera.tag = "MainCamera"; _camera.clearFlags = CameraClearFlags.SolidColor; _camera.nearClipPlane = 0.0f; _camera.farClipPlane = 500.0f; _camera.depth = 100; _camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); _camera.backgroundColor = _futileParams.backgroundColor; //we multiply this stuff by scaleInverse to make sure everything is in points, not pixels _camera.orthographic = true; _camera.orthographicSize = screen.pixelHeight / 2 * displayScaleInverse; UpdateCameraPosition(); touchManager = new FTouchManager(); atlasManager = new FAtlasManager(); CreateDefaultAtlases(); _stages = new List <FStage>(); stage = new FStage("Futile.stage"); AddStage(stage); }
private FSceneManager() : base() { mScenes = new List <FScene>(); mRemoveScenes = new List <FScene>(); mStage = Futile.stage; mStage.AddChild(this); ListenForUpdate(HandleUpdate); }
private FSceneManager() : base() { mScenes = new List<FScene>(); mRemoveScenes = new List<FScene>(); mStage = Futile.stage; mStage.AddChild( this ); ListenForUpdate( HandleUpdate ); }
public void SwitchToScene(SceneType sceneType) { if (currentScene != null) Futile.RemoveStage(currentScene); if (sceneType == SceneType.Compartments) currentScene = new WTCompartments(); if (sceneType == SceneType.BlahGame) currentScene = new WTBlahGame(); if (sceneType == SceneType.FrendenGame) currentScene = new WTFrendenGame(); if (sceneType == SceneType.Hexagon) currentScene = new WTHexagon(); if (sceneType == SceneType.None) currentScene = null; if (currentScene != null) Futile.AddStage(currentScene); }
public void Init(FutileParams futileParams) { enabled = true; _futileParams = futileParams; //设置游戏帧率 Application.targetFrameRate = _futileParams.targetFrameRate; //设置basic shaders FShader.Init(); //设置facets' types (Quads, Triangles, etc) FFacetType.Init(); //初始化各引擎组件实例 screen = new FScreen(_futileParams); touchManager = new FTouchManager(); atlasManager = new FAtlasManager(); //设置主相机参数:Setup from https://github.com/prime31/UIToolkit/blob/master/Assets/Plugins/UIToolkit/UI.cs _cameraHolder = new GameObject(); _cameraHolder.transform.parent = gameObject.transform; _camera = _cameraHolder.AddComponent <Camera>(); _camera.tag = "MainCamera"; _camera.name = "Camera"; //_camera.clearFlags = CameraClearFlags.Depth; //TODO: check if this is faster or not? _camera.clearFlags = CameraClearFlags.SolidColor; _camera.nearClipPlane = 0.0f; _camera.farClipPlane = 500.0f; _camera.depth = 100; _camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); _camera.backgroundColor = _futileParams.backgroundColor; //we multiply this stuff by scaleInverse to make sure everything is in points, not pixels _camera.orthographic = true; _camera.orthographicSize = screen.pixelHeight / 2 * displayScaleInverse; UpdateCameraPosition(); //创建默认Atlas CreateDefaultAtlases(); //初始化Stage管理 _stages = new List <FStage>(); stage = new FStage("Futile.stage"); AddStage(stage); }
void Start() { instance = this; FutileParams fparams = new FutileParams(true, true, false, false); fparams.AddResolutionLevel(1280.0f, 1.0f, 1.0f, ""); fparams.origin = new Vector2(0.5f, 0.5f); Futile.instance.Init(fparams); Futile.atlasManager.LoadAtlas("Atlases/CombatAtlas"); Futile.atlasManager.LoadAtlas("Atlases/stomach_atlas"); Futile.atlasManager.LoadAtlas("Atlases/lung_background"); Futile.atlasManager.LoadAtlas("Atlases/lung_layers"); Futile.atlasManager.LoadAtlas("Atlases/lung_dust"); Futile.atlasManager.LoadAtlas("Atlases/BrainAtlas"); Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_80_animation"); Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_60_animation"); Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_40_animation"); Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_80_animation"); Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_60_animation"); Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_40_animation"); Futile.atlasManager.LoadAtlas ("Atlases/Victory-DefeatAtlas"); FSoundManager.PreloadSound("player_hit"); FSoundManager.PreloadSound("bacteria_pop"); Futile.atlasManager.LogAllElementNames(); stage_ = Futile.stage; camera_ = new FCamObject(); stage_.AddChild(camera_); //Rect worldBounds = stage.worldBounds; camera_.setWorldBounds (worldBounds); //make the camera follow the player camera_.setBounds(cameraBounds); gamePage = new CombatPage(); gamePage.Start(); camera_.AddChild(gamePage); }
public FFacetRenderLayer(FStage stage, FFacetType facetType, FAtlas atlas, FShader shader) { this.stage = stage; this.facetType = facetType; this.atlas = atlas; this.shader = shader; _expansionAmount = facetType.expansionAmount; _maxEmptyFacets = facetType.maxEmptyAmount; this.batchIndex = facetType.index * 10000000 + atlas.index * 10000; _gameObject = new GameObject("FRenderLayer (" + stage.name + ") (" + facetType.name + ")"); _transform = _gameObject.transform; _transform.parent = Futile.instance.gameObject.transform; _meshFilter = _gameObject.AddComponent <MeshFilter>(); _meshRenderer = _gameObject.AddComponent <MeshRenderer>(); // warning CS0618: `UnityEngine.Renderer.castShadows' is obsolete: `Property castShadows has been deprecated. Use shadowCastingMode instead.' // UNITY5 UPDATE: http://docs.unity3d.com/ScriptReference/MeshRenderer.html // http://docs.unity3d.com/ScriptReference/Renderer-shadowCastingMode.html // http://docs.unity3d.com/ScriptReference/Rendering.ShadowCastingMode.html //_meshRenderer.castShadows = false; _meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; _meshRenderer.receiveShadows = false; _meshRenderer.useLightProbes = false; _meshRenderer.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off; _mesh = _meshFilter.mesh; //we could possibly create a pool of materials so they can be reused, //but that would create issues when unloading textures, so it's probably not worth it _material = new Material(shader.shader); _material.mainTexture = atlas.texture; _meshRenderer.GetComponent <Renderer>().sharedMaterial = _material; #if UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 _gameObject.active = false; #else _gameObject.SetActive(false); _mesh.MarkDynamic(); #endif ExpandMaxFacetLimit(facetType.initialAmount); UpdateTransform(); }
void SetupUI() { FStage uiStage = new FStage("uiStage"); timer = new FLabel("Abstract", st.TimeStamp); bestTime = new FLabel("Abstract", "Best:\n" + st.TimeStamp); timer.SetAnchor(0, 1); timer.scale = 3; bestTime.SetAnchor(0, 1); bestTime.x = Futile.screen.width - bestTime.textRect.width * 3; bestTime.scale = 3; uiStage.AddChild(timer); uiStage.AddChild(bestTime); Futile.AddStage(uiStage); }
void Start() { instance = this; FutileParams fparams = new FutileParams(true, true, false, false); fparams.AddResolutionLevel(1280.0f, 1.0f, 1.0f, ""); fparams.origin = new Vector2(0.5f, 0.5f); Futile.instance.Init(fparams); Futile.atlasManager.LoadAtlas("Atlases/CombatAtlas"); Futile.atlasManager.LoadAtlas("Atlases/stomach_atlas"); Futile.atlasManager.LoadAtlas("Atlases/lung_background"); Futile.atlasManager.LoadAtlas("Atlases/lung_layers"); Futile.atlasManager.LoadAtlas("Atlases/lung_dust"); Futile.atlasManager.LoadAtlas("Atlases/BrainAtlas"); Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_80_animation"); Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_60_animation"); Futile.atlasManager.LoadAtlas("Atlases/neuron_fast_40_animation"); Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_80_animation"); Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_60_animation"); Futile.atlasManager.LoadAtlas("Atlases/neuron_slow_40_animation"); Futile.atlasManager.LoadAtlas("Atlases/Victory-DefeatAtlas"); FSoundManager.PreloadSound("player_hit"); FSoundManager.PreloadSound("bacteria_pop"); Futile.atlasManager.LogAllElementNames(); stage_ = Futile.stage; camera_ = new FCamObject(); stage_.AddChild(camera_); //Rect worldBounds = stage.worldBounds; //camera_.setWorldBounds (worldBounds); //camera_.setBounds(stage.cameraBounds); gamePage = new CombatPage(); gamePage.Start(); camera_.AddChild(gamePage); }
public void Init(FutileParams futileParams) { enabled = true; _futileParams = futileParams; Application.targetFrameRate = _futileParams.targetFrameRate; FShader.Init(); //set up the basic shaders Futile.startingQuadsPerLayer = _futileParams.startingQuadsPerLayer; Futile.quadsPerLayerExpansion = _futileParams.quadsPerLayerExpansion; Futile.maxEmptyQuadsPerLayer = _futileParams.maxEmptyQuadsPerLayer; screen = new FScreen(_futileParams); // //Camera setup from https://github.com/prime31/UIToolkit/blob/master/Assets/Plugins/UIToolkit/UI.cs // _cameraHolder = new GameObject(); _cameraHolder.transform.parent = gameObject.transform; _camera = _cameraHolder.AddComponent <Camera>(); _camera.name = "Camera"; //_camera.clearFlags = CameraClearFlags.Depth; //TODO: check if this is faster or not? _camera.clearFlags = CameraClearFlags.SolidColor; _camera.nearClipPlane = -50.0f; _camera.farClipPlane = 50.0f; _camera.depth = 100; _camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); _camera.backgroundColor = _futileParams.backgroundColor; //we multiply this stuff by scaleInverse to make sure everything is in points, not pixels _camera.orthographic = true; _camera.orthographicSize = screen.pixelHeight / 2 * displayScaleInverse; UpdateCameraPosition(); touchManager = new FTouchManager(); atlasManager = new FAtlasManager(); _stages = new List <FStage>(); stage = new FStage("Futile.stage"); AddStage(stage); }
// Use this for initialization void Start() { Instance = this; FutileParams fparams = new FutileParams(true, false, false, false); fparams.AddResolutionLevel(1024.0f, 1.0f, 1.0f, ""); fparams.origin = new Vector2(0.5f, 0.5f); Futile.instance.Init(fparams); Futile.atlasManager.LoadImage("Atlases/abstract_0"); Futile.atlasManager.LoadFont("Abstract", "Atlases/abstract_0", "Atlases/abstract", 0, 0); _stage = Futile.stage; this.GoToPage(BPageType.InGamePage); }
// Use this for initialization void Start() { Instance = this; FutileParams fparams = new FutileParams(true, false, false, false); fparams.AddResolutionLevel(1024.0f, 1.0f, 1.0f, ""); fparams.origin = new Vector2(0, 1); Futile.instance.Init(fparams); Futile.atlasManager.LoadImage("Atlases/abstract_0"); Futile.atlasManager.LoadFont("Abstract", "Atlases/abstract_0", "Atlases/abstract", 0, 0); _stage = Futile.stage; this.GoToPage(BPageType.InGamePage); }
static public void AddStage(FStage stageToAdd) { int stageIndex = _stages.IndexOf(stageToAdd); if (stageIndex == -1) //add it if it's not a stage { stageToAdd.HandleAddedToFutile(); _stages.Add(stageToAdd); UpdateStageIndices(); } else if (stageIndex != _stages.Count - 1) //if stage is already in the stages, put it at the top of the stages if it's not already { _stages.RemoveAt(stageIndex); _stages.Add(stageToAdd); UpdateStageIndices(); } }
public FFacetRenderLayer(FStage stage, FFacetType facetType, FAtlas atlas, FShader shader) { _stage = stage; _facetType = facetType; _atlas = atlas; _shader = shader; _expansionAmount = _facetType.expansionAmount; _maxEmptyFacets = _facetType.maxEmptyAmount; batchIndex = _facetType.index * 10000000 + atlas.index * 10000 + shader.index; _gameObject = new GameObject("FRenderLayer (" + _stage.name + ") (" + _facetType.name + ")"); //Esteban. _gameObject.layer = 11; _stage.layer = 11; _transform = _gameObject.transform; _transform.parent = Futile.instance.gameObject.transform; _meshFilter = _gameObject.AddComponent <MeshFilter>(); _meshRenderer = _gameObject.AddComponent <MeshRenderer>(); _meshRenderer.castShadows = false; _meshRenderer.receiveShadows = false; _mesh = _meshFilter.mesh; _material = new Material(_shader.shader); _material.mainTexture = _atlas.texture; _meshRenderer.renderer.material = _material; #if UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 _gameObject.active = false; #else _gameObject.SetActive(false); _mesh.MarkDynamic(); #endif ExpandMaxFacetLimit(_facetType.initialAmount); UpdateTransform(); }
public static void SwitchToScene(SceneType sceneType) { FStage oldScene = null; oldScene = currentScene; if (sceneType == SceneType.MergeNamesScene) { currentScene = new TMergeNamesScene(); } else if (sceneType == SceneType.ClickHeartsScene) { currentScene = new TClickHeartsScene(); } else if (sceneType == SceneType.PeopleSceneGoalOne) { currentScene = new TPeopleScene(GoalType.GoalOne); goalOneTutorialIsDone = true; } else if (sceneType == SceneType.PeopleSceneGoalTwo) { currentScene = new TPeopleScene(GoalType.GoalTwo); } else if (sceneType == SceneType.PeopleSceneGoalThree) { currentScene = new TPeopleScene(GoalType.GoalThree); } else if (sceneType == SceneType.DreamSceneOne) { currentScene = new TDreamScene(DreamSceneType.DreamSceneOne); } else if (sceneType == SceneType.DreamSceneTwo) { currentScene = new TDreamScene(DreamSceneType.DreamSceneTwo); } if (oldScene != null) { currentScene.alpha = 0; Go.to(oldScene, 0.3f, new TweenConfig().floatProp("alpha", 0.0f).onComplete(OnOldSceneCompletedFadingOut)); Go.to(currentScene, 0.3f, new TweenConfig().floatProp("alpha", 1.0f)); } Futile.AddStage(currentScene); Futile.AddStage(labelDisplayLayer); // move to top }
public static void SwitchToScene(SceneType sceneType) { if (currentScene != null) Futile.RemoveStage(currentScene); if (sceneType == SceneType.GameScene) { currentScene = new SBGameScene(true); FSoundManager.StopMusic(); } if (sceneType == SceneType.TitleScene) { currentScene = new SBTitleScene(); Futile.AddStage(currentScene); } if (sceneType == SceneType.HelpScene) { currentScene = new SBHelpScene(); Futile.AddStage(currentScene); } if (sceneType == SceneType.None) currentScene = null; }
public FFacetRenderLayer(FStage stage, FFacetType facetType, FAtlas atlas, FShader shader) { _stage = stage; _facetType = facetType; _atlas = atlas; _shader = shader; _expansionAmount = _facetType.expansionAmount; _maxEmptyFacets = _facetType.maxEmptyAmount; batchIndex = _facetType.index * 10000000 + atlas.index * 10000 + shader.index; _gameObject = new GameObject("FRenderLayer (" + _stage.name + ") (" + _facetType.name + ")"); _transform = _gameObject.transform; _transform.parent = Futile.instance.gameObject.transform; _meshFilter = _gameObject.AddComponent <MeshFilter>(); _meshRenderer = _gameObject.AddComponent <MeshRenderer>(); _meshRenderer.castShadows = false; _meshRenderer.receiveShadows = false; _mesh = _meshFilter.mesh; //we could possibly create a pool of materials so they can be reused, //but that would create issues when unloading textures, so it's probably not worth it _material = new Material(_shader.shader); _material.mainTexture = _atlas.texture; _meshRenderer.GetComponent <Renderer>().sharedMaterial = _material; #if UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 _gameObject.active = false; #else _gameObject.SetActive(false); _mesh.MarkDynamic(); #endif ExpandMaxFacetLimit(_facetType.initialAmount); UpdateTransform(); }
public World() { instance = this; isGameOver = false; root = FPWorld.Create(64.0f); AddChild(backParticles = new FParticleSystem(150)); AddChild(chainHolder = new FContainer()); AddChild(beastShadowHolder = new FContainer()); AddChild(beastHolder = new FContainer()); AddChild(effectHolder = new FContainer()); AddChild(glowParticles = new FParticleSystem(150)); glowParticles.shader = FShader.Additive; AddChild(orbHolder = new FContainer()); uiStage = new FStage("UIStage"); Futile.AddStage(uiStage); uiStage.scale = Futile.stage.scale; uiStage.AddChild(uiHolder = new FContainer()); teams = GameManager.instance.activeTeams; InitBeasts(); InitOrbs(); InitUI(); spawnRateMultiplier = 1.0f; walls = new Walls(this); ListenForUpdate(HandleUpdate); Input.ResetInputAxes(); }
public FFacetRenderLayer(FStage stage, FFacetType facetType, FAtlas atlas, FShader shader) { this.stage = stage; this.facetType = facetType; this.atlas = atlas; this.shader = shader; _expansionAmount = facetType.expansionAmount; _maxEmptyFacets = facetType.maxEmptyAmount; this.batchIndex = facetType.index*10000000 + atlas.index*10000; _gameObject = new GameObject("FRenderLayer ("+stage.name+") ("+facetType.name+")"); _transform = _gameObject.transform; _transform.parent = Futile.instance.gameObject.transform; _meshFilter = _gameObject.AddComponent<MeshFilter>(); _meshRenderer = _gameObject.AddComponent<MeshRenderer>(); _meshRenderer.castShadows = false; _meshRenderer.receiveShadows = false; _mesh = _meshFilter.mesh; //we could possibly create a pool of materials so they can be reused, //but that would create issues when unloading textures, so it's probably not worth it _material = new Material(shader.shader); _material.mainTexture = atlas.texture; _meshRenderer.GetComponent<Renderer>().sharedMaterial = _material; #if UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 _gameObject.active = false; #else _gameObject.SetActive(false); _mesh.MarkDynamic(); #endif ExpandMaxFacetLimit(facetType.initialAmount); UpdateTransform(); }
void Start() { instance = this; GameTime = 0.0f; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; bool landscape = true; bool portrait = false; // iOS support later! bool isIPad = SystemInfo.deviceModel.Contains("iPad"); bool shouldSupportPortraitUpsideDown = isIPad && portrait; //only support portrait upside-down on iPad FutileParams fparams = new FutileParams(landscape, landscape, portrait, shouldSupportPortraitUpsideDown); fparams.backgroundColor = Color.grey; //new Color(0.0745f,0.0745f,0.0745f,1.0f); // RXColor.GetColorFromHex(0x74CBFF); //light blue 0x94D7FF or 0x74CBFF fparams.AddResolutionLevel(1280.0f, 1.0f, 1.0f, ""); fparams.origin = new Vector2(0.0f, 0.0f); Futile.instance.Init(fparams); Futile.atlasManager.LoadAtlas("Atlases/GameAtlas"); Futile.atlasManager.LoadAtlas("Atlases/LevelAtlas"); Futile.atlasManager.LoadAtlas("Atlases/BackgroundAtlas"); //Futile.atlasManager.LoadAtlas("Atlases/FontAtlas"); //Futile.atlasManager.LoadAtlas("Atlases/BackgroundAtlas"); //Futile.atlasManager.LoadFont("emulogic64", "emulogic64", "Atlases/FontAtlas", 0, 0); Futile.atlasManager.LoadFont("Emulogic", "emulogic", "Atlases/emulogic", 0, 0); //FLabel test = new FLabel("Emulogic", "Hello World"); _stage = Futile.stage; //_stage.AddChild(test); GoToPage(PageType.TitlePage); _stage.ListenForUpdate(HandleUpdate); _stage.ListenForResize(HandleResize); }
public void GoToMenu(PageType pageType) { if (currentPageType == pageType) { return; // already on this menu } // Get the stage stage_ = Futile.stage; // Remove the current page if it exists if (currentPage != null && stage_ != null) { stage_.RemoveChild(currentPage); } // Set new page and page type switch (pageType) { case PageType.TitlePage: currentPageType = PageType.TitlePage; currentPage = new TitlePage(); break; case PageType.LevelSelectPage: currentPageType = PageType.LevelSelectPage; currentPage = new LevelSelectPage(); break; case PageType.CreditsPage: currentPageType = PageType.CreditsPage; currentPage = new CreditsPage(); break; case PageType.HowToPlayPage: currentPageType = PageType.HowToPlayPage; currentPage = new HowToPlayPage(); break; } // Add the page and init it stage_.AddChild(currentPage); currentPage.Start(); }
public FFacetRenderLayer(FStage stage, FFacetType facetType, FAtlas atlas, FShader shader) { this.stage = stage; this.facetType = facetType; this.atlas = atlas; this.shader = shader; _expansionAmount = facetType.expansionAmount; _maxEmptyFacets = facetType.maxEmptyAmount; this.batchIndex = facetType.index*10000000 + atlas.index*10000; _gameObject = new GameObject("FRenderLayer ("+stage.name+") ("+facetType.name+")"); _transform = _gameObject.transform; _transform.parent = Futile.instance.gameObject.transform; _meshFilter = _gameObject.AddComponent<MeshFilter>(); _meshRenderer = _gameObject.AddComponent<MeshRenderer>(); _meshRenderer.castShadows = false; _meshRenderer.receiveShadows = false; _mesh = _meshFilter.mesh; _material = new Material(shader.shader); _material.mainTexture = atlas.texture; _meshRenderer.renderer.sharedMaterial = _material; //_meshRenderer.renderer.material = _material; #if UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 _gameObject.active = false; #else _gameObject.SetActive(false); _mesh.MarkDynamic(); #endif ExpandMaxFacetLimit(facetType.initialAmount); UpdateTransform(); }
public FFacetRenderLayer(FStage stage, FFacetType facetType, FAtlas atlas, FShader shader) { _stage = stage; _facetType = facetType; _atlas = atlas; _shader = shader; _expansionAmount = _facetType.expansionAmount; _maxEmptyFacets = _facetType.maxEmptyAmount; batchIndex = _facetType.index*10000000 + atlas.index*10000 + shader.index; _gameObject = new GameObject("FRenderLayer ("+_stage.name+") ("+_facetType.name+")"); _transform = _gameObject.transform; _transform.parent = Futile.instance.gameObject.transform; _meshFilter = _gameObject.AddComponent<MeshFilter>(); _meshRenderer = _gameObject.AddComponent<MeshRenderer>(); //_meshRenderer.castShadows = false; _meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; _meshRenderer.receiveShadows = false; _mesh = _meshFilter.mesh; _material = new Material(_shader.shader); _material.mainTexture = _atlas.texture; _meshRenderer.GetComponent<Renderer>().material = _material; #if UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 _gameObject.active = false; #else _gameObject.SetActive(false); _mesh.MarkDynamic(); #endif ExpandMaxFacetLimit(_facetType.initialAmount); UpdateTransform(); }
public MonklandUI(FStage stage) { worldStage = stage; uiContainer = new FContainer(); statusLabel = new FLabel("font", "STATUSLABEL"); statusLabel.alignment = FLabelAlignment.Left; statusLabel.SetPosition(50, Futile.screen.height - 50); uiContainer.AddChild(statusLabel); for (int i = 0; i < 200; i++) { FLabel displayLabel = new FLabel("font", string.Empty); uiContainer.AddChild(displayLabel); uiLabels.Add(displayLabel); } stage.AddChild(uiContainer); }
public virtual void SetStage(FStage tStage) { if (m_tSprites != null) { foreach (FNode tNode in m_tSprites) { tNode.RemoveFromContainer(); tStage.AddChild(tNode); } } m_tStage = tStage; if (m_tChildren != null) { foreach (UIElement tChild in m_tChildren) { tChild.SetStage(tStage); } } }
public FNode() { _stage = Futile.stage; _depth = 0; _x = 0; _y = 0; _scaleX = 1; _scaleY = 1; _rotation = 0; _alpha = 1.0f; _concatenatedAlpha = 1.0f; _isAlphaDirty = false; _matrix = new FMatrix(); _concatenatedMatrix = new FMatrix(); _isMatrixDirty = false; }
// Use this for initialization void Start() { instance = this; FutileParams futileParams = new FutileParams(false, true, true, false); futileParams.AddResolutionLevel(1040.0f, 1.0f, 1.0f, ""); futileParams.origin = new Vector2(.5f, .5f); Futile.instance.Init(futileParams); Futile.atlasManager.LoadAtlas("Atlas/GameAtlas"); _stage = Futile.stage; GoToPage(TestPageType.TitlePage); }
public void SwitchToScene(SceneType sceneType) { if (currentScene != null) { Futile.RemoveStage(currentScene); } if (sceneType == SceneType.Immunity) { currentScene = new WTImmunity(); } if (sceneType == SceneType.None) { currentScene = null; } if (currentScene != null) { Futile.AddStage(currentScene); } }
// Use this for initialization void Start() { Application.targetFrameRate = 30; QualitySettings.vSyncCount = 0; RXDebug.Log ("Starting the game"); instance = this; FSoundManager.Init (); FutileParams fparams = new FutileParams(true, true, false, false); fparams.targetFrameRate = 30; fparams.AddResolutionLevel (480, 1f, 1.0f, ""); //base res fparams.origin = new Vector2 (0.0f, 0.0f); Futile.instance.Init (fparams); GameConfig.LoadPreviousConfig(); Futile.atlasManager.LoadAtlas("Atlases/SpriteSheet"); Futile.atlasManager.LoadFont("font", "font", "Atlases/font", 0, 0); _stage = Futile.stage; GoToPage (PageType.MenuPage); }
private void Start() { instance = this; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; //Time.timeScale = 0.1f; bool isIPad = SystemInfo.deviceModel.Contains("iPad"); bool shouldSupportPortraitUpsideDown = isIPad; //only support portrait upside-down on iPad FutileParams fparams = new FutileParams(true,true,true,shouldSupportPortraitUpsideDown); fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, "_Scale1"); //iPhone fparams.AddResolutionLevel(960.0f, 2.0f, 2.0f, "_Scale2"); //iPhone retina fparams.AddResolutionLevel(1024.0f, 2.0f, 2.0f, "_Scale2"); //iPad fparams.AddResolutionLevel(1280.0f, 2.0f, 2.0f, "_Scale2"); //Nexus 7 fparams.AddResolutionLevel(2048.0f, 4.0f, 4.0f, "_Scale4"); //iPad Retina fparams.origin = new Vector2(0.5f,0.5f); Futile.instance.Init (fparams); Futile.atlasManager.LoadAtlas("Atlases/BananaLargeAtlas"); Futile.atlasManager.LoadAtlas("Atlases/BananaGameAtlas"); Futile.atlasManager.LoadFont("Franchise","FranchiseFont"+Futile.resourceSuffix, "Atlases/FranchiseFont"+Futile.resourceSuffix, 0.0f,-4.0f); _stage = Futile.stage; FSoundManager.PlayMusic ("NormalMusic",0.5f); GoToPage(BPageType.TitlePage); }
public FRenderLayer(FStage stage, FFacetType facetType, FAtlas atlas, FShader shader) { _stage = stage; _facetType = facetType; _atlas = atlas; _shader = shader; _expansionAmount = _facetType.expansionAmount; _maxEmptyFacets = _facetType.maxEmptyAmount; batchIndex = _facetType.index*10000000 + atlas.index*10000 + shader.index; _gameObject = new GameObject("FRenderLayer ("+_stage.name+") ("+_facetType.name+")"); _transform = _gameObject.transform; _transform.parent = Futile.instance.gameObject.transform; _meshFilter = _gameObject.AddComponent<MeshFilter>(); _meshRenderer = _gameObject.AddComponent<MeshRenderer>(); _meshRenderer.castShadows = false; _meshRenderer.receiveShadows = false; _mesh = _meshFilter.mesh; _material = new Material(_shader.shader); _material.mainTexture = _atlas.texture; _meshRenderer.renderer.material = _material; _gameObject.active = false; ExpandMaxFacetLimit(_facetType.initialAmount); UpdateTransform(); }
public FTriangleRenderLayer(FStage stage, FFacetType facetType, FAtlas atlas, FShader shader) : base(stage,facetType,atlas,shader) { }
private void Start() { instance = this; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; //Screen.showCursor = false; //Time.timeScale = 0.1f; bool landscape = true; bool portrait = false; bool isIPad = SystemInfo.deviceModel.Contains("iPad"); bool shouldSupportPortraitUpsideDown = isIPad && portrait; //only support portrait upside-down on iPad FutileParams fparams = new FutileParams(landscape, landscape, portrait, shouldSupportPortraitUpsideDown); fparams.backgroundColor = RXUtils.GetColorFromHex(0x000000); //light blue 0x94D7FF or 0x74CBFF //fparams.AddResolutionLevel(2560.0f, 2.0f, 2.0f, ""); //1280x720 //fparams.AddResolutionLevel(1280.0f, 1.0f, 2.0f, ""); //1280x720 fparams.AddResolutionLevel(1920.0f, 1.5f, 2.0f, ""); //1920x1080 fparams.AddResolutionLevel(960.0f, 0.75f, 2.0f, ""); //960x540 fparams.origin = new Vector2(0.5f,0.5f); Futile.instance.Init (fparams); Futile.atlasManager.LoadAtlas("Atlases/UIAtlas"); Futile.atlasManager.LoadAtlas("Atlases/UIFonts"); Futile.atlasManager.LoadAtlas("Atlases/BackgroundAtlas"); Futile.atlasManager.LoadAtlas("Atlases/GameAtlas"); FTextParams textParams; textParams = new FTextParams(); textParams.lineHeightOffset = -8.0f; Futile.atlasManager.LoadFont("Franchise","FranchiseFont", "Atlases/FranchiseFont", -2.0f,-5.0f,textParams); textParams = new FTextParams(); textParams.kerningOffset = -0.5f; textParams.lineHeightOffset = -8.0f; Futile.atlasManager.LoadFont("CubanoInnerShadow","Cubano_InnerShadow", "Atlases/CubanoInnerShadow", 0.0f,2.0f,textParams); textParams = new FTextParams(); textParams.lineHeightOffset = -8.0f; textParams.kerningOffset = -0.5f; Futile.atlasManager.LoadFont("CubanoBig","Cubano136", "Atlases/Cubano136", 0.0f,2.0f,textParams); GamepadManager.Init(); GameManager.Init(); _stage = Futile.stage; _stage.AddChild(background = new Background()); GoToPage(TPageType.PagePlayerSelect); _stage.ListenForUpdate (HandleUpdate); FSoundManager.isMuted = !GameConfig.IS_SOUND_ON; _stage.ListenForResize(HandleResize); }
public void Init(FutileParams futileParams) { enabled = true; _futileParams = futileParams; Application.targetFrameRate = _futileParams.targetFrameRate; FShader.Init(); //set up the basic shaders FFacetType.Init(); //set up the types of facets (Quads, Triangles, etc) screen = new FScreen(_futileParams); // //Camera setup from https://github.com/prime31/UIToolkit/blob/master/Assets/Plugins/UIToolkit/UI.cs // _cameraHolder = new GameObject(); _cameraHolder.transform.parent = gameObject.transform; _camera = _cameraHolder.AddComponent<Camera>(); _camera.tag = "MainCamera"; _camera.name = "Camera"; //_camera.clearFlags = CameraClearFlags.Depth; //TODO: check if this is faster or not? _camera.clearFlags = CameraClearFlags.SolidColor; _camera.nearClipPlane = 0.0f; _camera.farClipPlane = 500.0f; _camera.depth = 100; _camera.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); _camera.backgroundColor = _futileParams.backgroundColor; //we multiply this stuff by scaleInverse to make sure everything is in points, not pixels _camera.orthographic = true; _camera.orthographicSize = screen.pixelHeight/2 * displayScaleInverse; UpdateCameraPosition(); touchManager = new FTouchManager(); atlasManager = new FAtlasManager(); CreateDefaultAtlases(); _stages = new List<FStage>(); stage = new FStage("Futile.stage"); AddStage (stage); }
private static FRenderLayer CreateTriLayer(FStage stage, FFacetType facetType, FAtlas atlas, FShader shader) { return new FRenderTriangleLayer(stage,facetType,atlas,shader); }
public static void AddStageAtIndex(FStage stageToAdd, int newIndex) { int stageIndex = _stages.IndexOf(stageToAdd); if(newIndex > _stages.Count) //if it's past the end, make it at the end { newIndex = _stages.Count; } if(stageIndex == newIndex) return; //if it's already at the right index, just leave it there if(stageIndex == -1) //add it if it's not in the stages already { stageToAdd.HandleAddedToFutile(); _stages.Insert(newIndex, stageToAdd); } else //if stage is already in the stages, move it to the desired index { _stages.RemoveAt(stageIndex); if(stageIndex < newIndex) { _stages.Insert(newIndex-1, stageToAdd); //gotta subtract 1 to account for it moving in the order } else { _stages.Insert(newIndex, stageToAdd); } } UpdateStageIndices(); }
public static void AddStage(FStage stageToAdd) { int stageIndex = _stages.IndexOf(stageToAdd); if(stageIndex == -1) //add it if it's not a stage { stageToAdd.HandleAddedToFutile(); _stages.Add(stageToAdd); UpdateStageIndices(); } else if(stageIndex != _stages.Count-1) //if stage is already in the stages, put it at the top of the stages if it's not already { _stages.RemoveAt(stageIndex); _stages.Add(stageToAdd); UpdateStageIndices(); } }
// Use this for initialization void Start() { Instance = this; FutileParams fparams = new FutileParams (true, false, false, false); //Preload audio FSoundManager.Init(); FSoundManager.PlayMusic("dino_ingame", 0); FSoundManager.PlayMusic("dino_music", 0); FScoreManager.Init(); fparams.AddResolutionLevel (480.0f, 1.0f, 1.0f, ""); fparams.origin = new Vector2 (0.5f, 0.5f); Futile.instance.Init (fparams); Futile.atlasManager.LoadAtlas ("Atlases/Game"); Futile.atlasManager.LoadImage ("drumstick2"); Futile.atlasManager.LoadFont ("BitOut", "BitOut_0.png", "Atlases/BitOut"); _stage = Futile.stage; GoToPage(BPageType.MainMenu); }
public static void RemoveStage(FStage stageToRemove) { stageToRemove.HandleRemovedFromFutile(); stageToRemove.index = -1; _stages.Remove(stageToRemove); UpdateStageIndices(); }
public FRenderer(FStage stage) { _stage = stage; }