void OnEnable() { currentMonString = ""; int currentMonID = MonAgent.GetCurrentMonID(); currentMon = MonAgent.MonFromID(currentMonID); if (currentMonID != -1) { currentMonString = currentMon.ToString(); } newMonString = ""; int newMonID = MonAgent.GetLastFoundMonID(); newMon = MonAgent.MonFromID(newMonID); if (newMonID != -1) { newMonString = newMon.ToString(); } vsString = "VS"; StartCoroutine("DoBattle"); }
private IEnumerator DoBattle() { yield return new WaitForSeconds( 3f ); if( currentMon.currentTypeType == MonAgent.TypeType.Invalid ) { currentMon = new MonAgent.Mon( newMon.currentTypeType, newMon.currentAttack1Type, newMon.currentAttack2Type ); } else { int randomValue = Mathf.FloorToInt( Random.value * 3f ); switch( randomValue ) { case 0: currentMon = new MonAgent.Mon( MonAgent.GetComboTypeType( newMon.currentTypeType, currentMon.currentTypeType ), currentMon.currentAttack1Type, currentMon.currentAttack2Type ); break; case 1: currentMon = new MonAgent.Mon( currentMon.currentTypeType, newMon.currentAttack1Type, currentMon.currentAttack2Type ); break; case 2: currentMon = new MonAgent.Mon( currentMon.currentTypeType, currentMon.currentAttack1Type, newMon.currentAttack2Type ); break; } } currentMonString = currentMon.ToString(); MonAgent.SetCurrentMonID( MonAgent.IDFromMon( currentMon ) ); MonAgent.SetLastFoundMonID( -1 ); yield return new WaitForSeconds( 1f ); newMonString = ""; vsString = ""; yield return new WaitForSeconds( 3f ); StateAgent.ChangeState( StateAgent.State.Showing ); }
void OnEnable() { currentMonString = ""; int currentMonID = MonAgent.GetCurrentMonID (); currentMon = MonAgent.MonFromID( currentMonID ); if( currentMonID != -1 ) currentMonString = currentMon.ToString(); newMonString = ""; int newMonID = MonAgent.GetLastFoundMonID (); newMon = MonAgent.MonFromID( newMonID ); if( newMonID != -1 ) newMonString = newMon.ToString(); vsString = "VS"; StartCoroutine( "DoBattle" ); }
private IEnumerator DoBattle() { yield return(new WaitForSeconds(3f)); if (currentMon.currentTypeType == MonAgent.TypeType.Invalid) { currentMon = new MonAgent.Mon(newMon.currentTypeType, newMon.currentAttack1Type, newMon.currentAttack2Type); } else { int randomValue = Mathf.FloorToInt(Random.value * 3f); switch (randomValue) { case 0: currentMon = new MonAgent.Mon(MonAgent.GetComboTypeType(newMon.currentTypeType, currentMon.currentTypeType), currentMon.currentAttack1Type, currentMon.currentAttack2Type); break; case 1: currentMon = new MonAgent.Mon(currentMon.currentTypeType, newMon.currentAttack1Type, currentMon.currentAttack2Type); break; case 2: currentMon = new MonAgent.Mon(currentMon.currentTypeType, currentMon.currentAttack1Type, newMon.currentAttack2Type); break; } } currentMonString = currentMon.ToString(); MonAgent.SetCurrentMonID(MonAgent.IDFromMon(currentMon)); MonAgent.SetLastFoundMonID(-1); yield return(new WaitForSeconds(1f)); newMonString = ""; vsString = ""; yield return(new WaitForSeconds(3f)); StateAgent.ChangeState(StateAgent.State.Showing); }