private void _createHeroBall(BattleHeroModel model) { BattleBall monsterBall = Instantiate(ballItem) as BattleBall; monsterBall.setBattleModel(model); monsterBall.transform.SetParent(ballContainer); monsterBall.transform.localScale = new Vector3(100, 100, 1); Vector3 point = model.getPos(); monsterBall.transform.localPosition = point; monsterBall.gameObject.SetActive(true); model.setAction(false); model.MOVE_END += _nextAction; }
private void _nextAction(BattleHeroModel moveEndModel) { SolaEngine engine = SolaEngine.getInstance(); BattleMgr bMgr = (BattleMgr)engine.getMgr(typeof(BattleMgr)); if (bMgr.getMonsters().Count == 0) { bool isWin = bMgr.nextRound(); if (isWin == true) { resultDialog.gameObject.SetActive(true); resultDialog.updateView(); } return; } if (bMgr.isWin() == false && bMgr.getPartners().Count == 0) { resultDialog.gameObject.SetActive(true); resultDialog.updateView(); return; } if (moveEndModel != null) { bMgr.applyAction(moveEndModel); } else { bMgr.resetAction(); } List <BattleHeroModel> actionSeq = bMgr.getActionSeq(); BattleHeroModel actionModel = actionSeq [0]; actionModel.setAction(true); for (int i = 0; i < actionSeq.Count; i++) { BattleHeroModel model = actionSeq[i]; GameObject container = actionHeadContainers[i]; Transform containerTranform = container.transform; foreach (Transform child in containerTranform) { child.gameObject.SetActive(false); Destroy(child.gameObject); } BattleActionHead head = Instantiate(actionHeadItem) as BattleActionHead; head.setModel(model); head.transform.SetParent(containerTranform); head.transform.localScale = new Vector3(1, 1, 1); head.transform.localPosition = new Vector3(0, 0, 0); head.transform.localEulerAngles = new Vector3(0, 0, 0); } if (actionModel.isMonster()) { // Debug.Log("actionModel.autoAtk();"); actionModel.autoAtk(); } }