void Init() { transform.parent = MagicController.Instance.magicRoot; transform.localPosition = Vector3.zero; transform.localEulerAngles = Vector3.zero; transform.localScale = Vector3.one; warCtrl = MagicController.Instance.warCtrl; side = MagicController.Instance.GetMagicSide(); enemySide = MagicController.Instance.GetMagicEnemySide(); enemyCenterPoint = warCtrl.GetArmyCentrePoint(enemySide); Vector3 upOffset; Vector3 downOffset; Vector3 scale; if (side == WarSceneController.WhichSide.Left) { upOffset = upOffsetLeft; downOffset = downOffsetLeft; scale = WarSceneController.manScaleLeft; } else { upOffset = upOffsetRight; downOffset = downOffsetRight; scale = WarSceneController.manScaleRight; } Vector3[] carPositionFrom = new Vector3[] { enemyCenterPoint + upOffset, enemyCenterPoint + downOffset, enemyCenterPoint + upOffset + upSpace, enemyCenterPoint + downOffset + downSpace }; upOffset.x = -upOffset.x; downOffset.x = -downOffset.x; Vector3[] carPositionTo = new Vector3[] { enemyCenterPoint + upOffset, enemyCenterPoint + downOffset, enemyCenterPoint + upOffset + upSpace, enemyCenterPoint + downOffset + downSpace }; for (int i = 0; i < level * 2; i++) { GameObject go = InstantiateOneGO(carName, carPositionFrom[i], scale, WarSceneController.manEulerAngles); go.SetActive(false); go.GetComponent <MagicChongCheAct>().SetInfo(carPositionFrom[i], carPositionTo[i]); listCar.Add(go); } }
void Init() { warCtrl = MagicController.Instance.warCtrl; enemySide = MagicController.Instance.GetMagicEnemySide(); armyCenterPoint = warCtrl.GetArmyCentrePoint(enemySide); transform.parent = MagicController.Instance.magicRoot; transform.localPosition = Vector3.zero; transform.localEulerAngles = Vector3.zero; transform.localScale = Vector3.one; }
void Init() { transform.parent = MagicController.Instance.magicRoot; transform.localPosition = Vector3.zero; transform.localEulerAngles = Vector3.zero; transform.localScale = Vector3.one; warCtrl = MagicController.Instance.warCtrl; side = MagicController.Instance.GetMagicSide(); enemySide = MagicController.Instance.GetMagicEnemySide(); enemyCenterPos = warCtrl.GetArmyCentrePoint(enemySide); List <SolidersController> listSoldier = new List <SolidersController>(); for (int i = 0; i < level; i++) { SolidersController sCtrl = MagicController.Instance.warCtrl.GetRandomSolider(enemySide); Vector3 pos; if (sCtrl != null && !listSoldier.Contains(sCtrl)) { pos = sCtrl.transform.localPosition; listSoldier.Add(sCtrl); } else { if (!isHitGeneral && Random.Range(0, 100) < 40) { isHitGeneral = true; GeneralController gCtrl; if (enemySide == WarSceneController.WhichSide.Left) { gCtrl = MagicController.Instance.warCtrl.leftGeneral; } else { gCtrl = MagicController.Instance.warCtrl.rightGeneral; } pos = gCtrl.transform.localPosition; } else { pos = enemyCenterPos; pos.x += Random.Range(-180, 180); pos.y += Random.Range(-100, 100); } } GameObject go = InstantiateOneGO(tornadoName, pos, Vector3.one, Vector3.zero); go.SetActive(false); listTornado.Add(go); } }
void Init() { transform.parent = MagicController.Instance.magicRoot; transform.localPosition = Vector3.zero; transform.localEulerAngles = Vector3.zero; transform.localScale = Vector3.one; warCtrl = MagicController.Instance.warCtrl; enemySide = MagicController.Instance.GetMagicEnemySide(); enemyCenterPoint = warCtrl.GetArmyCentrePoint(enemySide); go = (GameObject)Instantiate(Resources.Load(wordName)); go.transform.parent = transform; go.transform.localPosition = enemyCenterPoint; go.SetActive(false); }
void Init() { warCtrl = MagicController.Instance.warCtrl; centerPoint = warCtrl.GetArmyCentrePoint(MagicController.Instance.GetMagicEnemySide()); transform.parent = MagicController.Instance.magicRoot; transform.localPosition = centerPoint; side = MagicController.Instance.GetMagicSide(); if (side == WarSceneController.WhichSide.Left) { transform.localPosition = new Vector3(transform.localPosition.x - 100, transform.localPosition.y, transform.localPosition.z); } else { transform.localPosition = new Vector3(transform.localPosition.x + 100, transform.localPosition.y, transform.localPosition.z); } transform.localEulerAngles = Vector3.zero; transform.localScale = Vector3.one; }
void Init() { transform.parent = MagicController.Instance.magicRoot; transform.localPosition = Vector3.zero; transform.localEulerAngles = Vector3.zero; transform.localScale = Vector3.one; warCtrl = MagicController.Instance.warCtrl; side = MagicController.Instance.GetMagicSide(); enemySide = MagicController.Instance.GetMagicEnemySide(); enemyCenterPoint = warCtrl.GetArmyCentrePoint(enemySide); Vector3 scale; Vector3 juShiDownOff; Vector3 juShiBasePos; float juShiXStep; if (side == WarSceneController.WhichSide.Left) { scale = WarSceneController.manScaleLeft; juShiDownOff = juShiDownOffLeft; juShiBasePos = juShiBasePosLeft; juShiXStep = juShiXStepLeft; } else { scale = WarSceneController.manScaleRight; juShiDownOff = juShiDownOffRight; juShiBasePos = juShiBasePosRight; juShiXStep = juShiXStepRight; } for (int i = 0; i < levelNum[level - 1]; i++) { int col = i / 6; int row = i % 6; Vector3 pos = new Vector3(juShiBasePos.x + juShiXStep * col, juShiBasePos.y + juShiYStep * row, juShiBasePos.z); GameObject go = InstantiateOneGO(juShiName, pos, scale, WarSceneController.manEulerAngles); listJuShi.Add(go); List <SolidersController> listSolidersAdded = new List <SolidersController>(); SolidersController sCtrl = MagicController.Instance.warCtrl.GetRandomSolider(enemySide); if (sCtrl != null && !listSolidersAdded.Contains(sCtrl)) { listSolidersAdded.Add(sCtrl); pos = sCtrl.transform.localPosition; pos.z = 0; pos += juShiDownOff; } else { if (!hitGeneral && Random.Range(0, 100) < 40) { hitGeneral = true; GeneralController gCtrl; if (enemySide == WarSceneController.WhichSide.Left) { gCtrl = MagicController.Instance.warCtrl.leftGeneral; } else { gCtrl = MagicController.Instance.warCtrl.rightGeneral; } pos = gCtrl.transform.localPosition; pos.z = 0; pos += juShiDownOff; } else { pos = new Vector3(enemyCenterPoint.x + Random.Range(-150, 150), enemyCenterPoint.y + Random.Range(-80, 80), -150); } } go = InstantiateOneGO(juShiDownName, pos, scale, WarSceneController.manEulerAngles); go.SetActive(false); go.GetComponent <MagicJuShiDown>().SetInfo(pos, pos - juShiDownOff, this); listJuShiDown.Add(go); } }
void Init() { transform.parent = MagicController.Instance.magicRoot; transform.localPosition = Vector3.zero; transform.localEulerAngles = Vector3.zero; transform.localScale = Vector3.one; warCtrl = MagicController.Instance.warCtrl; side = MagicController.Instance.GetMagicSide(); enemySide = MagicController.Instance.GetMagicEnemySide(); enemyCenterPos = warCtrl.GetArmyCentrePoint(enemySide); Vector3 posGeneral; if (side == WarSceneController.WhichSide.Left) { posGeneral = warCtrl.leftGeneral.transform.localPosition; } else { posGeneral = warCtrl.rightGeneral.transform.localPosition; } yellowDragon = InstantiateOneGO(yellowDragonName, posGeneral, WarSceneController.manScaleRight, WarSceneController.manEulerAngles); yellowDragon.SetActive(false); particalGO = (GameObject)Instantiate(Resources.Load(particalName1)); particalGO.transform.parent = transform; particalGO.transform.localPosition = posGeneral; for (int i = 0; i < 10; i++) { Vector3 posUp = posGeneral; posUp.x += Random.Range(-30, 30); GameObject go = InstantiateOneGO(fireUpName, posUp, WarSceneController.manScaleRight, WarSceneController.manEulerAngles); go.SetActive(false); listFireUp.Add(go); go = InstantiateOneGO(fireDownName, Vector3.zero, WarSceneController.manScaleRight, WarSceneController.manEulerAngles); go.SetActive(false); listFireDown.Add(go); MagicFireDown fireDownScript = go.GetComponent <MagicFireDown>(); SolidersController sCtrl = MagicController.Instance.warCtrl.GetRandomSolider(enemySide); Vector3 pos; if (sCtrl != null) { pos = sCtrl.transform.localPosition; pos.z = -150; } else { if (!hitGeneral && Random.Range(0, 100) < 20) { hitGeneral = true; GeneralController gCtrl; if (enemySide == WarSceneController.WhichSide.Left) { gCtrl = MagicController.Instance.warCtrl.leftGeneral; } else { gCtrl = MagicController.Instance.warCtrl.rightGeneral; } pos = gCtrl.transform.localPosition; pos.z = -150; } else { pos = new Vector3(enemyCenterPos.x + Random.Range(-150, 150), enemyCenterPos.y + Random.Range(-80, 80), -150); } } fireDownScript.SetInfo(pos, this); go = InstantiateOneGO(fireExplodeName, Vector3.zero, WarSceneController.manScaleRight, WarSceneController.manEulerAngles); go.SetActive(false); listFireExplode.Add(go); } }