void Start() { party = GameObject.Find("PlayerParty").GetComponent <PartyController>(); flow = GameObject.Find("BattleControllers").GetComponent <BattleFlowController>(); ui = GameObject.Find("BattleControllers").GetComponent <BattleUIController>(); action = Action.Item; }
// Use this for initialization void Start() { target = GameObject.Find("BattleControllers").GetComponent <TargetHandler>(); flow = GameObject.Find("BattleControllers").GetComponent <BattleFlowController>(); ui = GameObject.Find("BattleControllers").GetComponent <BattleUIController>(); action = Action.Attack; gameObject.GetComponent <Button>().onClick.AddListener(SetAction); }
// Use this for initialization void Start() { currentUnit = gameObject.GetComponent <UnitStats>(); enemyParty = GameObject.Find("EnemyParty(Clone)").GetComponent <EnemyPartyController>(); flow = GameObject.Find("BattleControllers").GetComponent <BattleFlowController>(); ui = GameObject.Find("BattleControllers").GetComponent <BattleUIController>(); attackDefend = GameObject.Find("BattleControllers").GetComponent <AttackDefendController>(); mode = GameObject.Find("BattleControllers").GetComponent <BattleModeController>(); item = GameObject.Find("BattleControllers").GetComponent <BattleItemController>(); ability = GameObject.Find("BattleControllers").GetComponent <BattleAbilityController>(); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
// Use this for initialization void Start() { ui = GameObject.Find("BattleControllers").GetComponent <BattleUIController>(); target = GameObject.Find("BattleControllers").GetComponent <TargetHandler>(); party = GameObject.Find("PlayerParty").GetComponent <PartyController>(); controller = GameObject.Find("BattleControllers").GetComponent <BattleItemController>(); gameObject.transform.SetParent(invPanel.transform, false); StartCoroutine("WaitAndUpdateText"); Button theBtn = gameObject.GetComponent <Button>(); theBtn.onClick.AddListener(SetAction); action = Action.Item; }
//********************************************************************************// void Start() { uiController = GetComponent <BattleUIController>(); characterBattleData = new BattleActionData[5]; userPartyData = new GameCharacter[5]; enemyPartyData = null; fadeManager = gameController.GetComponent <FadeManager>(); InitPartyData(); battleActionQueue = new List <BattleActionData>(); }
// Use this for initialization void Start() { units = new List <UnitStats> (); friendlyUnits = new List <UnitStats>(); enemyUnits = new List <UnitStats>(); ui = GameObject.Find("BattleControllers").GetComponent <BattleUIController>(); party = GameObject.Find("PlayerParty").GetComponent <PartyController>(); enemyEncounterObject = Instantiate(SceneMgmt.toFight); enemyEncounterObject.transform.SetParent(GameObject.Find("BattleHolder").transform); enemies = enemyEncounterObject.GetComponent <EnemyPartyController>(); ui.SetPartyAndEnemies(party, enemies); arenaPrefab = Instantiate(SceneMgmt.arena); arenaPrefab.transform.SetParent(GameObject.Find("BattleHolder").transform); int members = 0; for (int i = 0; i < party.playerParty.Length; i++) { if (party.playerParty[i] != null && members < 4 && party.playerParty[i].GetComponent <UnitStats>().available) { UnitStats member = party.playerParty[i].GetComponent <UnitStats>(); if (!member.IsDead()) { units.Add(member); } friendlyUnits.Add(member); members++; ui.CreatePartyButton(i, members); } } for (int i = 0; i < enemies.enemyParty.Length; i++) { if (enemies.enemyParty[i] != null && i < 4) { UnitStats enemy = enemies.enemyParty[i].GetComponent <UnitStats>(); units.Add(enemy); enemyUnits.Add(enemy); ui.CreateEnemyButton(i); } } StartCoroutine(WaitAndThenSort()); }
void Start() { flow = GameObject.Find("BattleControllers").GetComponent <BattleFlowController>(); ui = GameObject.Find("BattleControllers").GetComponent <BattleUIController>(); action = Action.Null; }
// Use this for initialization void Start() { flow = gameObject.GetComponent <BattleFlowController>(); ui = gameObject.GetComponent <BattleUIController>(); }
//动画控制函数 private void AnimationControl(float v, float h) { if (chaAnimationCon.IsAttacking() || chaAnimationCon.IsSkill3() || currenthp < 0) { return; } chaAnimationCon.SetAttackSpeed(attackSpeed); chaAnimationCon.SetHorizontal(h); chaAnimationCon.SetVertical(v); if (Input.GetKeyUp(KeyCode.Tab)) { isShowMouse = !isShowMouse; if (!isShowMouse) { cameraTransform.parent.parent.GetComponent <FreeLookCam>().OnLockCursor(); } else { cameraTransform.parent.parent.GetComponent <FreeLookCam>().OnShowCursor(); } } if (isShowMouse) { chaAnimationCon.SetHorizontal(0); chaAnimationCon.SetVertical(0); chaAnimationCon.Move(); return; } BattleUIController battleUIController = BattleUIController.Instance; if (!Input.GetKey(KeyCode.LeftShift)) { chaAnimationCon.Walk(); } else { chaAnimationCon.Run(); } chaAnimationCon.Move(); if (Input.GetKeyUp(KeyCode.Mouse0)) { currentSkillID = 0; chaAnimationCon.SetNormalAttackDir(0); chaAnimationCon.Attack(0); } if (Input.GetKeyUp(KeyCode.Mouse1)) { currentSkillID = 0; chaAnimationCon.SetNormalAttackDir(1); chaAnimationCon.Attack(0); } if (Input.GetKeyUp(KeyCode.Q)) { if ((currentmp - 20) < 0) { return; } if (!battleUIController.UseSkill(1)) { return; } currentmp -= 20; currentSkillID = 1; chaAnimationCon.Attack(1); energyChangeEvent.Invoke(maxmp, currentmp); } if (Input.GetKeyUp(KeyCode.E)) { if ((currentmp - 20) < 0) { return; } if (!battleUIController.UseSkill(2)) { return; } currentmp -= 20; currentSkillID = 2; chaAnimationCon.Attack(2); energyChangeEvent.Invoke(maxmp, currentmp); } if (Input.GetKeyUp(KeyCode.R)) { if ((currentmp - 100) < 0) { return; } if (!battleUIController.UseSkill(3)) { return; } currentmp -= 100; currentSkillID = 3; chaAnimationCon.Attack(3); energyChangeEvent.Invoke(maxmp, currentmp); } if (Input.GetKeyUp(KeyCode.Alpha1)) { if (!battleUIController.UseHPMedication()) { return; } currenthp = ((currenthp + battleUIController.GetAddHp()) > maxhp ? maxhp : (currenthp + battleUIController.GetAddHp())); bloodChangeEvent.Invoke(maxhp, currenthp); if (resumeHPEffect != null) { (Instantiate(resumeHPEffect, transform.position, transform.rotation) as GameObject).transform.SetParent(transform); } } if (Input.GetKeyUp(KeyCode.Alpha2)) { if (!battleUIController.UseMPMedication()) { return; } currentmp = ((currentmp + battleUIController.GetAddMp()) > maxmp ? maxmp : (currentmp + battleUIController.GetAddMp())); energyChangeEvent.Invoke(maxmp, currentmp); if (resumeMPEffect != null) { (Instantiate(resumeMPEffect, transform.position, transform.rotation) as GameObject).transform.SetParent(transform); } } }
// Use this for initialization void Start() { won = false; xpNotCounted = true; enemiesGameObjects.Clear(); enemiesScripts.Clear(); playerTurn = true; enemiesAmount = Enemies.Length; GameObject player = Instantiate(PlayerPrefab, PlayerTransform); playerObject = player; playerScript = player.GetComponent <PlayerBattleScript>(); switch (enemiesAmount) { case 1: case 3: enemyTransforms = EnemiesTransforms3; break; case 2: enemyTransforms = EnemiesTransforms2; break; default: throw new Exception("EnemiesAmount invalid"); } for (int i = 0; i < enemiesAmount; i++) { GameObject enemy; if (Enemies[i].MageType == MageType.Prince) { enemy = Instantiate(PrincePrefab, enemyTransforms[i]); } else { enemy = Instantiate(MagePrefab, enemyTransforms[i]); } EnemyBattleScript enemyScript = enemy.GetComponent <EnemyBattleScript>(); enemiesGameObjects.Add(enemy); enemiesScripts.Add(enemyScript); } for (int i = 0; i < enemiesAmount; i++) { GameObject enemy = enemiesGameObjects[i]; EnemyBattleScript enemyScript = enemy.GetComponent <EnemyBattleScript>(); Canvas canvas = enemyTransforms[i].gameObject.GetComponentInChildren <Canvas>(); SlidingBar slidingBar = enemyTransforms[i].gameObject.GetComponentInChildren <SlidingBar>(); enemyScript.Init(Enemies[i].Level, Enemies[i].MageType, enemiesGameObjects.ToArray(), slidingBar, canvas); } alive = new bool[enemiesAmount]; for (int i = 0; i < alive.Length; i++) { alive[i] = true; } playerScript.SetEnemiesGameObjects(enemiesGameObjects.ToArray()); battleUIScript = battleUIObject.GetComponent <BattleUIController> (); battleUIScript.SetBattleScript(playerScript); battleUIScript.SetEnemiesGameObjects(enemiesGameObjects.ToArray()); healthBar.SetMaxValue(playerEntity.Stats.MaxHealth); }