public void TestWhenFuncWithNullValueNoDefaultAndTrue() { const string C_INPUT = null; const string C_EXPECTED = C_INPUT; Assert.AreEqual(C_EXPECTED, C_INPUT.When(_ => true, _ => _.Replace("World", "John"))); }
public void TestWhenActionWithNullValueAndTrue() { const string C_INPUT = null; const string C_EXPECTED = C_INPUT; Assert.AreEqual(C_EXPECTED, C_INPUT.When(_ => true, _ => { })); }
public void TestWhenActionWithNonNullValueAndFalse() { const string C_INPUT = "Hello World"; const string C_EXPECTED = C_INPUT; Assert.AreEqual(C_EXPECTED, C_INPUT.When(_ => false, _ => { })); }
public void TestWhenFuncWithNonNullValueNoDefaultAndFalse() { const string C_INPUT = "Hello World"; const string C_EXPECTED = default(string); Assert.AreEqual(C_EXPECTED, C_INPUT.When(_ => false, _ => _.Replace("World", "John"))); }
public void TestUnlessActionWithNullValueAndFalse() { const string C_INPUT = null; const string C_EXPECTED = C_INPUT; Assert.AreEqual(C_EXPECTED, C_INPUT.Unless(_ => false, _ => { })); }
public void TestWhenActionWithNullValueAndFalse() { const string C_INPUT = null; const string C_EXPECTED = default(string); Assert.AreEqual(C_EXPECTED, C_INPUT.When(_ => false, _ => { })); }
public void TestUnlessFuncWithNullValueNoDefaultAndTrue() { const string C_INPUT = null; const string C_EXPECTED = default(string); Assert.AreEqual(C_EXPECTED, C_INPUT.Unless(_ => true, _ => _.Replace("World", "John"))); }
public void TestUnlessActionWithNullValueAndTrue() { const string C_INPUT = null; const string C_EXPECTED = default(string); Assert.AreEqual(C_EXPECTED, C_INPUT.Unless(_ => true, _ => { })); }
public void TestUnlessActionWithNonNullValueAndTrue() { const string C_INPUT = "Hello World"; const string C_EXPECTED = C_INPUT; Assert.AreEqual(C_EXPECTED, C_INPUT.Unless(_ => true, _ => { })); }
public void TestMaybeFuncWithNullValueNoDefault() { const string C_INPUT = null; const string C_EXPECTED = C_INPUT; Assert.AreEqual(C_EXPECTED, C_INPUT.Maybe(_ => _.Replace("World", "John"))); }
public void TestWhenFuncWithNonNullValueWithDefaultAndTrue() { const string C_INPUT = "Hello World"; const string C_DEFAULT = "Wayne's World"; const string C_EXPECTED = "Hello John"; Assert.AreEqual(C_EXPECTED, C_INPUT.When(_ => true, _ => _.Replace("World", "John"), C_DEFAULT)); }
public void TestMaybeFuncWithNullValueWithDefault() { const string C_INPUT = null; const string C_DEFAULT = "Wayne's World"; const string C_EXPECTED = C_DEFAULT; Assert.AreEqual(C_EXPECTED, C_INPUT.Maybe(_ => _.Replace("World", "John"), C_DEFAULT)); }
public void TestUnlessFuncWithNonNullValueWithDefaultAndFalse() { const string C_INPUT = "Hello World"; const string C_DEFAULT = "Wayne's World"; const string C_EXPECTED = "Hello John"; Assert.AreEqual(C_EXPECTED, C_INPUT.Unless(_ => false, _ => _.Replace("World", "John"), C_DEFAULT)); }
public void TestUnlessFuncWithNullValueWithDefaultAndTrue() { const string C_INPUT = null; const string C_DEFAULT = "Wayne's World"; const string C_EXPECTED = C_DEFAULT; Assert.AreEqual(C_EXPECTED, C_INPUT.Unless(_ => true, _ => _.Replace("World", "John"), C_DEFAULT)); }
public void TestWhenFuncWithNullValueWithDefaultAndFalse() { const string C_INPUT = null; const string C_DEFAULT = "Wayne's World"; const string C_EXPECTED = C_DEFAULT; Assert.AreEqual(C_EXPECTED, C_INPUT.When(_ => false, _ => _.Replace("World", "John"), C_DEFAULT)); }
public void UpdateUi(C_PLAYER cPlayer, C_GAMECOIN cGameCoin, C_INPUT cInput) { m_txtGold.text = cPlayer.getGoid().ToString(); m_txtCoinCount.text = cPlayer.getCoin().ToString(); m_txtHealth.text = cPlayer.getHealth().ToString(); m_txtCoinName.text = cGameCoin.getCoinName(); m_txtCoinFlutuation.text = cGameCoin.getFlutuatuion().ToString() + "%"; m_txtCoinPrice.text = cGameCoin.getCoinPrice().ToString(); m_txtUpgradeTower.text = cInput.getUpgradePrice().ToString(); }
private void init() { m_cStageMgr = new C_STAGEMGR(); m_cPlayer = GameObject.Find("Player").GetComponent <C_PLAYER>(); m_QternCameraRotate = Camera.main.transform.rotation; m_goLoadData = GameObject.Find("LoadData"); m_cLoadData = m_goLoadData.GetComponent <C_LOADDATA>(); m_cGameCoin = m_cPlayer.gameObject.GetComponent <C_GAMECOIN>(); m_cPlayer.init(PlayerPrefs.GetInt("StartResource"), 0, 30); Debug.Log(PlayerPrefs.GetInt("coinPrice") + " " + PlayerPrefs.GetInt("StartResource") + " " + PlayerPrefs.GetFloat("difficultyHp")); m_cStageMgr.init(m_goMovingPoint, m_goPosibleTile, m_goImposibleTile, m_cPlayer, m_cLoadData.getLoadNode(), PlayerPrefs.GetFloat("difficultyHp")); m_cGameCoin.init(PlayerPrefs.GetInt("coinPrice")); m_cGameCoin.FlututionCoin((m_cStageMgr.getEnemyWave().GetComponent <C_ENEMYWAVE>().getStageCount() + 1)); m_cUi = new C_UI(); m_cUi.init(); //m_cUi.UpdateUi(m_cPlayer, m_cGameCoin,m_cInput); m_cStageMgr.getEnemyWave().GetComponent <C_ENEMYWAVE>().setPlayer(m_cPlayer); m_cStageMgr.getEnemyWave().GetComponent <C_ENEMYWAVE>().setDifficultyHp(PlayerPrefs.GetFloat("difficultyHp")); C_TOWERINFO.m_fUpgradeCount = 0; m_goMapHolder = GameObject.Find("MarsMaps"); m_goTowerHolder = new GameObject(); m_goTowerHolder.name = "TowerHolder"; m_goTowerHolder.transform.position = new Vector3(11.0f, 0.0f, 11.0f); m_cInput = GameObject.Find("UIEvent").GetComponent <C_INPUT>(); m_cInput.load(m_cPlayer, m_cGameCoin, m_cStageMgr.getEnemyWave().GetComponent <C_ENEMYWAVE>(), m_goTowerHolder); //m_cMyTowerProc = GameObject.Find("TowerCreater").GetComponent<C_MYTOWERPROC>(); m_cMyTowerProc = new C_MYTOWERPROC(); m_cMyTowerProc.init(); m_cSceneMgr = gameObject.GetComponent <C_SCENEMGR>(); m_cGameOver = GameObject.Find("MainUiCanvas").transform.GetChild(5).GetComponent <C_GAMEOVER>(); m_goQuestionBox = GameObject.Find("QuestionCanvas"); m_goQuestionBox.GetComponent <C_QUESTIONMESSAGEBOX>().CloseQuestionBox(); m_goEnemyHolder = GameObject.Find("EnemyHolder"); m_goMovingPointHolder = GameObject.Find("MovingPoints"); }
public void createTower(RaycastHit rayHit, GameObject goTowerHolder, C_LOADDATA cLoadData, C_INPUT cInput) { int nRandom = 0; Debug.Log(m_cLoadData.getLoadCustomTower().getGardeList(0).ToArray().Length); nRandom = Random.Range(0, m_cLoadData.getLoadCustomTower().getGardeList(0).ToArray().Length); m_goTurret = CreateTowerPrefab((C_LOADCUSTOMTOWER.E_LISTTOWERNUM)nRandom); rayHit.transform.gameObject.GetComponent <C_NODE>().m_goTower = Instantiate(m_goTurret, rayHit.transform.position + new Vector3(0.0f, 1.0f, 0.0f), Quaternion.identity); upgradeTowerData(rayHit.transform.gameObject.GetComponent <C_NODE>().m_goTower, m_cLoadData.getLoadCustomTower().getGardeList(0)[nRandom]); rayHit.transform.gameObject.GetComponent <C_NODE>().m_goTower.GetComponent <C_TOWER>().m_nLevel = 0; rayHit.transform.gameObject.GetComponent <C_NODE>().m_goTower.GetComponent <C_TOWER>().m_goMyNode = rayHit.transform.gameObject; rayHit.transform.gameObject.GetComponent <C_NODE>().m_goTower.transform.parent = goTowerHolder.transform; cInput.offIsBuild(); }
public void upgradeTurret(RaycastHit rayHit, GameObject goTowerHolder, C_LOADDATA cLoadData, C_INPUT cInput) { if (rayHit.transform.parent.gameObject.GetComponent <C_TOWER>().m_nLevel == 3) { return; } int nIndex = 0; int nCount = 0; int nTmpIndex = 0; while (nIndex < goTowerHolder.transform.childCount && nCount == 0) { if (rayHit.transform.parent.name == goTowerHolder.transform.GetChild(nIndex).name&& goTowerHolder.transform.GetChild(nIndex) != rayHit.transform.parent) { nTmpIndex = nIndex; nCount++; } nIndex++; } int nTowerLevel = rayHit.transform.parent.gameObject.GetComponent <C_TOWER>().m_nLevel + 1; if (nCount == 0 || m_cLoadData.getLoadCustomTower().getGardeList(nTowerLevel).ToArray().Length == 0) { return; } else { int nRandom = 0; Debug.Log(nTowerLevel); nRandom = Random.Range(0, m_cLoadData.getLoadCustomTower().getGardeList(nTowerLevel).ToArray().Length); Debug.Log(m_cLoadData.getLoadCustomTower().getGardeList(nTowerLevel)[nRandom]); m_goTurret = CreateTowerPrefab((C_LOADCUSTOMTOWER.E_LISTTOWERNUM)m_cLoadData.getLoadCustomTower().getGardeList(nTowerLevel)[nRandom]); GameObject goTmpTower = Instantiate(m_goTurret, rayHit.transform.parent.position, Quaternion.identity); upgradeTowerData(goTmpTower, m_cLoadData.getLoadCustomTower().getGardeList(nTowerLevel)[nRandom]); goTmpTower.transform.parent = goTowerHolder.transform; goTmpTower.GetComponent <C_TOWER>().m_goMyNode = rayHit.transform.parent.gameObject.GetComponent <C_TOWER>().m_goMyNode; goTmpTower.GetComponent <C_TOWER>().m_nLevel = nTowerLevel; Destroy(goTowerHolder.transform.GetChild(nTmpIndex).gameObject); Destroy(rayHit.transform.parent.gameObject); goTmpTower.GetComponent <C_TOWER>().m_goMyNode.GetComponent <C_NODE>().m_goTower = goTmpTower; cInput.offIsMerge(); } }