// Use this for initialization void Start() { xpBarRect = xpBar.GetComponent <RectTransform>(); xpBarIncRect = xpBarInc.GetComponent <RectTransform>(); battleCont = battleController.GetComponent <BattleControl>(); playerMonster = battleCont.playerMon; }
void Start() { setNormalSpeed(3); myAnimator = GetComponent <Animator>(); rb = GetComponent <Rigidbody2D>(); bc = GetComponent <BattleControl>(); }
private void attack(Card attacker) { Control control = server.control; BattleControl battleControl = control.getBattleControl(); int opponent_id = control.getOpponentId(); if (gameObject.tag == "enemy") { if (battleControl.canAttackPlayer(attacker) && server.tryAttackPlayer(attacker.getID(), attacker.getPosition())) { battleControl.directAttack(attacker, opponent_id); } } else { Card target = transform.GetComponent <CardGOInstance>().card; if (target == null) { return; } if (battleControl.canAttackCharacter(attacker, target) == false) { return; } bool can_attack_target = server.tryAttackCharacter(attacker.getID(), target.getID(), attacker.getPosition(), target.getPosition()); if (can_attack_target) { battleControl.cardAttackCard(attacker, target); } } }
void Awake() { _player = GameObject.FindGameObjectWithTag(Tags.player).GetComponent <PlayerControl> (); _sceneFade = GameObject.FindGameObjectWithTag(Tags.sceneFader).GetComponent <SceneFade> (); _battleController = GameObject.FindGameObjectWithTag(Tags.battle).GetComponent <BattleControl> (); _levels = new List <LevelGateControl> (); }
void Awake() { _player = GameObject.FindGameObjectWithTag(Tags.player).GetComponent <PlayerControl> (); _panel = GetComponent <UIPanel> (); _fader = GameObject.FindGameObjectWithTag(Tags.sceneFader).GetComponent <SceneFade> (); _gamerController = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <GameController> (); _battleController = GameObject.FindGameObjectWithTag(Tags.battle).GetComponent <BattleControl> (); }
// Use this for initialization void Awake() { battleControlScript = battleController.GetComponent <BattleControl>(); dialogue = GetComponent <BattleDialogue>(); battleStateControlScript = battleController.GetComponent <BattleStateControl>(); textUIControl = GetComponent <BattleTextUIControl>(); newMovePanel.SetActive(false); }
void Awake() { _battleController = GetComponentInParent <BattleControl> (); _originalLocalPosition = transform.localPosition; _battleCard = GetComponent <BattleCard> (); _shellQueue = (_shellType == ShellType.Player) ? _battleController._playerCardShellSet : _battleController._enemyCardShellSet; _vacant = true; _displayed = false; }
// Use this for initialization void Awake() { _alive = true; _battleController = GameObject.FindGameObjectWithTag(Tags.battle).GetComponent <BattleControl>(); _health = 3; _showDetailTimer = 0f; _clickTimer = 0f; }
// Use this for initialization void Start() { RoomStorage.Init (); Party.Init(); MessageHandler.Init(); MessageLog.Init(); MainControl.dControl = new DungeonControl(); MainControl.bControl = new BattleControl(); }
void Start() { mainRpgStatus = MainRpgStatus.WALK; battleScreen.SetActive(false); playerMovement = player.GetComponent <PlayerMovement>(); playerStepsLimit = playerMovement.playerStepsLimit; battleControl = battleController.GetComponent <BattleControl>(); }
// 处理动画 public virtual void Handle(BattleControl battleControl, BaseAction action) { this.battleControl = battleControl; roomUI = battleControl.roomUI; this.action = action; InitHandle(); StartCoroutine(_Handle()); }
private void Start() { camera = this.GetComponent <Camera>(); camTransform = this.GetComponent <Transform>(); bControl = FindObjectOfType <BattleControl>(); startPos = camTransform.position; startRot = camTransform.rotation; StartCoroutine(waitStart()); }
public Control(int player_id) { this.setPlayersIds(player_id); this.field = new Field(this); this.battleControl = new BattleControl(this, field); this.lifeControl = new LifeControl(player_id, opponent_id); this.mana = new ManaControl(this); this.effects_control = new EffectsControl(this); this.hand = GameObject.FindGameObjectWithTag("Hand").GetComponent <Hand>(); }
private void Start() { uiController = GetComponent <BattleUIControl>(); battleController = uiController.GetComponent <BattleControl>(); playerHPBarRect = playerHPBar.GetComponent <RectTransform>(); playerHPDamageRect = playerHPDamage.GetComponent <RectTransform>(); enemyHPBarRect = enemyHPBar.GetComponent <RectTransform>(); enemyHPDamageRect = enemyHPDamage.GetComponent <RectTransform>(); hpSizeMax = playerHPBarRect.rect.width; hpSize = hpSizeMax; }
static bool Prefix(BattleControl __instance) { if (__instance.GetComponent <BattleControl_Ext>() == null) { MainManager.battle.gameObject.AddComponent <BattleControl_Ext>(); } if (!__instance.cancelupdate && MainManager.pausemenu == null && MainManager.instance.inbattle) { __instance.GetComponent <BattleControl_Ext>().PracticeFKeys(); } return(true); }
// Use this for initialization void Start() { battleControl = GetComponent <BattleControl>(); cameraControl = FindObjectOfType <BattleCameraControl>(); uiController = battleUI.GetComponent <BattleUIControl>(); uiTextControl = battleUI.GetComponent <BattleTextUIControl>(); uiHPControl = battleUI.GetComponent <BattleHPControl>(); battleDialogue = battleUI.GetComponent <BattleDialogue>(); uIEventHandler = FindObjectOfType <BattleUIEventHandler>(); soundManager = FindObjectOfType <SoundManager>(); dataCont = GameObject.Find("GameDataController"); playerData = dataCont.GetComponent <PlayerDataHolder>(); }
void Start() { player = GameObject.Find("PlayerFX"); if (GameObject.FindWithTag("Enemy") != null) { aipath = GameObject.FindWithTag("Enemy").GetComponent <AIPath>(); aipath.canMove = false; } else { aipath = null; } mc = player.GetComponent <PlayerControl>(); bc = player.GetComponent <BattleControl>(); }
public void Init(BattleControl controller) { hand = new List<GameObject>(); draw_pile = new List<string>(); discard_pile = new List<string>(); for (int i=0; i<30; i++) { draw_pile.Add("Fireball"); } for (int i=0; i<12; i++) { DrawCard (); } OrganizeCards(); }
void Awake() { //Check if instance already exists if (instance == null) { //if not, set instance to this instance = this; } //If instance already exists and it's not this: else if (instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); } }
void Awake() { if (_jsonDataFile != null) { _allInfoDict = MiniJSON.Json.Deserialize(_jsonDataFile.text) as Dictionary <string, object>; } _uniqueIdentityString = transform.parent.name + name + GetType().ToString(); _player = GameObject.FindGameObjectWithTag(Tags.player).GetComponent <PlayerControl> (); // _starCounter = GameObject.FindGameObjectWithTag (Tags.starCounter).GetComponentInChildren<StarCounterControl> (); _sceneFade = GameObject.FindGameObjectWithTag(Tags.sceneFader).GetComponent <SceneFade> (); _battleController = GameObject.FindGameObjectWithTag(Tags.battle).GetComponent <BattleControl> (); //_battleController.gameObject.SetActive (false); _maps = new List <MapLayerControl> (); _levels = new List <LevelGateControl> (); _pathPoints = new List <PathPointControl> (); }
private void enemyAttack(JSONObject json) { int target_id = (int)json.GetField("target_id").n; JSONObject position = json.GetField("attacker_position"); Position attacker_position = JSONReader.getPositionInstance(position); Card attacker_card = control.getField().getCardByPosition(attacker_position); BattleControl battleControl = control.getBattleControl(); //atacou direto if (target_id == -1) { battleControl.directAttack(attacker_card, control.getPlayerId()); } else { JSONObject target_positionJSON = json.GetField("target_position"); Position target_position = JSONReader.getPositionInstance(target_positionJSON); Card target_card = control.getField().getCardByPosition(target_position); battleControl.cardAttackCard(attacker_card, target_card); } }
public void LoadData() { ArrayList data = XMLHandler.LoadXML(dir+filename); this.system = new BattleSystem(); this.menu = new BattleMenu(); this.end = new BattleEnd(); this.cam = new BattleCam(); this.control = new BattleControl(); this.effectTextSettings = new BattleTextSettings(); this.missTextSettings = new BattleTextSettings("Miss"); this.blockTextSettings = new BattleTextSettings("Block"); this.castCancelTextSettings = new BattleTextSettings("Cast canceled"); this.levelUpTextSettings = new BattleTextSettings("Level up!"); this.classLevelUpTextSettings = new BattleTextSettings("Class level up!"); this.counterText = new ArrayList(); this.allAlliesText = new ArrayList(); this.allEnemiesText = new ArrayList(); this.stealItemText = new ArrayList(); this.stealItemFailText = new ArrayList(); this.stealMoneyText = new ArrayList(); this.stealMoneyFailText = new ArrayList(); this.battleStartText = new ArrayList(); this.battleVictoryText = new ArrayList(); this.battleDefeatText = new ArrayList(); this.battleEscapeText = new ArrayList(); for(int i=0; i<DataHolder.Languages().GetDataCount(); i++) { this.counterText.Add("Counter attack"); this.allAlliesText.Add("All allies"); this.allEnemiesText.Add("All enemies"); this.stealItemText.Add("%n stole %"); this.stealItemFailText.Add("Steal failed"); this.stealMoneyText.Add("%n stole %"); this.stealMoneyFailText.Add("Steal failed"); this.battleStartText.Add("Fight!"); this.battleVictoryText.Add("Victory"); this.battleDefeatText.Add("You are defeated"); this.battleEscapeText.Add("You escaped"); } if(data.Count > 0) { foreach(Hashtable entry in data) { if(entry[XMLHandler.NODE_NAME] as string == BattleSystemData.BATTLESYSTEM) { if(entry.ContainsKey(XMLHandler.NODES)) { ArrayList subs = entry[XMLHandler.NODES] as ArrayList; foreach(Hashtable val in subs) { if(val[XMLHandler.NODE_NAME] as string == BattleSystemData.SYSTEM) { this.system.type = (BattleSystemType)System.Enum.Parse( typeof(BattleSystemType), (string)val["type"]); if(val.ContainsKey("enemycounting")) { this.system.enemyCounting = (EnemyCounting)System.Enum.Parse( typeof(EnemyCounting), (string)val["enemycounting"]); } this.system.turnCalc = int.Parse((string)val["turncalc"]); if(val.ContainsKey("starttimecalc")) this.system.startTimeCalc = int.Parse((string)val["starttimecalc"]); this.system.defendFormula = int.Parse((string)val["defendformula"]); this.system.escapeFormula = int.Parse((string)val["escapeformula"]); this.system.actionBorder = int.Parse((string)val["actionborder"]); if(val.ContainsKey("menuborder")) { this.system.menuBorder = int.Parse((string)val["menuborder"]); } else this.system.menuBorder = this.system.actionBorder; if(val.ContainsKey("maxtimebar")) { this.system.maxTimebar = int.Parse((string)val["maxtimebar"]); } else this.system.maxTimebar = this.system.actionBorder; if(val.ContainsKey("enablemultichoice")) this.system.enableMultiChoice = true; if(val.ContainsKey("useallactions")) this.system.useAllActions = true; if(val.ContainsKey("usetimebaraction")) { this.system.useTimebarAction = (UseTimebarAction)System.Enum.Parse( typeof(UseTimebarAction), (string)val["usetimebaraction"]); } this.system.activeCommand = bool.Parse((string)val["activecommand"]); this.system.actionPause = bool.Parse((string)val["actionpause"]); if(val.ContainsKey("dynamiccombat")) { this.system.dynamicCombat = true; if(val.ContainsKey("mintimebetween")) { this.system.minTimeBetween = float.Parse((string)val["mintimebetween"]); } } if(val.ContainsKey("playdamageanim")) this.system.playDamageAnim = true; if(val.ContainsKey("blockautoatkmenu")) this.system.blockAutoAttackMenu = true; if(val.ContainsKey("turnbonuses")) { this.system.turnBonuses = true; this.system.statusBonus = new int[int.Parse((string)val["turnbonuses"])]; } if(val.ContainsKey("revivesets")) { this.system.reviveAfterBattle = true; int count = int.Parse((string)val["revivesets"]); this.system.reviveSetStatus = new bool[count]; this.system.reviveStatus = new int[count]; } if(val.ContainsKey("startstatuses")) { this.system.startBattleStatusSettings = true; int count = int.Parse((string)val["startstatuses"]); this.system.startSetStatus = new bool[count]; this.system.startStatus = new int[count]; } if(val.ContainsKey("endstatuses")) { this.system.endBattleStatusSettings = true; int count = int.Parse((string)val["endstatuses"]); this.system.endSetStatus = new bool[count]; this.system.endStatus = new int[count]; } if(val.ContainsKey("attacktimebaruse")) { this.system.attackEndTurn = false; this.system.attackTimebarUse = float.Parse((string)val["attacktimebaruse"]); } if(val.ContainsKey("itemtimebaruse")) { this.system.itemEndTurn = false; this.system.itemTimebarUse = float.Parse((string)val["itemtimebaruse"]); } if(val.ContainsKey("defendtimebaruse")) { this.system.defendEndTurn = false; this.system.defendTimebarUse = float.Parse((string)val["defendtimebaruse"]); } if(val.ContainsKey("escapetimebaruse")) { this.system.escapeEndTurn = false; this.system.escapeTimebarUse = float.Parse((string)val["escapetimebaruse"]); } if(val.ContainsKey("atbtickinterval")) { this.system.atbTickInterval = float.Parse((string)val["atbtickinterval"]); } if(val.ContainsKey("battlerange")) { this.system.battleRange = float.Parse((string)val["battlerange"]); } if(val.ContainsKey("airange")) { this.system.aiRange = float.Parse((string)val["airange"]); } if(val.ContainsKey("airechecktime")) { this.system.aiRecheckTime = float.Parse((string)val["airechecktime"]); } if(val.ContainsKey("blockcontrolmenu")) this.system.blockControlMenu = true; if(val.ContainsKey("blockcontrolaction")) this.system.blockControlAction = true; if(val.ContainsKey("blockmse")) this.system.blockMSE = true; if(val.ContainsKey("freezeaction")) this.system.freezeAction = true; if(val.ContainsKey("enemyspots")) { this.system.enemySpot = new Vector3[int.Parse((string)val["enemyspots"])]; this.system.enemySpotPA = new Vector3[this.system.enemySpot.Length]; this.system.enemySpotEA = new Vector3[this.system.enemySpot.Length]; } if(val.ContainsKey("spotdistance")) { this.system.spotOnGround = true; this.system.spotDistance = float.Parse((string)val["spotdistance"]); this.system.spotLayer = int.Parse((string)val["spotlayer"]); if(val.ContainsKey("spotx")) { this.system.spotOffset = VectorHelper.FromHashtable(val, "spotx", "spoty", "spotz"); } } if(val.ContainsKey("enablepaspots")) this.system.enablePASpots = true; if(val.ContainsKey("enableeaspots")) this.system.enableEASpots = true; if(val.ContainsKey(XMLHandler.NODES)) { ArrayList s = val[XMLHandler.NODES] as ArrayList; foreach(Hashtable ht in s) { if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.BONUS) { this.system.statusBonus[int.Parse((string)ht["id"])] = int.Parse((string)ht["value"]); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.REVIVE) { int id = int.Parse((string)ht["id"]); this.system.reviveSetStatus[id] = true; this.system.reviveStatus[id] = int.Parse((string)ht["value"]); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.STARTSTATUS) { int id = int.Parse((string)ht["id"]); this.system.startSetStatus[id] = true; this.system.startStatus[id] = int.Parse((string)ht["value"]); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.ENDSTATUS) { int id = int.Parse((string)ht["id"]); this.system.endSetStatus[id] = true; this.system.endStatus[id] = int.Parse((string)ht["value"]); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.PARTYADVANTAGE) { this.system.partyAdvantage.SetData(ht); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.ENEMIESADVANTAGE) { this.system.enemiesAdvantage.SetData(ht); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.PARTYSPOT) { int id = int.Parse((string)ht["id"]); if(id < this.system.partySpot.Length) { this.system.partySpot[id] = VectorHelper.FromHashtable(ht); if(ht.ContainsKey("pax")) { this.system.partySpotPA[id] = VectorHelper.FromHashtable(ht, "pax", "pay", "paz"); } if(ht.ContainsKey("eax")) { this.system.partySpotEA[id] = VectorHelper.FromHashtable(ht, "eax", "eay", "eaz"); } } } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.ENEMYSPOT) { int id = int.Parse((string)ht["id"]); if(id < this.system.enemySpot.Length) { this.system.enemySpot[id] = VectorHelper.FromHashtable(ht); if(ht.ContainsKey("pax")) { this.system.enemySpotPA[id] = VectorHelper.FromHashtable(ht, "pax", "pay", "paz"); } if(ht.ContainsKey("eax")) { this.system.enemySpotEA[id] = VectorHelper.FromHashtable(ht, "eax", "eay", "eaz"); } } } } } } else if(val[XMLHandler.NODE_NAME] as string == BattleSystemData.MENU) { if(val.ContainsKey("dialogueposition")) this.menu.dialoguePosition = int.Parse((string)val["dialogueposition"]); if(val.ContainsKey("targetposition")) this.menu.targetPosition = int.Parse((string)val["targetposition"]); if(val.ContainsKey("skillposition")) this.menu.skillPosition = int.Parse((string)val["skillposition"]); if(val.ContainsKey("itemposition")) this.menu.itemPosition = int.Parse((string)val["itemposition"]); if(val.ContainsKey("showattack")) this.menu.showAttack = bool.Parse((string)val["showattack"]); if(val.ContainsKey("showskills")) this.menu.showSkills = bool.Parse((string)val["showskills"]); if(val.ContainsKey("combineskills")) this.menu.combineSkills = bool.Parse((string)val["combineskills"]); if(val.ContainsKey("showitems")) this.menu.showItems = bool.Parse((string)val["showitems"]); if(val.ContainsKey("combineitems")) this.menu.combineItems = bool.Parse((string)val["combineitems"]); if(val.ContainsKey("showdefend")) this.menu.showDefend = bool.Parse((string)val["showdefend"]); if(val.ContainsKey("showescape")) this.menu.showEscape = bool.Parse((string)val["showescape"]); if(val.ContainsKey("showendturn")) this.menu.showEndTurn = bool.Parse((string)val["showendturn"]); if(val.ContainsKey("attackicon")) this.menu.attackIconName = val["attackicon"] as string; if(val.ContainsKey("skillicon")) this.menu.skillIconName = val["skillicon"] as string; if(val.ContainsKey("itemicon")) this.menu.itemIconName = val["itemicon"] as string; if(val.ContainsKey("defendicon")) this.menu.defendIconName = val["defendicon"] as string; if(val.ContainsKey("escapeicon")) this.menu.escapeIconName = val["escapeicon"] as string; if(val.ContainsKey("drag")) this.menu.enableDrag = true; if(val.ContainsKey("doubleclick")) this.menu.enableDoubleClick = true; if(val.ContainsKey("addback")) this.menu.addBack = true; if(val.ContainsKey("backfirst")) this.menu.backFirst = true; this.menu.mouseTouch.SetData(val); if(val.ContainsKey("order")) this.menu.SetOrder(val["order"] as string); if(val.ContainsKey(XMLHandler.NODES)) { ArrayList s = val[XMLHandler.NODES] as ArrayList; foreach(Hashtable ht in s) { if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.BACK) { int id = int.Parse((string)ht["id"]); if(id < this.menu.backName.Count) this.menu.backName[id] = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.ATTACK) { int id = int.Parse((string)ht["id"]); if(id < this.menu.attackName.Count) this.menu.attackName[id] = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.SKILL) { int id = int.Parse((string)ht["id"]); if(id < this.menu.skillName.Count) this.menu.skillName[id] = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.ITEM) { int id = int.Parse((string)ht["id"]); if(id < this.menu.itemName.Count) this.menu.itemName[id] = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.DEFEND) { int id = int.Parse((string)ht["id"]); if(id < this.menu.defendName.Count) this.menu.defendName[id] = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.ESCAPE) { int id = int.Parse((string)ht["id"]); if(id < this.menu.escapeName.Count) this.menu.escapeName[id] = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.ENDTURN) { int id = int.Parse((string)ht["id"]); if(id < this.menu.endTurnName.Count) this.menu.endTurnName[id] = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.BACKICON) { this.menu.backIconName = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.ATTACKICON) { this.menu.attackIconName = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.SKILLICON) { this.menu.skillIconName = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.ITEMICON) { this.menu.itemIconName = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.DEFENDICON) { this.menu.defendIconName = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.ESCAPEICON) { this.menu.escapeIconName = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.ENDTURNICON) { this.menu.endTurnIconName = (string)ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.CURSOR) { this.menu.useTargetCursor = true; this.menu.cursorPrefabName = ht[XMLHandler.CONTENT] as string; this.menu.cursorOffset.x = float.Parse((string)ht["cox"]); this.menu.cursorOffset.y = float.Parse((string)ht["coy"]); this.menu.cursorOffset.z = float.Parse((string)ht["coz"]); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.CURSORCHILD) { this.menu.cursorChildName = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.TARGET) { this.menu.useTargetMenu = bool.Parse((string)ht["targetmenu"]); this.menu.useTargetBlink = bool.Parse((string)ht["targetblink"]); if(this.menu.useTargetBlink) { if(ht.ContainsKey("fromcurrent")) this.menu.fromCurrent = true; this.menu.blinkChildren = bool.Parse((string)ht["children"]); this.menu.blinkTime = float.Parse((string)ht["time"]); this.menu.blinkInterpolation = (EaseType)System.Enum.Parse(typeof(EaseType), (string)ht["interpolation"]); if(ht.ContainsKey("as")) { this.menu.aBlink = true; this.menu.aStart = float.Parse((string)ht["as"]); this.menu.aEnd = float.Parse((string)ht["ae"]); } if(ht.ContainsKey("rs")) { this.menu.rBlink = true; this.menu.rStart = float.Parse((string)ht["rs"]); this.menu.rEnd = float.Parse((string)ht["re"]); } if(ht.ContainsKey("gs")) { this.menu.gBlink = true; this.menu.gStart = float.Parse((string)ht["gs"]); this.menu.gEnd = float.Parse((string)ht["ge"]); } if(ht.ContainsKey("bs")) { this.menu.bBlink = true; this.menu.bStart = float.Parse((string)ht["bs"]); this.menu.bEnd = float.Parse((string)ht["be"]); } } } } } } else if(val[XMLHandler.NODE_NAME] as string == BattleSystemData.TEXT) { this.showUserDamage = bool.Parse((string)val["showuserdamage"]); if(val.ContainsKey("mounttexts")) this.mountTexts = true; if(val.ContainsKey("bmpos")) { this.showBattleMessage = true; this.battleMessagePosition = int.Parse((string)val["bmpos"]); this.battleMessageShowTime = float.Parse((string)val["bmtime"]); } if(val.ContainsKey("bscolor")) { this.battleStartColor = int.Parse((string)val["bscolor"]); this.battleStartSColor = int.Parse((string)val["bsshadowcolor"]); } if(val.ContainsKey("bvcolor")) { this.battleVictoryColor = int.Parse((string)val["bvcolor"]); this.battleVictorySColor = int.Parse((string)val["bvshadowcolor"]); } if(val.ContainsKey("bdcolor")) { this.battleDefeatColor = int.Parse((string)val["bdcolor"]); this.battleDefeatSColor = int.Parse((string)val["bdshadowcolor"]); } if(val.ContainsKey("becolor")) { this.battleEscapeColor = int.Parse((string)val["becolor"]); this.battleEscapeSColor = int.Parse((string)val["beshadowcolor"]); } if(val.ContainsKey(XMLHandler.NODES)) { ArrayList s = val[XMLHandler.NODES] as ArrayList; foreach(Hashtable ht in s) { if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.INFO) { this.showInfo = true; this.infoPosition = int.Parse((string)ht["position"]); this.infoShowTime = float.Parse((string)ht["time"]); if(ht.ContainsKey("showskills")) this.showSkills = bool.Parse((string)ht["showskills"]); if(ht.ContainsKey("showitems")) this.showItems = bool.Parse((string)ht["showitems"]); if(ht.ContainsKey("showdefend")) this.showDefend = bool.Parse((string)ht["showdefend"]); if(ht.ContainsKey("showescape")) this.showEscape = bool.Parse((string)ht["showescape"]); if(ht.ContainsKey("showcounter")) this.showCounter = bool.Parse((string)ht["showcounter"]); if(ht.ContainsKey("showstealitem")) this.showStealItem = bool.Parse((string)ht["showstealitem"]); if(ht.ContainsKey("showstealitemfail")) this.showStealItemFail = bool.Parse((string)ht["showstealitemfail"]); if(ht.ContainsKey("showstealmoney")) this.showStealMoney = bool.Parse((string)ht["showstealmoney"]); if(ht.ContainsKey("showstealmoneyfail")) this.showStealMoneyFail = bool.Parse((string)ht["showstealmoneyfail"]); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.DAMAGE) { DataHolder.StatusValues().AddDamageTextSettings(int.Parse((string)ht["id"]), ht); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.REFRESH) { DataHolder.StatusValues().AddRefreshTextSettings(int.Parse((string)ht["id"]), ht); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.EFFECT) { this.effectTextSettings.SetData(ht); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.MISSSETTINGS) { this.missTextSettings.SetData(ht); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.MISS) { int id = int.Parse((string)ht["id"]); if(id < this.missTextSettings.text.Length) { this.missTextSettings.text[id] = ht[XMLHandler.CONTENT] as string; } } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.COUNTER) { int id = int.Parse((string)ht["id"]); if(id < this.counterText.Count) this.counterText[id] = ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.ALLIES) { int id = int.Parse((string)ht["id"]); if(id < this.allAlliesText.Count) this.allAlliesText[id] = ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.ENEMIES) { int id = int.Parse((string)ht["id"]); if(id < this.allEnemiesText.Count) this.allEnemiesText[id] = ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.BATTLESTART) { int id = int.Parse((string)ht["id"]); if(id < this.battleStartText.Count) this.battleStartText[id] = ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.BATTLEVICTORY) { int id = int.Parse((string)ht["id"]); if(id < this.battleVictoryText.Count) this.battleVictoryText[id] = ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.BATTLEDEFEAT) { int id = int.Parse((string)ht["id"]); if(id < this.battleDefeatText.Count) this.battleDefeatText[id] = ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.BATTLEESCAPE) { int id = int.Parse((string)ht["id"]); if(id < this.battleEscapeText.Count) this.battleEscapeText[id] = ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.SKIN) { this.textSkinName = ht[XMLHandler.CONTENT] as string; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.CASTCANCEL) { int id = int.Parse((string)ht["id"]); if(id < this.castCancelTextSettings.text.Length) { this.castCancelTextSettings.text[id] = ht[XMLHandler.CONTENT] as string; } } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.LEVELUP) { int id = int.Parse((string)ht["id"]); if(id < this.levelUpTextSettings.text.Length) { this.levelUpTextSettings.text[id] = ht[XMLHandler.CONTENT] as string; } } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.CASTCANCELSETTINGS) { this.castCancelTextSettings.SetData(ht); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.LEVELUPSETTINGS) { this.levelUpTextSettings.SetData(ht); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.CLASSLEVELUPSETTINGS) { this.classLevelUpTextSettings.SetData(ht); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.BLOCKSETTINGS) { this.blockTextSettings.SetData(ht); } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.STEALITEM) { int id = int.Parse((string)ht["id"]); if(id < this.stealItemText.Count) this.stealItemText[id] = ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.STEALITEMFAIL) { int id = int.Parse((string)ht["id"]); if(id < this.stealItemFailText.Count) this.stealItemFailText[id] = ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.STEALMONEY) { int id = int.Parse((string)ht["id"]); if(id < this.stealMoneyText.Count) this.stealMoneyText[id] = ht[XMLHandler.CONTENT]; } else if(ht[XMLHandler.NODE_NAME] as string == BattleSystemData.STEALMONEYFAIL) { int id = int.Parse((string)ht["id"]); if(id < this.stealMoneyFailText.Count) this.stealMoneyFailText[id] = ht[XMLHandler.CONTENT]; } } } } else if(val[XMLHandler.NODE_NAME] as string == BattleSystemData.BATTLEEND) { this.end.SetData(val); } else if(val[XMLHandler.NODE_NAME] as string == BattleSystemData.BATTLECAM) { this.cam.SetData(val); } else if(val[XMLHandler.NODE_NAME] as string == BattleSystemData.BATTLECONTROL) { this.control.SetData(val); } } } } } } }
void Awake() { roomUI = gameObject.GetComponent <BattleRoomUI>(); battleControl = gameObject.GetComponent <BattleControl>(); }
void Awake() { _battleControl = GetComponent <BattleControl> (); _run = false; _candidateCards = new List <BattleCardShell> (); }
void Awake() { Instance = this; }
public void Tick(BattleControl control, Character c) { if(this.timeout > 0) this.timeout -= Time.deltaTime; else if(c.CanChooseAction() && !c.autoAttackStarted) { bool found = false; bool inAir = c.IsInAir(); float speed = c.GetCurrentSpeed(); // skill for(int i=0; i<this.skillID.Length; i++) { if(inAir == this.skillAir[i] && (this.skillAir[i] || speed >= this.skillSpeed[i]) && this.ControlAccepted(this.skillKey[i], this.skillAxis[i], this.skillTrigger[i])) { if(c.HasSkill(this.skillID[i], 0)) { SkillLearn sk = c.GetSkill(this.skillID[i]); sk.SetHighestUseLevel(c); if(sk.CanUse(c)) { if(DataHolder.Skill(sk.skillID).TargetSelf()) { c.AddSkillAction(sk.skillID, sk.GetLevel(), c.battleID, true); } else if(DataHolder.Skill(sk.skillID).TargetNone() && !DataHolder.Skill(sk.skillID).targetRaycast.NeedInteraction()) { c.AddSkillAction(sk.skillID, sk.GetLevel(), BattleAction.NONE, true); } else if(DataHolder.Skill(sk.skillID).TargetAllyGroup()) { c.AddSkillAction(sk.skillID, sk.GetLevel(), BattleAction.ALL_CHARACTERS, true); } else if(DataHolder.Skill(sk.skillID).TargetEnemyGroup()) { c.AddSkillAction(sk.skillID, sk.GetLevel(), BattleAction.ALL_ENEMIES, true); } // party target else if(DataHolder.Skill(sk.skillID).TargetSingleEnemy() && control.usePartyTarget && control.partyTarget != null) { c.AddSkillAction(sk.skillID, sk.GetLevel(), BattleAction.PARTY_TARGET, true); } // call target selection else { c.CallTargetMenu(BattleMenu.SKILL, sk.skillID, sk.GetLevel()); } // only if has and can be used, else go to the next skill found = true; break; } } } } // item if(!found && this.timeout <= 0) { for(int i=0; i<this.itemID.Length; i++) { if(inAir == this.itemAir[i] && (this.itemAir[i] || speed >= this.itemSpeed[i]) && this.ControlAccepted(this.itemKey[i], this.itemAxis[i], this.itemTrigger[i])) { if(GameHandler.HasItem(this.itemID[i], 1)) { if(DataHolder.Item(this.itemID[i]).useable) { if(DataHolder.Item(this.itemID[i]).TargetSelf()) { c.AddItemAction(this.itemID[i], c.battleID, true); } else if(DataHolder.Item(this.itemID[i]).TargetNone() && !DataHolder.Item(this.itemID[i]).targetRaycast.NeedInteraction()) { c.AddItemAction(this.itemID[i], BattleAction.NONE, true); } else if(DataHolder.Item(this.itemID[i]).TargetAllyGroup()) { c.AddItemAction(this.itemID[i], BattleAction.ALL_CHARACTERS, true); } else if(DataHolder.Item(this.itemID[i]).TargetEnemyGroup()) { c.AddItemAction(this.itemID[i], BattleAction.ALL_ENEMIES, true); } // party target else if(DataHolder.Item(this.itemID[i]).TargetSingleEnemy() && control.usePartyTarget && control.partyTarget != null) { c.AddItemAction(this.itemID[i], BattleAction.PARTY_TARGET, true); } // call target selection else { c.CallTargetMenu(BattleMenu.ITEM, this.itemID[i], 0); } // only if has and can be used, else go to the next item found = true; break; } } } } } // attack if(!found && this.timeout <= 0) { for(int i=0; i<this.attackKey.Length; i++) { if(inAir == this.attackAir[i] && (this.attackAir[i] || speed >= this.attackSpeed[i]) && this.ControlAccepted(this.attackKey[i], this.attackAxis[i], this.attackTrigger[i])) { if(c.baIndex == i || i == 0) { if(i == 0 && this.attackKey.Length > 1) c.ResetBaseAttack(); if(control.attackPartyTarget && control.partyTarget != null && (!control.aptRange || c.InAttackRange(control.partyTarget))) { c.AddAttackAction(BattleAction.PARTY_TARGET, true); } else c.AddAttackAction(BattleAction.NONE, true); } break; } } } } }
// STARTING BATTLES public void startBattle(Pokemon poke) { bc = new BattleControl(poke, t, this); isTrainer = false; }
public void startBattle(NPC enemyTrainer) { bc = new BattleControl(enemyTrainer, t, this); isTrainer = true; enemy = enemyTrainer.firstPokemon(); }