Exemple #1
0
		public void initTargets(BetterList<BattleMonster> aMonster,BattleTeam aOwningTeam) {
			for(int i = 0;i<textures.Length;i++) {
				textures[i].gameObject.SetActive(false);
			}
			for(int i = 0;i<buttons.Length;i++) {
				buttons[i].gameObject.SetActive(false);
			}
			myMonsters = aMonster;
			owningTeam = aOwningTeam;
			int index = 0;
			for(int i = 0;i<aMonster.size;i++) {
				if(aMonster[i]!=null) {
					switch(aMonster[i].myPosition) {
						case(EMonsterPos.Top): 
							index = BattleConstants.TOP_INDEX;
						break;
						case(EMonsterPos.Front):
							index = BattleConstants.FRONT_INDEX;
						break;
						case(EMonsterPos.Bottom):
							index = BattleConstants.BOTTOM_INDEX;
						break;
					}
					buttons[index].gameObject.SetActive(true);
					textures[index].enabled = true;
					textures[index].mainTexture = (Texture) Resources.Load("FlatMonsters/"+aMonster[i].monster.monsterBreedRef.Name.ToLower().Replace(" ",""));
					if(textures[index].mainTexture!=null) {
						textures[index].width = textures[index].mainTexture.width;
						textures[index].height = 100;//t.mainTexture.height;
						textures[index].aspectRatio = textures[index].mainTexture.width/textures[index].mainTexture.height;
						textures[index].keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight;
						textures[index].aspectRatio = (float) textures[index].mainTexture.width/(float) textures[index].mainTexture.height;
						textures[index].height = 90;//t.mainTexture.height;
						textures[index].gameObject.SetActive(true);
					}
					if(aMonster[i].monster.restingStatus!=ERestingStatus.Awake) {
						buttons[index].enabled = false;
					//	textures[index].GetComponent<BoxCollider2D>().enabled = false;
						TweenAlpha.Begin(textures[index].gameObject.transform.parent.gameObject,0.25f,0.1f);
						
					} else {
						
						buttons[index].enabled = true;
						//	textures[index].GetComponent<BoxCollider2D>().enabled = true;
						TweenAlpha.Begin(textures[index].gameObject.transform.parent.gameObject,0.25f,1f);
					}
					
				}
				else {
					
					buttons[index].enabled = false;
					//	textures[index].GetComponent<BoxCollider2D>().enabled = true;
					TweenAlpha.Begin(textures[index].gameObject.transform.parent.gameObject,0.25f,0.1f);
				}
			}

			
		}
Exemple #2
0
		private void handleBattleOver(BattleTeam aDefeatedTeam) {
			if(aDefeatedTeam.isLocalTeam) {
				// Player Has Lost!
			} else {
				// Player Has Won!
				
			}
		}
Exemple #3
0
		private void onEasyTargetClicked (BattleMonster aMonster, BattleTeam aTeam) {
			aTeam.onMonsterClicked(aMonster);
			easyTarget.gameObject.SetActive(false);
		}
Exemple #4
0
		protected ETeamPosition positionFromTeam(BattleTeam aTeam) {
			if(_teams[0]==aTeam) {
				return ETeamPosition.LeftTeam;
			} else {
				return ETeamPosition.RightTeam;
			}
		}
Exemple #5
0
		private void onTeamReady(BetterList<MoveQueueItem> aMoveQueue,BattleTeam aTeam) {
			if(aTeam.name==opponentTeam.name) {
				BattleBase.QueueText("Opponent is ready for next turn"); 
			} else {
				BattleBase.QueueText("I am ready for next turn"); 
			}
			BattleBase.MultiplayerDebugText("Team is ready: "+aTeam.name+" - "+aMoveQueue.size);
			if(aTeam.isLocalTeam&&aTeam==playersTeam) {
				if(multiplayerBattle) {
					BattleBase.DebugText("sendMyMoveQueue");
					BattleBase.QueueText("I am sending my move queue over."); 
					
					//.REF.sendMyMoveQueue(aMoveQueue);
					if(countdownTimer!=null) {
						countdownTimer.startLongTimer();
						countdownTimer.preLabel = "Waiting for Opponent: ";
					}
				}
			}
			if(allTeamsReady) {
				BattleBase.MultiplayerDebugText("All teams are ready is ready: "+aTeam.name+" - "+aMoveQueue.size);
				this.generateMoveQueue();
			} else {
				if(opponentTeam.nextTurnReady==EReadyForNextTurnStatus.MovesUnset) {
					// Opponent hasn't set their moves yet
					if(opponentTeam.teamType==ETeamControllerType.RegularAI||opponentTeam.teamType==ETeamControllerType.WildAI) {
						// If it's an AI team, force set of moves
						opponentTeam.selectAIMoves();
					}
				}
			}
		}
Exemple #6
0
		private void onMoveHasBeenSet(BattleTeam aTeam,BattleMonster aMonster,MoveQueueItem aMoveQueue,bool aAutomatic) {
	//		Debug.Log ("onMoveHasbeenSet");
			if(aTeam.isLocalTeam) {
				easyTarget.gameObject.SetActive(false);
				this._positionOfMoveQueueEntry++;
				BattleBase.MultiplayerDebugText("onMoveHasBeenSet (LocalTeam)!!!!!!!!!!!!!!!!!!!!!!!!");
				if(aMoveQueue.moveData!=null) {
					
					BattleBase.MultiplayerDebugText("Move was not null");
					if(aMoveQueue.moveData.isBoost) {
						
						BattleBase.MultiplayerDebugText("Is boost for team, find target in team");
						aMoveQueue.targetTeam = positionFromTeam(aTeam);
						findTargetInTeam(aTeam,aTeam,aMonster,aMoveQueue,aAutomatic);
					} else {
						
						BattleBase.MultiplayerDebugText("Is not boost for team, find target in opponent");
						findTargetInTeam(aTeam,otherTeam(aTeam),aMonster,aMoveQueue,aAutomatic);
						}
				} else {
					if(aMoveQueue.usedItem!=null) {
						aMoveQueue.targetTeam = positionFromTeam(aTeam);
						findTargetInTeam(aTeam,aTeam,aMonster,aMoveQueue,true);
					}
					
					if(aTeam.allMonstersHaveMoves) {
						
						
						aTeam.declareReadyForNextTurn();
					}
				}
			} else {
				if(aTeam.allMonstersHaveMoves) {
					aTeam.declareReadyForNextTurn();
				}
			}
		}
Exemple #7
0
		private void findTargetInTeam(BattleTeam aAttacking,BattleTeam aDefending,BattleMonster aMonster,MoveQueueItem aMoveQueue,bool aAutomatic) {
			if((aDefending.monsterCount==1)||(aAutomatic)) {
				if(aAttacking.nextUnsetMonster!=null) {
					StartCoroutine(delayToShowNextMonster(aAttacking));
				} else {
					aAttacking.declareReadyForNextTurn();
				}
			} else {
				if(aMoveQueue.moveData.splashRange==ESplashRange.RandomOpponent) {
					// Doesn't matter what target we put here, it will be randomized later
					aMoveQueue.targetMonster = aDefending.positionForMonster(aDefending.monstersAsBattleMonster[0]);
					if(aAttacking.nextUnsetMonster!=null) {
						StartCoroutine(delayToShowNextMonster(aAttacking));
					} else {
						aAttacking.declareReadyForNextTurn();
					}
					return;
				}
				topLabel.text = "Select a Target";
				aAttacking.healthBars = false;
				aDefending.healthBars = false;
				FadeBlackScreen(0.8f,0.1f);
				aAttacking.bringMonsterToFront(aMonster);
				aMonster.healthBarEnabled = true;
				BetterList<BattleMonster> otherMonsters = aDefending.monstersAsBattleMonster;
				easyTarget.gameObject.SetActive(true);
				easyTarget.initTargets(otherMonsters,aDefending);
				for(byte c = 0;c<otherMonsters.size;c++) {
					aDefending.bringMonsterToFront(otherMonsters[c]);
					otherMonsters[c].healthBarEnabled = true;
				}
				aDefending.onTargetFound += onFoundTargetForMove;
				aDefending.findTargetForMove(aMoveQueue);
				
				
			}
		}
Exemple #8
0
		protected BattleTeam otherTeam(BattleTeam aTeam) {
			if(_teams[0]==aTeam) {
				return _teams[1];
			} else {
				return _teams[0];
			}
			}
Exemple #9
0
		private void onBattleComplete(BattleTeam aWinning,BattleTeam aLosing) {
			Debug.Log ("onBattleComplete");
			this.transform.eulerAngles = new Vector3 (0f, 166.64f, 0f);
			this.hideExtraButtons();
			this.movesBar.SetActive(false);
			this.topLabel.gameObject.SetActive(false);
			this.barController.hintLabel.gameObject.SetActive(false);
			_battleComplete = true;
			this.GetComponent<CameraTrack> ().setTarget (null);
			if(aWinning==this.playersTeam) {
				
				this._battleTurn = -10;
				this.startConversation();
				if(aLosing.monstersAsBattleMonster.size>0) {
					if(aLosing.caughtMonster!=null) {
						initMonsterCaughtScreen();
					
						PlayerMain.REF.addMonster(aLosing.caughtMonster.monster,true);
						BattleInit.REF.cleanUp();
						BattleInit.REF = null;
						return;
					}
				}
				Debug.Log ("Players Team Won, Updating ID");
				BattleInit.REF.setNPCBattleStatus(1);
				initPostBattleScreen(true);
			} else {
				
				this._battleTurn = -20;
				this.startConversation();
				initPostBattleScreen(false);
				BattleInit.REF.setNPCBattleStatus(2);
			}
			BattleInit.REF.cleanUp();
			BattleInit.REF = null;
		}
Exemple #10
0
		public void initBattleStartPassiveEffects(BattleTeam aOpponent) {
			BetterList<BattleMonster> ms = this.monstersAsBattleMonster;
			for(int i = 0 ;i<ms.size;i++) {
				PassiveEffect effect = ms[i].monster.hasPassiveEffectForTime(EWhenToApply.BattleStart,
				0f,
				0f,
				ms[i].monster.elementType,
				null,
				monstersApartFrom(ms[i]),
             	aOpponent.monstersAsBattleMonster,
             	ERangedStatus.MeleeAndRanged,
             	ms[i],
             	ElementalLibrary.REF.getElement("Normal"));
             	
             	if(effect!=null) {
					if(CommentaryManager.REF!=null) {
						CommentaryManager.REF.passiveEffect = effect;
						CommentaryManager.REF.battleMonster = (BattleMonster) ms[i];
					}
             		applyPassiveEffectToMonsters(EWhenToApply.BattleStart,effect,ms[i],positionForMonster(ms[i]),null);
					aOpponent.applyPassiveEffectToMonsters(EWhenToApply.BattleStart,effect,ms[i],positionForMonster(ms[i]),null);
             	}
             	
				effect = ms[i].monster.hasPassiveEffectForTime(EWhenToApply.WhenOneOpponentisSameAsEffectOwner,
				                                                             0f,
				                                                             0f,
				                                                             ms[i].monster.elementType,
				                                                             null,
				                                                             monstersApartFrom(ms[i]),
				                                                             aOpponent.monstersAsBattleMonster,
				                                                             ERangedStatus.MeleeAndRanged,
				                                                             ms[i],
				                                                             ElementalLibrary.REF.getElement("Normal"));
				
				if(effect!=null) {
					CommentaryManager.REF.passiveEffect = effect;
					CommentaryManager.REF.battleMonster = ms[i];
					
					
					applyPassiveEffectToMonsters(EWhenToApply.WhenOneOpponentisSameAsEffectOwner,effect,ms[i],positionForMonster(ms[i]),null);
					aOpponent.applyPassiveEffectToMonsters(EWhenToApply.WhenOneOpponentisType,effect,ms[i],positionForMonster(ms[i]),null);
					CommentaryManager.REF.passiveEffect = null;
					CommentaryManager.REF.battleMonster = null;
					
				}
				
			}
		}