public override void LoadContent() { for (int i = 0; i < PocetHvezd; i++) { Layers["Background"].Objekty.Add(new Hvezda(this)); } for (int i = 0; i < PocetCtvercu; i++) { Layers["Foreground"].Objekty.Add(new Ctverec(this)); } _ukazatelFPS = new TextObject(this, "", new Vector2(ScreenManager.GraphicsDevice.Viewport.Bounds.Width - 20, 10)) { HorizontAlignment = TextObject.TextAlignment.Far, VerticalAlignment = TextObject.TextAlignment.Near, Scale = new Vector2(0.3f, 0.3f) }; Layers["Gui"].Objekty.Add(_ukazatelFPS); IFollowable follRect = new Controleble(this); Layers["Main"].Objekty.Add((SpriteObject)follRect); MainCam = new FollowingCamera(this, follRect); Layers["Main"].Objekty.Add(new MouseFollowing(this)); Layers["Main"].Objekty.Add(new RotujciText(this, "necum", new Vector2(0, 0))); Layers["Gui"].Objekty.Add(new ClickableText(this, "CLICK ME", new Vector2(200, 200), SwitchScreen)); base.LoadContent(); }
public void TouchSwitch() { if (!ignoreCalls) { FollowingCamera.SetTouchControl(touchscreenToggle.isOn); } }
//Retourne au dernier checkpoint void ReloadCheckpoint() { transform.position = checkpoint.transform.position; //retour à la position du checkpoint Vector2 tabPos = FollowingCamera.TellTab(transform.position); OnDeath((int)tabPos.x, (int)tabPos.y); }
public void Options_CamZoomChanged() { float val = transform.GetChild(OPTIONS_CAMZOOM_SLIDER_INDEX).GetComponent <Slider>().value; FollowingCamera.SetOptimalDistance(val); Transform t = FollowingCamera.camTransform; t.localPosition = t.localPosition.normalized * val; t.LookAt(FollowingCamera.camBasisTransform); }
void Start() { backFollowCam = true; source = GetComponent <AudioSource>(); body = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); fc = GetComponent <FollowingCamera>(); currentScaleX = transform.localScale.x; }
void SaveCameraPos() { PlayerPrefs.SetFloat("xCPos", cam.transform.position.x); PlayerPrefs.SetFloat("yCPos", cam.transform.position.y); PlayerPrefs.SetFloat("zCPos", cam.transform.position.z); FollowingCamera fc = cam.GetComponent <FollowingCamera>(); PlayerPrefs.SetFloat("posX", fc.posX); PlayerPrefs.SetFloat("posY", fc.posY); PlayerPrefs.SetInt("isInArea", (fc.isInArea)?1:0); }
private void Start() { scoreCard = Instantiate(scoreCardPrefab); scoreCard.gameObject.SetActive(false); gameOverPanel = Instantiate(gameOverPanelPrefab); gameOverPanel.gameObject.SetActive(false); scoreCard.OnNextRound += HandleOnNextRound; Table.OnTablesDestroyed += HandleOnTablesDestroyed; followingCamera = Camera.main.GetComponent <FollowingCamera>(); RequiredMoney = CurrentDifficulty.ScaledMoneyGoal(currentRound); SendNextDifficulty(); }
private void Start() { if (PlayerManager.Instance != null) { PlayerManager.Instance.AddPlayer(player); } cam = Camera.main.GetComponent <FollowingCamera>(); highlight = Instantiate(highlightPrefab); AddEventListeners(); PreparePhase(); }
public override void LoadContent() { for (int i = 0; i < 1000; i++) { Layers["Main"].Objekty.Add(new ColidableRectangle(this, Color.Red)); } for (int i = 0; i < 1000; i++) { Layers["Foreground"].Objekty.Add(new ColidableRectangle(this, Color.Blue)); } IFollowable foll = new ColidebleMovable(this); Layers["Main"].Objekty.Add((SpriteObject)foll); MainCam = new FollowingCamera(this, foll); ShowUnder = foll; base.LoadContent(); }
private void CheckForNewPlayers() { PlayerIndex[] freePads = GamePadManager.GetFreeControllers(); for (int i = 0; i < freePads.Length; i++) { if (!IndexInUse(freePads[i])) { GamePadState state = GamePad.GetState(freePads[i]); if (state.IsConnected) { if (state.Buttons.Start == ButtonState.Pressed) { PlayerState newPlayerState = new PlayerState(freePads[i], state, true, 0); GlobalReferences.PlayerStates.Add(newPlayerState); GamePadManager.Connect((int)freePads[i]); if (GlobalReferences.PlayerStates.Count > 1) { FollowingCamera cam = GameObject.FindObjectOfType <FollowingCamera>(); if (cam != null) { if (GlobalReferences.PlayerStates.Count >= 3) { SpawnPlayer(newPlayerState, cam.transform.position + new Vector3(0, 3, 0)); } else { SpawnPlayer(newPlayerState, cam.transform.position + new Vector3(1, 3, 1)); } } else { SpawnPlayer(newPlayerState, Player.LastCheckpointPosition + new Vector3(0, 3, 0)); } } else { SpawnPlayer(newPlayerState, new Vector3(0, 3, 0)); } } } } } }
// Use this for initialization void Awake() { m_dropShip = transform.parent.Find("dropship").GetComponent<DropShip>(); m_edgeRect = transform.Find("EdgeRect").GetComponent<BoxCollider>(); m_followingCamera = Camera.main.GetComponentInChildren<FollowingCamera>(); m_followingCamera.SetMainTarget(m_dropShip.gameObject); m_dungeon = transform.parent.GetComponent<Dungeon>(); int dungeonId = m_dungeon.DungeonId; m_refWorldMap = RefData.Instance.RefWorldMaps[dungeonId]; m_prefItemBox = Resources.Load<GameObject>("Pref/ItemBox/ItemBox"); string[] itemTypeNames = Enum.GetNames(typeof(ItemData.Type)); for(int i = 0; i < itemTypeNames.Length-1; ++i) { m_prefItemBoxSkins[i] = Resources.Load<GameObject>("Pref/ItemBox/item_" + itemTypeNames[i] + "_skin"); if (m_prefItemBoxSkins[i] == null) Debug.Log("Pref/ItemBox/item_" + itemTypeNames[i] + "_skin"); } m_stageText = new YGUISystem.GUILable(GameObject.Find("HudGUI/StatusGUI/Stage").gameObject); m_waveText = new YGUISystem.GUILable(GameObject.Find("HudGUI/StatusGUI/Wave").gameObject); Transform[] goals = transform.Find("GoalPoint").transform.GetComponentsInChildren<Transform>(); m_goalPoints = new Transform[goals.Length-1]; for(int i = 0; i < goals.Length-1; ++i) m_goalPoints[i] = goals[i+1]; }
void Awake() { modelRoot = Main.WorldRoot; dropdown = GetComponent <TMP_Dropdown>(); followingCamera = Main.UIObject.GetComponentInChildren <FollowingCamera>(); }
void Awake() { modelRoot = GameObject.Find("Models"); dropdown = GetComponent <TMP_Dropdown>(); followingCamera = gameObject.transform.root.GetComponentInChildren <FollowingCamera>(); }
void Start() { if (!firstSet) { return; } gameSpeed = 1; editMode = _editMode; if (!editMode) { lifeGrowCoefficient = 1; //Localization.ChangeLanguage(Language.English); if (geologyModule == null) { geologyModule = gameObject.AddComponent <GeologyModule>(); } difficulty = gameStartSettings.difficulty; if (colonyController == null) { colonyController = gameObject.AddComponent <ColonyController>(); colonyController.CreateStorage(); } if (PoolMaster.current == null) { PoolMaster pm = gameObject.AddComponent <PoolMaster>(); pm.Load(); } //byte chunksize = gss.chunkSize; byte chunksize; chunksize = gameStartSettings.chunkSize; if (gameStartSettings.generationMode != ChunkGenerationMode.GameLoading) { if (gameStartSettings.generationMode != ChunkGenerationMode.DontGenerate) { if (gameStartSettings.generationMode != ChunkGenerationMode.TerrainLoading) { Chunk.SetChunkSize(chunksize); constructor.ConstructChunk(chunksize, gameStartSettings.generationMode); } else { LoadTerrain(Application.persistentDataPath + "/Terrains/" + savename + '.' + SaveSystemUI.TERRAIN_FNAME_EXTENSION); } } FollowingCamera.CenterCamera(Vector3.one * chunksize / 2f); switch (difficulty) { case Difficulty.Utopia: LUCK_COEFFICIENT = 1; demolitionLossesPercent = 0; lifepowerLossesPercent = 0; sellPriceCoefficient = 1; tradeVesselsTrafficCoefficient = 0.2f; upgradeDiscount = 0.5f; upgradeCostIncrease = 1.1f; environmentalConditions = 1; break; case Difficulty.Easy: LUCK_COEFFICIENT = 0.7f; demolitionLossesPercent = 0.2f; lifepowerLossesPercent = 0.1f; sellPriceCoefficient = 0.9f; tradeVesselsTrafficCoefficient = 0.4f; upgradeDiscount = 0.3f; upgradeCostIncrease = 1.3f; environmentalConditions = 1; break; case Difficulty.Normal: LUCK_COEFFICIENT = 0.5f; demolitionLossesPercent = 0.4f; lifepowerLossesPercent = 0.3f; sellPriceCoefficient = 0.75f; tradeVesselsTrafficCoefficient = 0.5f; upgradeDiscount = 0.25f; upgradeCostIncrease = 1.5f; environmentalConditions = 0.95f; break; case Difficulty.Hard: LUCK_COEFFICIENT = 0.1f; demolitionLossesPercent = 0.7f; lifepowerLossesPercent = 0.5f; sellPriceCoefficient = 0.5f; tradeVesselsTrafficCoefficient = 0.75f; upgradeDiscount = 0.2f; upgradeCostIncrease = 1.7f; environmentalConditions = 0.9f; break; case Difficulty.Torture: LUCK_COEFFICIENT = 0.01f; demolitionLossesPercent = 1; lifepowerLossesPercent = 0.85f; sellPriceCoefficient = 0.33f; tradeVesselsTrafficCoefficient = 1; upgradeDiscount = 0.1f; upgradeCostIncrease = 2f; environmentalConditions = 0.8f; break; } warProximity = 0.01f; layerCutHeight = Chunk.CHUNK_SIZE; prevCutHeight = layerCutHeight; switch (startGameWith) { case GameStart.Zeppelin: LandingUI lui = gameObject.AddComponent <LandingUI>(); lui.lineDrawer = systemDrawLR; Instantiate(Resources.Load <GameObject>("Prefs/Zeppelin")); break; case GameStart.Headquarters: List <SurfaceBlock> sblocks = mainChunk.surfaceBlocks; SurfaceBlock sb = sblocks[(int)(Random.value * (sblocks.Count - 1))]; int xpos = sb.pos.x; int zpos = sb.pos.z; if (colonyController == null) { colonyController = gameObject.AddComponent <ColonyController>(); } Structure s = Structure.GetStructureByID(Structure.LANDED_ZEPPELIN_ID); SurfaceBlock b = mainChunk.GetSurfaceBlock(xpos, zpos); s.SetBasement(b, PixelPosByte.zero); b.MakeIndestructible(true); b.myChunk.GetBlock(b.pos.x, b.pos.y - 1, b.pos.z).MakeIndestructible(true); colonyController.AddCitizens(START_WORKERS_COUNT); sb = mainChunk.GetSurfaceBlock(xpos - 1, zpos + 1); if (sb == null) { sb = mainChunk.GetSurfaceBlock(xpos, zpos + 1); if (sb == null) { sb = mainChunk.GetSurfaceBlock(xpos + 1, zpos + 1); if (sb == null) { sb = mainChunk.GetSurfaceBlock(xpos - 1, zpos); if (sb == null) { sb = mainChunk.GetSurfaceBlock(xpos + 1, zpos); if (sb == null) { sb = mainChunk.GetSurfaceBlock(xpos - 1, zpos - 1); if (sb == null) { sb = mainChunk.GetSurfaceBlock(xpos, zpos - 1); if (sb == null) { sb = mainChunk.GetSurfaceBlock(xpos + 1, zpos - 1); if (sb == null) { print("bad generation, do something!"); } } } } } } } } StorageHouse firstStorage = Structure.GetStructureByID(Structure.STORAGE_0_ID) as StorageHouse; firstStorage.SetBasement(sb, PixelPosByte.zero); //start resources colonyController.storage.AddResource(ResourceType.metal_K, 100); colonyController.storage.AddResource(ResourceType.metal_M, 50); colonyController.storage.AddResource(ResourceType.metal_E, 20); colonyController.storage.AddResource(ResourceType.Plastics, 100); colonyController.storage.AddResource(ResourceType.Food, 200); //UI ui = gameObject.AddComponent<UI>(); //ui.lineDrawer = systemDrawLR; break; } FollowingCamera.main.WeNeedUpdate(); } else { LoadGame(Application.persistentDataPath + "/Saves/" + savename + ".sav"); } } else { gameObject.AddComponent <PoolMaster>().Load(); Chunk.SetChunkSize(test_size); mainChunk = new GameObject("chunk").AddComponent <Chunk>(); mainChunk.InitializeBlocksArray(); mainChunk.ChunkLightmapFullRecalculation(); mainChunk.AddBlock(new ChunkPos(Chunk.CHUNK_SIZE / 2, Chunk.CHUNK_SIZE / 2, Chunk.CHUNK_SIZE / 2), BlockType.Cube, ResourceType.STONE_ID, true); FollowingCamera.CenterCamera(Vector3.one * Chunk.CHUNK_SIZE / 2f); } }
void Awake() { followingCamera = (FollowingCamera)(Camera.main.GetComponent("FollowingCamera")); followingCamera.mainTotem = this; }
public override void Init() { VariablesGlobales.vidas = 8; VariablesGlobales.mediaDir = this.MediaDir; VariablesGlobales.shadersDir = this.ShadersDir; VariablesGlobales.soundDevice = DirectSound.DsDevice; VariablesGlobales.loader = new TgcSceneLoader(); hud = new HUD(); //var d3dDevice = D3DDevice.Instance.Device; VariablesGlobales.cues_relative_position = new TGCVector2(.05f, .5f); VariablesGlobales.cues_relative_scale = .3f; //Shaders & Post-processing @@ ver como hacer pa q estos se carguen primero!!!! shaderManager = new ShaderManager(); VariablesGlobales.shaderManager = shaderManager;//@@@@@TERMINAR: PONERSELO A TODOS LOS MESHES postProcess = new PostProcess(this, shaderManager); VariablesGlobales.postProcess = postProcess; renderer = new Renderer(this, postProcess); /* * D3DDevice.Instance.Device.Transform.Projection = TGCMatrix.PerspectiveFovLH(D3DDevice.Instance.FieldOfView, D3DDevice.Instance.AspectRatio, * D3DDevice.Instance.ZNearPlaneDistance, D3DDevice.Instance.ZFarPlaneDistance).ToMatrix(); */ physicsEngine = new PhysicsEngine(); VariablesGlobales.physicsEngine = physicsEngine; managerSonido = SoundManager.GetInstance(); VariablesGlobales.managerSonido = managerSonido; //VariablesGlobales.elapsedTime debe ser actualizado por tanto va a Update() managerElementosTemporales = new TemporaryElementManager(); VariablesGlobales.managerElementosTemporales = managerElementosTemporales; xwing = new Xwing(VariablesGlobales.loader, new TGCVector3(0, 500, 1000)); VariablesGlobales.xwing = xwing; VariablesGlobales.miniMap.agregarTarget(xwing); managerEnemigos = new EnemyManager(); VariablesGlobales.managerEnemigos = managerEnemigos; ColocarXwingEnemigos(); pistaReferencia = new MainRunway(VariablesGlobales.loader, 5, this.Frustum, xwing); worldSphere = new WorldSphere(VariablesGlobales.loader, xwing); followingCamera = new FollowingCamera(xwing); VariablesGlobales.camara = followingCamera; boundingBoxHelper = new BoundingBoxHelper(new SceneElement[] { xwing, pistaReferencia, worldSphere }, new ActiveElementManager[] { managerElementosTemporales }); cues = new CueManager(new Cue(new DelayCueLauncher(3), "Bitmaps\\WASD.png", VariablesGlobales.cues_relative_scale, VariablesGlobales.cues_relative_position, 3), new Cue(new DelayCueLauncher(3), "Bitmaps\\Pause.png", VariablesGlobales.cues_relative_scale, VariablesGlobales.cues_relative_position, 3), new Cue(new DelayCueLauncher(3), "Bitmaps\\Left_Mouse.png", VariablesGlobales.cues_relative_scale, VariablesGlobales.cues_relative_position, 3) ); dynamicCueManager = new DynamicCueManager(new Cue(new PositionAABBCueLauncher(xwing, new TGCVector3(0, -30, -13200), new TGCVector3(100, 100, 100)), "Bitmaps\\G_Bomb.png", VariablesGlobales.cues_relative_scale, VariablesGlobales.cues_relative_position, 5)); postProcess.AgregarElemento(xwing); postProcess.AgregarElemento(managerElementosTemporales); hole = new Hole(new TGCVector3(0, -40, -13875)); postProcess.AgregarElemento(hole); VariablesGlobales.miniMap.agregarObjetoMeta(hole); endGameManager = new EndgameManager(this, new EndGameTrigger(new TGCVector3(0, -50, -13900), new TGCVector3(100, 100, 100)), new LostGameTrigger(xwing, new TGCVector3(0, -30, -14000))); VariablesGlobales.endgameManager = endGameManager; managerMenu = new MenuManager(new StartMenu(Key.Return), new PauseMenu(Key.Escape));//tiene q ir ultimo pa parar el resto de sonidos VariablesGlobales.managerMenu = managerMenu; backgroundSceneLeft = new BackgroundScene(new TGCVector3(500, 100, 1000), new TGCVector3(200, 200, -15000), 100); backgroundSceneRight = new BackgroundScene(new TGCVector3(-600, 100, 1000), new TGCVector3(200, 200, -15000), 100); backgroundSceneFront = new BackgroundScene(new TGCVector3(500, 100, -15000), new TGCVector3(-1000, 200, -200), 100); }
private void Awake() { camera = gameObject.GetComponent <FollowingCamera>(); scoreTextAnimator = scoreText.gameObject.GetComponent <Animator>(); }
private void Start() { cameraScript = Camera.main.GetComponent <FollowingCamera>(); gameController = Camera.main.GetComponent <GameController>(); body = GetComponent <Rigidbody>(); }
void Start() { tableauSuivant = FollowingCamera.TellTab(transform.position); }
void Start() { followingCamera = GetComponent <FollowingCamera>(); }