private void BackToGame() { MenuGUI.Interactable = false; GameGUI.Interactable = true; MenuGUI.Hide(); GameGUI.Show(); }
private void ShowMenu() { GameGUI.Interactable = false; MenuGUI.Interactable = true; GameGUI.Hide(alpha: .3f, enable: true); MenuGUI.Show(); }
void Start(){ trainer = GameObject.Find("Player").GetComponent<Trainer>(); gameObject.AddComponent<CameraControl> (); trainer.gameObject.AddComponent<PlayerMovement> (); gamegui = gameObject.AddComponent<GameGUI> (); gameObject.AddComponent<BattleTarget> (); }
// Use this for initialization void Start() { player = GameObject.Find("Player").transform; world = GameObject.Find("World"); gui = world.GetComponent<GameGUI>(); gameObject.active = false; // Deactivate self ready to be triggered later }
public override float Act(bool qUndo = false) { // Center card GameObject movingCard = GameGUI.cloneOnCanvas(GameGUI.theGameGUI.OfferedGift.gameObject); movingCard.transform.DOMove(_gui.CardContainer.position, 1f). OnComplete(() => { GameObject.Destroy(movingCard); _gui.draw(); }); movingCard.transform.DORotate(_gui.transform.rotation.eulerAngles, 1f); // Center chips if (_numChips > 0) { GameObject movingChip = GameGUI.cloneOnCanvas(GameGUI.theGameGUI.OfferedChips); movingChip.transform.DOMove(_gui.Chips.transform.position, 1f). OnComplete(() => GameObject.Destroy(movingChip)); movingChip.transform.DORotate(_gui.transform.rotation.eulerAngles, 1f); } GameGUI.theGameGUI.drawCenter(); // New center card GameGUI.theGameGUI.OfferedGift.transform.DOMove( GameGUI.theGameGUI.DeckSizeText.transform.position, 1f). From(). SetDelay(0.5f); return(0); }
void Start() { soundeffects = GameObject.FindGameObjectWithTag("Scenemaster").GetComponent <AudioSource>(); if (audio != null) { audiosource = GameObject.FindGameObjectWithTag("gamestats").GetComponent <AudioSource>(); audiosource.clip = audio; audiosource.Play(); } player = GameObject.FindGameObjectWithTag("Game"); if (player != null) { movement = player.GetComponent <Movement>(); } gameguiobject = GameObject.FindGameObjectWithTag("GameGUI"); if (gameguiobject != null) { gameGUI = gameguiobject.GetComponent <GameGUI>(); } Tscore = GameObject.FindGameObjectWithTag("Score").GetComponent <GUIText>(); Ctime = GameObject.FindGameObjectWithTag("Countdown").GetComponent <GUIText>(); Ttime = GameObject.FindGameObjectWithTag("Time").GetComponent <GUIText>(); StartCoroutine(MyMethod()); }
/*public void CreateButton(string text, Vector3 position) * { * GameObject button = new GameObject(); * button.AddComponent<RectTransform>(); * button.AddComponent<Button>(); * button.transform.position = position; * }*/ public void PostTurn() { // this function is used to process the endin of a turn after a normal tile // jumps if needed and proceeds to next turn float delay = GameData.GetActivePiece().JumpIfNeeded(); //ends tile effect HideAllEffects(); if (delay == 0) { // since no jump happened bool collision = false; bool merge = false; if (GameData.GetMergeCollide()) { collision = CheckCollision(); merge = CheckMerge(); } //if no collision move on to next turn if (!collision && !merge) { // hide message screen GameGUI.HideMessageScreen(); //check for winner StartCoroutine(CheckWinner(delay)); } } }
void Start() { startPlayerPos = new Vector3(-6, 1, -3); transform.position = startPlayerPos; gui = FindObjectOfType <GameGUI>(); particle = GetComponentInChildren <ParticleSystem>(); }
protected override void Initialize() { /* FormSetUp */ var screenScaleY = graphics.PreferredBackBufferHeight / 720.0f; var screenScaleX = graphics.PreferredBackBufferWidth / 1024.0f; screenXform = Matrix.CreateScale(screenScaleX, screenScaleY, 1.0f); screenHeight = graphics.GraphicsDevice.Adapter.CurrentDisplayMode.Height; screenWidth = graphics.GraphicsDevice.Adapter.CurrentDisplayMode.Width; Window.Position = new Point(screenWidth / 2 - windowWidth / 2, screenHeight / 2 - windowHeight / 2); Sprites.setSpriteBatch(new SpriteBatch(graphics.GraphicsDevice)); GameItems.SetUp(); world = Loader.LoadWorld(@".\cWorld\level1.world"); hero = new Hero(); world.WorldUpdate(hero.Position); window = Content.Load <Texture2D>("Hud_Game"); GameGUI.SetUp(hero); inputHandlerInventory = new InputHandler(1); inputHandlerMovements = new InputHandler(); List <Monster> list = Loader.LoadKit <Monster>(@".\Content\Monsters.csv").ToList(); monstersList = Creature.ToDictionary(list); foreach (var monster in monstersList.Values) { world.WorldUpdate(monster.Position); } base.Initialize(); }
public void SetupPlayers(int numPlayers) { //Prepares the game to assign Players their Characeter and turn order /*players = new Player[GameData.GetNumPlayers()]; * for (int i = 0; i < GameData.GetNumPlayers(); i++) * { * GameObject playerObject = Instantiate((GameObject)Resources.Load("Prefabs/Player", typeof(GameObject))); * Player player = playerObject.GetComponent<Player>(); * players[i] = player; * }*/ //hides player choice buttons GameGUI.HidePlayerCountScreen(); //sets the amount of players GameData.SetNumPlayers(numPlayers); //keeps track of which player has been set up so far currPlayerIndex = 0; //resets players array //Transition to an explanation screen of how players will roll to decide turn order GameGUI.ShowExplanationScreen("ChooseRollOrderText", GameGUI.HideExplanationShowSetup); // the first player in the list goes firstsetup //currPlayerIndex = 0; //GameData.SetCurrPlayer(players[0]); }
IEnumerator RollingCoroutine() { RollCheckIsOccuring = true; while (dieScript.rolling) { yield return(null); } //source.Play(); yield return(new WaitForSeconds(2)); //gcs.MovePlayer(dieScript.value); // Hide the menu GameGUI.HideRollScreen(); // Reset the die ResetDie(); // Proceed based on game mode Board board = GameData.GetBoard(); if (GameData.GetGameMode() == GameData.Mode.NormalRoll) { //GameData.SetGameMode(GameData.Mode.MovingPiece); //GameData.GetActivePiece().MoveSpaces(dieScript.value, 0); //Debug.Log(GameData.GetCurrPlayer().GetLegalMoves(dieScript.value).Count); //GameData.GetCurrPlayer().Move(dieScript.value, 0); // Display the player's legal moves GameData.GetCurrPlayer().DisplayLegalMoves(dieScript.value); } if (GameData.GetGameMode() == GameData.Mode.RollSixOrDie) { // If six, jump to finish, else jump to start GameData.SetGameMode(GameData.Mode.MovingPiece); if (dieScript.value == 6) { Tile finishTile = board.GetFinishTile(); GameData.GetActivePiece().JumpToTile(finishTile); } else { Tile startTile = board.GetStartTile(); GameData.GetActivePiece().JumpToTile(startTile); } // Check for winner (wait 2 seconds to jump, 2 seconds to settle down) StartCoroutine(board.CheckWinner(4)); } if (GameData.GetGameMode() == GameData.Mode.InitialRoll) { // record die roll //board.RecordDieRoll(dieScript.value); GameData.GetCurrPlayer().AddToInitialRoll(dieScript.value); // next player in queue rolls board.RollFromQueue(); } RollCheckIsOccuring = false; }
public void OnTriggerEnter(Collider c) { string tag = c.tag; /**start explosions if barrel life less than 11*/ if ("MagicBullet" == tag) { barrelLife--; if (barrelLife < 11) { GameObject newExplosionGO = (GameObject)Instantiate(explosionPrefab, transform.position, Quaternion.identity); Destroy(newExplosionGO, 5); } } /**destroy barrel method call*/ if ("MagicBullet" == tag) { if (barrelLife < 0) { GameGUI.DecreaseBarrelsLeft(); Destroy(barrelGroup); } } } //end OnTriggerEnter
public void OnTriggerEnter(Collider c) { string tag = c.tag; /**start explosions if pipe life less than 15*/ if ("MagicBullet" == tag) { pipeLife--; if (pipeLife < 11) { GameObject newExplosionGO = (GameObject)Instantiate(explosionPrefab, transform.position, Quaternion.identity); Destroy(newExplosionGO, 5); } } /**destroy barrel method call*/ if ("MagicBullet" == tag) { if (pipeLife < 0) { GameGUI.DecreasePipesLeft(); Destroy(FactoryPipe); print("pipe destroyed"); } } } //end OnTriggerEnter
//---------------------------------------------------------- // Unity callbacks //---------------------------------------------------------- void Awake() { mInstance = this; awakeFrame = Time.frameCount; chatHistoryBuffer = 40; outerBuffer = 50; chatPanelPosX = Screen.width - chatPanelWidth - outerBuffer; chatPanelPosY = Screen.height - chatPanelHeight - outerBuffer; userListPanelWidth = chatPanelWidth * 3 / 10; chatWindowRect = new Rect(chatPanelPosX, chatPanelPosY, chatPanelWidth, chatPanelHeight); teleGui = this.gameObject.AddComponent <TeleportGUI>(); consoleGui = this.gameObject.AddComponent <ConsoleGUI>(); customizeAvatarGui = this.gameObject.AddComponent <CustomizeAvatarGUI>(); userListMgr = this.gameObject.AddComponent <HTMLUserListManager>(); replayGUI = this.gameObject.AddComponent <ReplayGUI>(); devGUI = this.gameObject.AddComponent <DevGUI>(); DevGUIEnabled = false; // Load dynamic console input TextField textures. consoleBGStretchable = Resources.Load("Textures/UnityNativeGUI/TextWindow_Middle") as Texture2D; consoleBGEndCap = Resources.Load("Textures/UnityNativeGUI/TextWindow_EndCap") as Texture2D; // Load presenter tool textures presentToolResizeButton = new VirCustomButton(Resources.Load("Textures/UnityNativeGUI/PresentTool_Resize") as Texture2D, 0, 0, 1.2f, "Resize"); presentToolCloseButton = new VirCustomButton(Resources.Load("Textures/UnityNativeGUI/Button_ChatMin_Active") as Texture2D, 0, 0, 1.2f, "Minimize"); consoleBackgroundTex = Resources.Load("Textures/UnityNativeGUI/ConsoleBackground") as Texture2D; // Set up viewport buttons productViewportResizeButton = new VirCustomButton(Resources.Load("Textures/UnityNativeGUI/PresentTool_Resize") as Texture2D, 0, 0, 1.2f, "Resize"); productViewportCloseButton = new VirCustomButton(Resources.Load("Textures/UnityNativeGUI/Button_ChatMin_Active") as Texture2D, 0, 0, 1.2f, "Minimize"); // Presenter tool defaults to off. allowPresenterTool = false; // Resize viewport if necessary if (!Screen.fullScreen && Screen.height >= (Screen.currentResolution.height - 40)) { Screen.SetResolution((int)(0.85 * Screen.width), (int)(0.85 * Screen.height), Screen.fullScreen); } // Omnibox obTLCorner = Resources.Load("Textures/UnityNativeGUI/omnibox/top_left_corner") as Texture2D; obTEdge = Resources.Load("Textures/UnityNativeGUI/omnibox/top_edge") as Texture2D; obLEdge = Resources.Load("Textures/UnityNativeGUI/omnibox/left_edge") as Texture2D; obFill = Resources.Load("Textures/UnityNativeGUI/omnibox/fill") as Texture2D; // Fadeout texture whiteTex = Resources.Load("Textures/white") as Texture2D; // Turn off all native gui for assembly if (GameManager.Inst.ServerConfig == "Assembly" || GameManager.Inst.ServerConfig == "MDONS") { GameGUI.Inst.Visible = false; } }
void Awake() { if (GGUI == null) { GGUI = this; } }
void Awake() { SP = this; score = 0; bestScore = PlayerPrefs.GetInt("BestScorePlatforms", 0); startTime = Time.time; }
/// <summary> /// Creates the level collection. /// </summary> public LevelCollection() { _levels = new List <Level>(); _gui = new GameGUI(); _cards = new Dictionary <Entity, TitleCard>(); }
void OnGUI() { float y = Screen.height / 2.0f - 45; float x = Screen.width / 2.0f - 50; // Napis: "type your name" GUIStyle centeredStyle = GUI.skin.GetStyle("Label"); centeredStyle.alignment = TextAnchor.UpperCenter; if (GameGUI.English()) { GUI.Label(new Rect(Screen.width / 2.0f - 100, y, 200, 30), "Type your name", centeredStyle); } else { GUI.Label(new Rect(Screen.width / 2.0f - 100, y, 200, 30), "Wpisz swoje imie", centeredStyle); } y += 30; // Pole tekstowe yourName = GUI.TextField(new Rect(x, y, 100, 20), yourName); y += 30; // Rozpocznij gre if (GUI.Button(new Rect(x, y, 100, 30), "START!")) { Time.timeScale = 1.0f; this.enabled = false; } }
IEnumerator DoLand(Tile currTile) { // displays tile text and reacts according to tile type yield return(new WaitForSeconds(moveDuration)); // play corresponding tile animation currTile.PlayEffect(); GameGUI.ShowMessageScreen(currTile); // play corresponding animation switch (currTile.GetTileType()) { case "jumpBack": DoSad(); break; case "finish": DoFinish(); break; case "jumpAhead": DoHappy(); break; default: break; } }
public IEnumerator CheckWinner(float delay) { // checks for winner if (GameData.GetCurrPlayer().IsAllDone()) { // we have a winner, set the mode to win yield return(new WaitForSeconds(delay)); GameData.SetGameMode(GameData.Mode.Winner); //show the winning screen GameGUI.ShowWinScreen(); //update applicationExited analytics GameGUI.analyticsApplicationExited.GameCompleted(); //activate the winning visual effect tileEffects["win"].activateEffect(new Vector2(0, 0)); // celebrate GameData.GetCurrPlayer().Celebrate(); //play winning sound Audio.PlayVictory(); } else { // go to next player StartCoroutine(NextTurn(delay)); } }
public GameController(int Zeilen, int Spalten) { anzZeilen = Zeilen; anzSpalten = Spalten; this.gui = new GameGUI(this); gui.Show(); }
// Use this for initialization void Start() { GameObject guiobj = GameObject.Find( "HUD" ); if (guiobj) { gui = guiobj.GetComponent<GameGUI>(); } }
// Use this for initialization void Start() { waveNumber = 0; newWave = true; playerTrans = GameObject.FindGameObjectWithTag("PlayerMesh").GetComponent <Transform>(); minDistToPlayer = 10.0f; gui = GameObject.FindGameObjectWithTag("GUI").gameObject.GetComponent <GameGUI>(); }
public void DisplayHealth() { healthBar.SetHealthBarValue(GetNormalisedHealthPercent(hitPoints)); if (photonView.IsMine) { GameGUI.SetHealth(GetNormalisedHealthPercent(hitPoints)); } }
void Start() { currentWave = 0; enemiesKilled = 0; gui = GameObject.FindGameObjectWithTag("GUI").GetComponent<GameGUI>(); waveController = Camera.main.GetComponent<WaveControl>(); LevelUp(); // Init to level 1 }
/*public void Setup2Players() * { * // sets up 2 players * GameGUI.HidePlayerCountScreen(); * SetupPlayers(2); * } * * public void Setup3Players() * { * // sets up 3 players * GameGUI.HidePlayerCountScreen(); * SetupPlayers(3); * } * * public void Setup4Players() * { * // sets up 4 players * GameGUI.HidePlayerCountScreen(); * SetupPlayers(4); * }*/ //public void ShowRules() //{ // shows the rules // GameGUI.HideMainScreen(); // GameGUI.ShowInfoScreen(GameData.GetTextAssetHolder().GetRulesText()); //} //public void ShowCredits() //{ // shows the credits // GameGUI.HideMainScreen(); // GameGUI.ShowInfoScreen(GameData.GetTextAssetHolder().GetCreditsText()); //} public void ShowMainMenu() { // shows the main menu GameData.SetGameMode(GameData.Mode.Home); GameGUI.HideEveryScreen(); GameGUI.ShowMainScreen(); tileEffects["win"].hideEffect(); }
void Start() { currentWave = 0; enemiesKilled = 0; gui = GameObject.FindGameObjectWithTag("GUI").GetComponent <GameGUI>(); waveController = Camera.main.GetComponent <WaveControl>(); LevelUp(); // Init to level 1 }
void Awake() { playerMovement = GetComponent<MovePlayer>(); gui = GameObject.Find ("GuiControl").GetComponent<GameGUI>(); gui.ShowLevelTitle("Guiding Lights"); StartCoroutine(DisablePlayer(2)); StartCoroutine(InDarkness()); }
// Use this for initialization void Start() { gameguiobject = GameObject.FindGameObjectWithTag("GameGUI"); if (gameguiobject != null) { gameGUI = gameguiobject.GetComponent <GameGUI>(); } }
public static bool Prefix(GameGUI __instance) { if (Config.GetOptions().DullInventoryMusic) { SmartAudioEngine.me.SetDullMusicMode(true); } return(true); }
// Use this for initialization void Start() { waveNumber = 0; newWave = true; playerTrans = GameObject.FindGameObjectWithTag("PlayerMesh").GetComponent<Transform>(); minDistToPlayer = 10.0f; gui = GameObject.FindGameObjectWithTag("GUI").gameObject.GetComponent<GameGUI>(); }
// Use this for initialization void Start() { GameObject plr = GameObject.Find("Player"); mover = plr.GetComponent<CharMover>(); player = plr.transform; world = GameObject.Find("World"); gui = world.GetComponent<GameGUI>(); }
public void ProcessPlayer() { // adds the current player and sets up the next player AddPlayer(GameGUI.GetInputFieldName(), GameGUI.GetDropDownColor()); // set up the next player SetupNextPlayer(); }
void Awake() { player = GameObject.FindObjectOfType <Player>(); //NEEDED? gameGui = GameObject.FindObjectOfType <GameGUI>(); //launchForceMax = launchForce.magnitude; source = GetComponent <AudioSource>(); }
public void Destroy() { Debug.LogError("Destroy GameManager"); GameGUI.Destroy(); playerManager.Shutdown(); mInstance = null; DestroyImmediate(playerManager); DestroyImmediate(gameObject); }
void Start() { trainer = GameObject.Find("Player").GetComponent <Trainer>(); gameObject.AddComponent <CameraControl> (); trainer.gameObject.AddComponent <PlayerMovement> (); gamegui = gameObject.AddComponent <GameGUI> (); pokemonGUI = gameObject.AddComponent <PokemonGUI> (); gameObject.AddComponent <BattleTarget> (); }
public void draw() { gameObject.SetActive(true); Ribbon.gameObject.SetActive(Game.theGame.CurrentGameState == Game.GameState.GAME_OVER); Ribbon.sprite = GameGUI.ribbonSprite(ParentGUI.Player.Place); GiftIcon.SetActive(Game.theGame.CurrentGameState == Game.GameState.PLAY && ParentGUI.Player == Game.theGame.CurrentPlayer); }
private void Form1_Load(object sender, EventArgs e) { GameGrid.RowCount = 20; for (int i = 0; i < 20; i++) { GameGrid.Rows[i].Height = 30; } GameGUI game = new GameGUI(GameGrid, output, StartBtn); }
void Start() { centrePos = transform.position; playerObj = GameObject.Find("First Person Controller"); GameObject guiobj = GameObject.Find( "HUD" ); if (guiobj) { gui = guiobj.GetComponent<GameGUI>(); } }
void Start() { // Make the rigid body not change rotation if (rigidbody) rigidbody.freezeRotation = true; GameObject guiobj = GameObject.Find( "HUD" ); if (guiobj) { gui = guiobj.GetComponent<GameGUI>(); } }
public static void CapturePokemon() { GameGUI gamegui = new GameGUI(); Debug.LogError("Capture Pokemon"); Vector3 pokemonPositon = pokemonObj.transform.position; GameObject ball = (GameObject)Instantiate(Resources.Load("Pokeball")); //ball.transform.position = GameObject.Find("_PokeballHolder").transform.position; GameObject.Find ("_PokeballHolder").transform.LookAt(pokemonPositon); ball.transform.position = GameObject.Find ("_PokeballHolder").transform.position; //ball.rigidbody.AddForce // ( Camera.main.transform.forward*500+ Camera.main.transform.up*300 ); ball.rigidbody.AddForce(pokemonPositon*500 + Camera.main.transform.up*300); Pokeball.CapturePokemon(); Destroy (ball, 1); }
public override void Initialize() { interactions = new Dictionary<State, Interactions>(); interactions[State.Start] = StartInteractions; interactions[State.RaftClicked] = RaftClickedInteractions; interactions[State.PumpClicked] = PumpClickedInteractions; interactions[State.RaftChecked] = RaftCheckedInteractions; interactions[State.BearingMade] = BearingMadeInteractions; interactions[State.RaftDeflated] = RaftDeflatedInteractions; interactions[State.RaftInflated] = RaftInflatedInteractions; interactions[State.Finish] = FinishInteractions; raft.manager = this; pump.manager = this; bearingGame.parentManager = this; gameGUI = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameGUI>(); gameGUI.message = "Excellent! So you have reached the shore. Use the raft to get to the other side of the river"; }
void Awake() { player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerState>(); gui = GameObject.Find("GuiControl").GetComponent<GameGUI>(); }
//private DarknessControl controlScript; // Use this for initialization void Awake() { player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerState>(); gui = GameObject.Find("GuiControl").GetComponent<GameGUI>(); //controlScript = GameObject.Find("DarknessControl").GetComponent<DarknessControl>(); }
void Awake() { SP = this; score = 0; bestScore = PlayerPrefs.GetInt("BestScorePlatforms", 0); }
void Awake() { if ( instance != null ) { Debug.LogError( "[ERROR - Singleton] Tried to instantiate a second instance of the Game singleton" ); this.GameOver += OnGameOver; Destroy( this ); return; } Instance = this; departmentMap = new Dictionary<DepartmentType, Sprite>(); string[] names = System.Enum.GetNames( typeof( DepartmentType ) ); int firstdepartment = UnityEngine.Random.Range(0, names.Length - 2); CurrentDepartment = (DepartmentType)firstdepartment; background = new List<Background>(2); MapDepartmentTextures(); gameGUI = gameObject.GetComponent<GameGUI>(); PointBursts = new Queue<PointBurst>(); ElapsedGameTime = new TimeSpan(); }
void Start() { instance = this; }
void Awake() { m_Singleton = this; }
// Use this for initialization void Start() { player = GameObject.Find("Player").transform; world = GameObject.Find("World"); gui = world.GetComponent<GameGUI>(); }
// Use this for initialization void Start() { view = gameObject.GetComponent<GameGUI>(); }
void Start() { comboLimit = 4; GameObject perimeter = GameObject.FindWithTag("Perimeter"); perimeterScript = perimeter.GetComponent<PerimeterController>(); GameObject playMaster = GameObject.Find("PlayLevelMaster"); gameGUIScript = playMaster.GetComponent<GameGUI>(); //For when this script is attached to blackball if(this.transform.name == "BlackBall") blackBall = this.gameObject;//blackBall = GameObject.Find("BlackBall"); }
private void Awake() { Instance = this; }
// Use this for initialization void Start() { animator = GetComponent<Animator>(); controller = GetComponent<CharacterController>(); camera = Camera.main; gui = GameObject.FindGameObjectWithTag("GUI").gameObject.GetComponent<GameGUI>(); wc = camera.GetComponent<WaveControl>(); // Set guns to default values GetGunByID(1).SetDamage(1.0f); GetGunByID(1).SetAmmoPerMag(32); GetGunByID(1).SetCurrentMagAmmo(32); GetGunByID(2).SetDamage(3.0f); GetGunByID(2).SetAmmoPerMag(2); GetGunByID(2).SetCurrentMagAmmo(2); GetGunByID(3).SetDamage(2.0f); GetGunByID(3).SetAmmoPerMag(10); GetGunByID(3).SetCurrentMagAmmo(10); // Equip default gun (AR) EquipGun(0); currentGun.SetCurrentMagAmmo(32); }
IEnumerator Start() { if (meteoritePrefab == null) { Debug.LogError ("No meteorite prefab set. Please correct and restart.", this); enabled = false; yield break; } player = FindObjectOfType (typeof (Player)) as Player; gameGUI = GetComponent<GameGUI> (); menuGUI = GetComponent<MenuGUI> (); creditsGUI = GetComponent<CreditsGUI> (); setupGUI = GetComponent<SetupGUI> (); // Instantiate meteorite and warning object pools - one instance of each per frame // meteoritePool = new Queue<Meteorite> (); warningPool = new Queue<ImpactWarning> (); for (int i = 0; i < poolSize && Application.isPlaying; i++) { yield return null; DespawnMeteorite (Instantiate (meteoritePrefab, transform.position, transform.rotation) as Meteorite); DespawnWarning (Instantiate (meteoriteWarningPrefab, transform.position, transform.rotation) as ImpactWarning); } while (Application.isPlaying) // Meteorite spawn loop { yield return new WaitForSeconds (Random.Range (minimumDelay, maximumDelay)); SpawnMeteorite ( transform.position + transform.forward * Random.Range (showerArea.y * -0.5f, showerArea.y * 0.5f) + transform.right * Random.Range (showerArea.x * -0.5f, showerArea.x * 0.5f), transform.rotation * Quaternion.AngleAxis (90.0f, transform.right) ); } }
private void Awake() { instance = this; //Cursor.SetCursor( this.floatingReticuleTexture, Vector2.zero, CursorMode.Auto ); }
void Start() { isEnded = false; // Check parameters if (randomGuySpawns == null || randomGuySpawns.Length == 0) Debug.LogError("Missing randomGuySpawns!"); if (randomGuyPrefab == null) Debug.LogError("Missing RandomGuy prefab!"); if (bonusPrefab == null) Debug.LogError("Missing Bonus prefab!"); if (coconutSpawn == null) Debug.LogError("Missing coconutSpawn!"); gui = FindObjectOfType<GameGUI>(); if (gui == null) Debug.LogError("Missing GUI!"); music = FindObjectOfType<AudioSource>(); // Initialize enemySpawnCooldown = Random.Range(minSpawnCooldownInSeconds, maxSpawnCooldownInSeconds); bonusCooldown = Random.Range(minBonusSpawnFrequency, maxBonusSpawnFrequency); slowmotionRemainingTime = slowmotionTotalTimeInSeconds; timeleft = time; score = 0; combo = 1; // Create a parent for a proper hierarchy randomGuysParent = new GameObject("Random Guys").transform; bonusParent = new GameObject("Bonuses").transform; coconutsParent = new GameObject("Coconuts").transform; fakeCoconuts = new List<FakeCoconutScript>(FindObjectsOfType<FakeCoconutScript>()); // Instantiate coconut StartCoroutine(RespawnCoconut(1f)); gui.SetVisible(true); DisplayMessage(MessageType.Start); }
// Use this for initialization void Start() { nextWaypoint = 0; agent = GetComponent<NavMeshAgent>(); playerObj = GameObject.Find("First Person Controller"); if (!playerObj) print("No player found!"); GameObject guiobj = GameObject.Find( "HUD" ); if (guiobj) { gui = guiobj.GetComponent<GameGUI>(); } }