// Use this for initialization private void Start() { animation = gameObject.GetComponent <Animation>(); mapControler = GameObject.Find("MapControler").GetComponent <MapControler>(); switch (tag) { case "normal": pst = new NormalPoint(); break; case "boss": pst = new BossPoint(); break; case "shop": pst = new ShopPoint(); break; case "elite": pst = new ElitePoint(); break; case "rest": pst = new RestPoint(); break; } visited = transform.GetChild(0).gameObject; visited.SetActive(isVisited); }
private void Start() { //player.currShipEnergy = player.ShipEnergy; lootItem = null; goldLoot = 0; battleState = BattleState.creatingMap; coIsRunning = false; isMapFull = false; cleared = false; finded = false; board = new GemControler[col, row + 1]; GenerateBoard(); player = Player.Instance; monster = Monster.Instance; destroyedGemCount = new int[gems.Length]; player.CurrBuff = 0; player.CurrShield = 0; player.ShieldMax = 0; PopoutCreator.Initialize(); mapControler = GameObject.Find("MapControler").GetComponent <MapControler>(); playerImageTransform = GameObject.Find("PlayerImage").transform; enemyImageTransform = GameObject.Find("EnemyImage").transform; player.currShipEnergy = player.ShipEnergy; player.inventory.ForEach(item => { item.DoOnBattleStart(); }); audioSource = GetComponents <AudioSource>(); }
public void MoveCameraToObj() { _mapControler = FindObjectOfType <MapControler>(); _cameraControler.MoveCameraToBullet(_GameObj.transform.position); _mapControler.MoveMapToBullet(_GameObj.transform.position); _cameraControler._IsMove = false; _mapControler._IsMove = false; }
// public EdgeCollider2D edgeCollider; // Start is called before the first frame update void Start() { // Ferr2DT_PathTerrain.Instance.RemovePoint(1); if (Instance == null) { Instance = this; } StartCoroutine(CoShowCutArea()); //StartCoroutine(CoSpawnCutArea()); // var l = terrain.PathData.GetControls(); }
/// <summary> /// An popup lượt quân xanh da trời /// </summary> /// <returns></returns> IEnumerator HidePopupTurnBlue() { yield return(new WaitForSeconds(2)); _ListPopup[2].SetActive(false); _GameControler._GameState._IsEnemyStart = true; _GameControler._GameObj = _GameControler.GetMyTurn(); _GameControler._GameState._IsChangding = false; _GameControler._StopTime = false; _mapControler = FindObjectOfType <MapControler>(); _cameraControler.MoveCameraToBullet(_GameControler._GameObj.transform.position); _mapControler.MoveMapToBullet(_GameControler._GameObj.transform.position); StartCoroutine(TestWaitOffMyTurn()); }
// Update is called once per frame private void Update() { if (BattleControler.battleState == BattleState.battle) { legend.SetActive(Input.GetKey(KeyCode.F1)); } if (BattleControler.battleState != BattleState.creatingMap && ticker >= 2f) { loadMap.SetActive(false); infoButton.SetActive(true); } else { ticker += Time.deltaTime; } if (Input.GetKeyDown(KeyCode.Escape)) { if (BattleControler.battleState == BattleState.battle) { Debug.Log(BattleControler.battleState); setPause(0); BattleControler.battleState = BattleState.pause; } else if (BattleControler.battleState == BattleState.pause) { Debug.Log(BattleControler.battleState); setPause(1); BattleControler.battleState = BattleState.battle; } } if (BattleControler.battleState == BattleState.win) { if (ticker2 >= 1.5f) { winScreen.SetActive(true); if (itemOnce) { Player.Instance.inventory.ForEach(item => { item.DoOnBattleEnd(); }); lootText.text = BattleControler.goldLoot.ToString(); if (BattleControler.lootItem != null) { lootSprite.GetComponent <Image>().sprite = Resources.Load <Sprite>(BattleControler.lootItem.spritePath); lootSprite.SetActive(true); } else { lootSprite.SetActive(false); } itemOnce = false; } if (Input.anyKey && !bossBattle) { MapControler mapControler = GameObject.FindObjectOfType <MapControler>(); mapControler.PointOfStaying = mapControler.pointToGo; mapControler.PointOfStaying.GetInstantion().GetComponent <PointControler>().isVisited = true; OnClickSwapScenes(1); } if (Input.anyKey && bossBattle) { OnClickSwapScenes(4); } } else { ticker2 += Time.deltaTime; } } if (BattleControler.battleState == BattleState.lose) { if (ticker2 >= 1.5f) { loseScreen.SetActive(true); if (Input.anyKey) { OnClickSwapScenes(0); } } else { ticker2 += Time.deltaTime; } } }
// Use this for initialization private void Start() { mapControler = GameObject.Find("MapControler").GetComponent <MapControler>(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { _UIManager.ShowPanelExitGame(); } if (!_GameState._IsGamePlay) { return; } if ((_GameState._IsPlayerStart || _GameState._IsEnemyStart) && !_GameState._IsChangding && !_StopTime) { _timeCount += Time.deltaTime; if (_timeCount >= 1) { _timeCount = 0; if (_Timer > 0) { _Timer--; } _numberText.SetNumText2(_Timer, _ListImageTimer); GameObject[] objBullet = GameObject.FindGameObjectsWithTag("Bullet"); if (_Timer <= 0 && objBullet.Length == 0) { if (!_GameState._IsChangding) { ChangeTurn(); } } } } else { _Timer = 30; // _numberText.SetNumberText(0); } if (Input.GetMouseButtonDown(0)) { if (_GameState._IsPlayer && !_GameState._IsPlayerStart) { _UIManager.HidePopopTurnGreen(); _GameObj = GetMyTurn(); _GameState._IsChangding = false; _StopTime = false; //====== _mapControler = FindObjectOfType <MapControler>(); _cameraControler.MoveCameraToBullet(_GameObj.transform.position); _mapControler.MoveMapToBullet(_GameObj.transform.position); _cameraControler._IsMove = true; _mapControler._IsMove = true; } } if (_TypeGame == 1) { if (Input.GetMouseButtonDown(0)) { if (!_GameState._IsPlayer && !_GameState._IsEnemyStart) { _UIManager.HidePopopTurnBlue(); _GameObj = GetMyTurn(); _GameState._IsChangding = false; _StopTime = false; //====== _mapControler = FindObjectOfType <MapControler>(); _cameraControler.MoveCameraToBullet(_GameObj.transform.position); _mapControler.MoveMapToBullet(_GameObj.transform.position); _cameraControler._IsMove = true; _mapControler._IsMove = true; } } } }