void Awake(){ //player = FindObjectOfType <Spikes> (); // Allows script to use player variables. if (Instance == null) { Instance = this; DontDestroyOnLoad (this.gameObject); } else Destroy (this.gameObject); }
public void ImReady() { MainGameManager.getInstance().PlayerLoadingFinishCount++; if (MainGameManager.getInstance().PlayerLoadingFinishCount >= PhotonManager.getInstance().playerList.Count) { CoroutineUtility.GetInstance() .Do() .Wait(1.5f) .Then(() => gameObject.GetPhotonView().RPC("StartGame", PhotonTargets.All)) .Go(); Debug.Log("EveryBodyFinishLoading"); } }
void Awake() { mgm = MainGameManager.Instance; Chapters = new List <Chapter>(); if (GlobalGameManager.Instance != null) { SelectedChapter = GlobalGameManager.Instance.SelectedChapter; } else { SelectedChapter = 0; } }
public void Initial(int index, int id, bool isAI, string nickName) { int wait = 1; if (SceneManager.GetActiveScene().name == "Tutorial") { wait = 0; } CoroutineUtility.GetInstance() .Do() .Wait(wait) .Then(() => SpawnAnimation.SetActive(true)) .Wait(0.3f) .Then(() => playerSprite.SetActive(true)) .Wait(1f) .Then(() => SpawnAnimation.SetActive(false)) .Go(); this.isAI = isAI; if (PhotonManager.getInstance().playerList == null) { PhotonManager.getInstance().playerList = new List <PlayerController>(); } PhotonManager.getInstance().playerList.Add(this); ID = id; this.index = index; this.NickName = nickName; PlayerNameText.text = nickName; if (isOwner()) { OnSceneLoaded(); MainGameManager.getInstance().player = this; if (SceneManager.GetActiveScene().name == "Tutorial") { TutorialManager.GetInstance().player = this; } //MainUIManager.instance.UpdateHealthBar(hp); SaveData playerData = EntireGameManager.getInstance().playerData; SetCharacterSprite(playerData.nowEquipment.animal, playerData.nowEquipment.cup, playerData.nowEquipment.liquid); gameObject.GetPhotonView().RPC("SetCharacterSprite", PhotonTargets.All, playerData.nowEquipment.animal, playerData.nowEquipment.cup, playerData.nowEquipment.liquid); GameObject inputer = PhotonNetwork.Instantiate("FakeInputer", Vector3.zero, Quaternion.identity, 0); fakeInputer = inputer.GetComponent <FakeInputer>(); fakeInputer.playerID = id; inputer.GetPhotonView().RPC("SetID", PhotonTargets.MasterClient, id); gameObject.GetPhotonView().RPC("SetSkill", PhotonTargets.All, playerData.nowEquipment.animal); } else if (isAI && PhotonNetwork.isMasterClient) { OnSceneLoaded(); } }
void Awake() { if (currentManager == null) { currentManager = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } ManageScore.OnAllTrashCollected += WinGame; ManageHealth.OnPlayerDeath += LoseGame; }
void Awake() { Instance = this; XmlLoader = GetComponent <AVXmlLoader>(); ChapterManager = GetComponent <ChapterManager>(); RandomFactManager = GetComponent <RandomFactManager>(); CharacterManager = GetComponent <CharacterManager>(); AssetManager = GetComponent <AssetManager>(); SaveLoadManager = GetComponent <SaveLoadManager>(); GlobalLocationManager = GetComponent <GlobalLocationScript>(); CurrentSelectedQuest = "NeckarbrueckeRoute"; //SaveLoadManager.ResetSave(); }
void Awake() { player = GameObject.FindGameObjectWithTag("Player"); increaseSpeed = new UnityEvent(); if (instance == null) { instance = this; } else { Destroy(this.gameObject); } SetBounds(); GoogleAds.instance.HideBanner(); }
public StartState(MainGameManager manager) { parent = manager; parent.StartCoroutine(StartCount()); startWord = Resources.Load("Objects/word/StartWord") as GameObject; var boxObject = Resources.Load("Objects/Box/ItemBox") as GameObject; var box = Instantiate(boxObject) as GameObject; var script = box.GetComponent<BaseBox>(); script.transform.parent = parent.teamPanels[(int)TEAMCODE.none].transform; script.transform.localScale = Vector3.one; script.transform.localPosition = new Vector3(30, 30, 0); }
void Awake() { Screen.orientation = ScreenOrientation.Portrait; stepCount = 0; scores = 0; ShowStep(); if (instance == null) { instance = this; } else { Destroy(instance); } }
void Start() { anim = GetComponent <Animator> (); rb = GetComponent <Rigidbody2D> (); cl = GameObject.Find("CamLeft").GetComponent <BoxCollider2D> (); cr = GameObject.Find("CamRight").GetComponent <BoxCollider2D> (); cc = GetComponent <CapsuleCollider2D> (); pc1 = GameObject.Find("Player1").GetComponent <PlayerController> (); pc2 = GameObject.Find("Player2").GetComponent <PlayerController> (); animp1 = GameObject.Find("Player1").GetComponent <Animator> (); animp2 = GameObject.Find("Player2").GetComponent <Animator> (); state = true; destroyed = false; mgm = GameObject.Find("Canvas").GetComponent <MainGameManager> (); }
void Start() { willDamaged = true; isDied = false; canUseSkill = false; targetFocus = this; mainCamera = MainGameManager.instance.playerCamera; playerRig = GetComponent <Rigidbody2D>(); target = Vector3.zero; //photonView = GetComponent<PhotonView>(); hp = 100; if (MainGameManager.getInstance().isTutorial == true) { canMove = false; } }
void Awake() { instance = this; scenePath = SceneManager.GetActiveScene().path; currentScene = SceneManager.GetActiveScene().name; /* parents disabled 11/14/2016 * // create parent objects * HumanParent = new GameObject("HumanParent"); * HumanParent.transform.parent = this.transform; * ZombieParent = new GameObject("ZombieParent"); * ZombieParent.transform.parent = this.transform; * DeadBodies = new GameObject("DeadBodies"); * DeadBodies.transform.parent = this.transform; */ }
void checkInput() { //float x = joystick.Horizontal; //float y = joystick.Vertical; //target.x += x; //target.y += y; //forceFoward = new Vector2(x, y); if (MainGameManager.getInstance().isGameOver) { return; } if (isAI) { if (AITime > 1) { float x = UnityEngine.Random.Range(-6, 7); float y = UnityEngine.Random.Range(-6, 7); forceFoward = new Vector2(x, y); if (isAIFocusEnemy && UnityEngine.Random.Range(0, 2) >= 1) { forceFoward = AIFocusEnemy.transform.position - transform.position; } CoroutineUtility.GetInstance().Do().Wait(0.6f).Then(() => forceFoward = Vector2.zero).Go(); if (mp >= 100) { gameObject.GetPhotonView().RPC("UseSkill", PhotonTargets.All); } AITime = 0; } } if (canMove) { playerRig.AddForce(forceFoward * (0.1f * (maxVelcocity + speedBuff)), ForceMode2D.Impulse); if (Vector2.Distance(Vector2.zero, playerRig.velocity) > maxVelcocity + speedBuff) { playerRig.velocity = playerRig.velocity.normalized * (maxVelcocity + speedBuff); } } //photonView.RPC("PlayerMove", PhotonTargets.MasterClient, forceFoward); //playerRig.AddForce(forceFoward * 1.5f, ForceMode2D.Impulse); //if (Vector2.Distance(Vector2.zero, playerRig.velocity) > maxVelcocity) // playerRig.velocity = playerRig.velocity.normalized * maxVelcocity; }
void Awake() { _instance = this; managers = new List <IGameManager>(); playerManager = GetComponent <PlayerManager>(); uiManager = GetComponent <MyUIManager>(); itemManager = GetComponent <ItemManager>(); audioManager = GetComponent <MyAudioManager>(); managers.Add(playerManager); managers.Add(uiManager); managers.Add(itemManager); managers.Add(audioManager); StartCoroutine(StartSetupManager()); }
// Update is called once per frame void Update() { if (PhotonNetwork.isMasterClient && !MainGameManager.getInstance().isGameOver&& MainGameManager.getInstance().isGameStart) { createTime += Time.deltaTime; if (createTime > frequency) { if (nowItemCount < 5) { GameObject item = RandomItem(); PhotonNetwork.InstantiateSceneObject(item.name, RandomPosition(), Quaternion.identity, 0, null); nowItemCount++; } createTime = 0; } } }
public void OnSkillFirstUsed(float waitTime) { if (!MainGameManager.getInstance().canUseSkill) { return; } if (index != 12) { return; } if (HaveUseSkill) { return; } HaveUseSkill = true; CoroutineUtility.GetInstance().Do().Wait(waitTime).Then(() => SetPlayerCanMove(false)).Then(StopPlayer).Then(() => CanAIMove(false)).Then(StopAI).Then(MoveNext).Go(); }
public StartState(MainGameManager manager) { parent = manager; parent.StartCoroutine(StartCount()); startWord = Resources.Load("Objects/word/StartWord") as GameObject; var boxObject = Resources.Load("Objects/Box/ItemBox") as GameObject; var box = Instantiate(boxObject) as GameObject; var script = box.GetComponent <BaseBox>(); script.transform.parent = parent.teamPanels[(int)TEAMCODE.none].transform; script.transform.localScale = Vector3.one; script.transform.localPosition = new Vector3(30, 30, 0); }
void OnCollisionEnter2D(Collision2D coll) { ContactPoint2D contact = coll.contacts[0]; contact.collider.GetComponentInParent <MainGameObstacleHandler> ().forceDestroy = true; Instantiate(MainGameManager.destroyed_particle, contact.collider.gameObject.transform.position, new Quaternion(0f, 0f, 0f, 1f)); //MainGameManager.Game_Over (); if (MainGameManager.coins >= Mathf.RoundToInt(Mathf.Sqrt(MainGameManager.score) * (Mathf.Sqrt(MainGameManager.score)) / 5) && MainGameManager.score >= 25) { GameObject revive_notification = Resources.Load("Sprites/Ui/Prefabs/Notification_Revive") as GameObject; revive_notification = Instantiate(revive_notification) as GameObject; revive_notification.GetComponentInChildren <TextMesh> ().text = Mathf.RoundToInt(Mathf.Sqrt(MainGameManager.score) * (Mathf.Sqrt(MainGameManager.score)) / 5).ToString(); revive_notification.GetComponent <NotificationManager> ().revivePlayer(Mathf.RoundToInt(Mathf.Sqrt(MainGameManager.score) * (Mathf.Sqrt(MainGameManager.score)) / 5)); //start the prompt process } else { MainGameManager.Game_Over(); } }
// Update is called once per frame void Update() { //if (gameObject.transform.position.x > MainGameManager.player.transform.position.x + MainGameManager.minimum_spacing_between_obstacles && containsObstacle == false && hasTried == false && MainGameManager.current_game_state == MainGameManager.game_state.Playing && gameObject.GetComponent<Animator>().GetCurrentAnimatorStateInfo(0).IsName("MainGame_LineSegment_GrowEnter") == false) { if (hasTried == false) { containsObstacle = MainGameManager.Generate_Obstacle(gameObject); hasTried = true; if (containsObstacle == true) { } } //error check the booleans if (gameObject.transform.position.x < MainGameManager.player.transform.position.x - MainGameManager.player.GetComponentInChildren <SpriteRenderer> ().bounds.size.x / 2) { if (beenDestroyed == false) { if (containsObstacle == false) { gameObject.GetComponent <Animator>().Play("MainGame_LineSegment_SemiShrinkExit"); } else { gameObject.GetComponent <Animator>().Play("MainGame_LineSegment_NoShrinkExit"); } MainGameManager.Number_Of_Line_Segments -= 1; MainGameManager.All_Lines.RemoveAt(0); //refresh names for (int x = 0; x < MainGameManager.Number_Of_Line_Segments; x++) { GameObject temp = MainGameManager.All_Lines[x] as GameObject; temp.name = "LS_" + x; } beenDestroyed = true; } if (gameObject.transform.position.x < Camera.main.transform.position.x - MainGameManager.cameraSize.x / 2 - gameObject.GetComponent <SpriteRenderer>().bounds.size.x / 2) { DestroyImmediate(gameObject); Camera.main.GetComponent <MainGameManager>().AddLineSegments(true); } } }
public GameDisplayManager(MainGameManager mainManager, GameSetup gameSetup, IEnumerable <Faction> factions, Map map, UnityObjectManager objectManager, FactionsInteractionManager interactionManager, GameState initialState) { _provinces = new Dictionary <Province, ProvinceDisplay>(); _mainManager = mainManager; _factions = new FactionsDisplayManager(mainManager, gameSetup.ScreenCanvas, gameSetup.FactionPrefab, objectManager, interactionManager, _mainManager.InteractionManager.Map); Map = new MapDisplay(gameSetup, map, objectManager); UpdateDisplayWrappers(initialState); }
void Start() { if (!instance) { instance = FindObjectOfType <GameManager>(); } if (!GameManager) { GameManager = FindObjectOfType <MainGameManager>(); } if (!GameManager.bWin) { gO.SetActive(false); Win_GUI_Anim.SetBool("Start", true); } if (!timer) { timer = FindObjectOfType <Timer>(); } }
private void OnEnable() { if (canPlaceMaterial == null && m_canPlaceMaterial != null) { canPlaceMaterial = m_canPlaceMaterial; } if (cannotPlaceMaterial == null && m_cannotPlaceMaterial != null) { cannotPlaceMaterial = m_cannotPlaceMaterial; } if (houseHoldItemDataID == -9999) { gameObject.SetActive(false); } else { RegisterOriginalMaterials(); MainGameManager.AddObject(this); } }
void UpdateRumble() { // 振動生成 this.randomRumbleTimer -= Time.deltaTime; if (this.randomRumbleTimer < 0f) { this.randomRumbleTimer = MainGameManager.GetRandomFloat(0.0f, Mathf.Lerp(this.maxInterval, this.mostMinInterval, this.power / this.powerLimit)); // 通常の振動時間にwaitingMultipleAmpをかけて、通常より短い時間 this.rumbleTimer = this.rumbleTime * this.waitingMultipleAmp; } // 振動 this.rumbleTimer -= Time.deltaTime; if (this.rumbleTimer <= 0f) { this.rumbleTimer = 0f; } this.joycon.SetRumble(160f, 320f, Mathf.Lerp(this.minRumbleAmp, this.rumbleAmp, this.rumbleTimer / this.rumbleTime), 15); }
void Start() { if (!GameManager) { GameManager = FindObjectOfType <MainGameManager>(); } Difficulty = GameManager.GameDifficulty; // Spawn Block_Movable for (int i = 0; i <= Difficulty - 1; i++) { Block_Movable[i].SetActive(true); } // Spawn Equation for (int i = 0; i <= Difficulty - 2; i++) { Equation[i].SetActive(true); } }
private void Awake() { if (mgm == null) { mgm = this; } else if (mgm != this) { Destroy(this); } //tileset_ice.tiles.Sort(Tileset.TileListSorter); //tileset_earth.tiles.Sort(Tileset.TileListSorter); //tileset_fire.tiles.Sort(Tileset.TileListSorter); /* * foreach (var t in tiles) * { * if (!tileTable.ContainsKey(t.GetHashCode())) tileTable.Add(t.GetHashCode(), t); * }*/ }
// Saves the config file public static void saveFile(Shop mShop, MainGameManager mGM) { // Save the current time float timeAsSeconds = 0.0f; timeAsSeconds += System.DateTime.Now.Second; timeAsSeconds += System.DateTime.Now.Minute * 60; timeAsSeconds += System.DateTime.Now.Hour * 60 * 60; timeAsSeconds += System.DateTime.Now.DayOfYear * 60 * 60 * 24; // Save the time in seconds as a float value // Because sharpconfig can't save DateTime values, we need to convert it to a float config["Statistics"]["Time"].FloatValue = timeAsSeconds; // Save the block grid // BlockSaver.saveGrid(mGM.grid); // Save the items owned by the player for (int i = 0; i < 3; i++) { // Set the number of items owned in the config file config["Items Owned"]["Item" + i.ToString()].IntValue = mShop.getNumberOwned(i); } // Save the net value of the shop config["Statistics"]["Shop Value"].FloatValue = (float)mShop.getShopValue(); // Save the number of items the player has unlocked config["Statistics"]["Items Unlocked"].IntValue = mShop.getItemsUnlocked(); config["Statistics"]["Points"].FloatValue = mGM.currency; // Save the click value config["Statistics"]["Click Value"].IntValue = MainGameManager.clickValue; // Save the config file config.SaveToFile("cfg/config.cfg"); }
private void OnSceneFinishedLoading(Scene scene, LoadSceneMode mode) { Debug.Log("loadscene"); if (scene.name == "Room") { PhotonNetwork.BackgroundTimeout = 180; PhotonNetwork.automaticallySyncScene = false; PhotonNetwork.isMessageQueueRunning = true; if (playerList != null) { playerList.Clear(); } spawnRoomPlayer(); SocialManager.ReadQueue(this); } else if (scene.name == "MainGame") { if (PhotonNetwork.isMasterClient) { PhotonNetwork.BackgroundTimeout = 10; } map = MainGameManager.getInstance().InitialMap((string)PhotonNetwork.room.CustomProperties["Map"]); CoroutineUtility.GetInstance() .Do() .Wait(0.2f) .Then(() => spawnPlayer(playerObj, map.spawnPoint)) .Go(); //spawnPlayer(playerObj, map.spawnPoint); } else if (scene.name == "Tutorial") { map = MainGameManager.getInstance().InitialMap((string)PhotonNetwork.room.CustomProperties["Map"]); } else if (scene.name == "RoomList") { SocialManager.ReadQueue(this); } }
void OnMouseDown() { //handle normal rotate clicks switch (MainGameManager.current_game_state) { case MainGameManager.game_state.PreStart: MainGameManager.Start_Game(); break; case MainGameManager.game_state.Playing: if (MainGameManager.player.GetComponentInChildren <Animator> ().GetBool("RotatedUp") == true) { MainGameManager.player.GetComponentInChildren <Animator> ().SetBool("RotatedUp", false); MainGameManager.player.GetComponentInChildren <Animator> ().Play("ToUp"); } else { MainGameManager.player.GetComponentInChildren <Animator> ().SetBool("RotatedUp", true); MainGameManager.player.GetComponentInChildren <Animator> ().Play("ToDown"); } break; } }
private PoolManager OnInit() { //smokeEffect = new List<GameObject>(); //unCoveredEffect = new List<GameObject>(); //goldEffect = new List<GameObject>(); //doorOpenEffect = new List<GameObject>(); MainGameManager manager = MainGameManager.Instance; effectPoolDic = new Dictionary <EffectType, List <GameObject> > { { EffectType.SmokeEffect, new List <GameObject>() }, { EffectType.UnCoveredEffect, new List <GameObject>() }, { EffectType.GoldEffect, new List <GameObject>() }, }; effectGOPrefabDic = new Dictionary <EffectType, GameObject> { { EffectType.SmokeEffect, manager.SmokeEffect }, { EffectType.UnCoveredEffect, manager.UncoveredEffect }, { EffectType.GoldEffect, manager.GoldEffect }, }; return(this); }
/*Public consts fields*/ /*Public fields*/ /*Private methods*/ private void Start() { GameManagerComponent = GameObject.FindGameObjectWithTag("GameManager").GetComponent <MainGameManager>(); ButtonReady.interactable = (false == PhotonNetwork.offlineMode); }
public static void OpenIntroWindowEvent() { OnIntroOpen?.Invoke(); MainGameManager.PauseGame(); }
public static void CloseIntroWindowEvent() { OnIntroClose?.Invoke(); MainGameManager.UnpauseGame(); }
public PlayingState(BetterList<Character> characters, MainGameManager manager) { parent = manager; teams = new TeamList(characters); }
void Awake() { instance = this; Debug.Log("LET'SA GO; M**********R!"); }
void Awake() { instance = this; }
void Awake() { instance = this; scenePath = SceneManager.GetActiveScene().path; currentScene = SceneManager.GetActiveScene().name; /* parents disabled 11/14/2016 // create parent objects HumanParent = new GameObject("HumanParent"); HumanParent.transform.parent = this.transform; ZombieParent = new GameObject("ZombieParent"); ZombieParent.transform.parent = this.transform; DeadBodies = new GameObject("DeadBodies"); DeadBodies.transform.parent = this.transform; */ }
public ResultState(MainGameManager manager) { parent = manager; frame = new FrameCounter(300); }
public EndState(MainGameManager manager) { parent = manager; frame = new FrameCounter(180); }