예제 #1
0
	public void RunAction()
	{
		if (CurAction == null)
			return;

		switch( CurAction.eAct )
		{
		case _ACTION._WAIT:
			switch( nSubActFlow )
			{
			case 0:
				ActionWait();
				nSubActFlow++;
				break;
			case 1:
			//	ActionFinished ();
				CurAction = null; // clear act
				nSubActFlow++;
				break;
			}

			break;
		case _ACTION._ATK:
			switch( nSubActFlow )
			{
			case 0:


				nSubActFlow++;
				break;
			case 1:
				ActionAttack( CurAction.nTarIdent );
				nSubActFlow++;
				break;
			case 2:
				// wait all hit result preform
				if( IsAnimate() == false ){
					nSubActFlow++;
				}
				break;

			case 3:
			//	ActionFinished ();
				CurAction = null; // clear act
				nSubActFlow++;
				break;
			}



			break;
		case _ACTION._MOVE:
			switch( nSubActFlow )
			{
			case 0:
				nSubActFlow++;
				ActionMove( CurAction.nTarGridX , CurAction.nTarGridY  );
				break;
			case 1:
				if( IsAnimate() == false ){ // wait movint finish
					nSubActFlow++;
				}
				break;
			case 2:
				nSubActFlow++;
				CurAction = null; // clear act
				break;
			}
			break;
		case _ACTION._CAST:			// casting
			switch( nSubActFlow )
			{
			case 0:
				nSubActFlow++;
				ActionCasting( CurAction.nSkillID );
				//ActionMove( CurAction.nTarGridX , CurAction.nTarGridY  );
				break;
			case 1:
				nSubActFlow++;
				CurAction = null; // clear act
				break;
			}
			break;
		case _ACTION._HIT:			// castout
			switch( nSubActFlow )
			{
			case 0:
				nSubActFlow++;
				ActionHit( CurAction.nSkillID ,CurAction.nTarGridX , CurAction.nTarGridY );
				//ActionMove( CurAction.nTarGridX , CurAction.nTarGridY  );
				break;
			case 1:
				nSubActFlow++;
				CurAction = null; // clear act
				break;
			}
			break;
		case _ACTION._DROP:			// Drop
			switch( nSubActFlow )
			{
			case 0:
				nSubActFlow++;
				// show
				ActionDrop( CurAction.nActVar1 , CurAction.nActVar2  ); // exp / money
				//ActionHit( CurAction.nSkillID ,CurAction.nTarGridX , CurAction.nTarGridY );
				//ActionMove( CurAction.nTarGridX , CurAction.nTarGridY  );
				break;
			case 1:
				nSubActFlow++;
				CurAction = null; // clear act
				break;
			}
			break;
		case _ACTION._LVUP:			// Drop
			switch( nSubActFlow )
			{
			case 0:
				nSubActFlow++;
				// show
				ActionLvUp( CurAction.nActVar1 , CurAction.nActVar2  ); // exp / money
				//ActionHit( CurAction.nSkillID ,CurAction.nTarGridX , CurAction.nTarGridY );
				//ActionMove( CurAction.nTarGridX , CurAction.nTarGridY  );
				break;
			case 1:
				nSubActFlow++;
				CurAction = null; // clear act
				break;
			}
			break;
		case _ACTION._WEAKUP:
			switch( nSubActFlow )
			{
			case 0:
				nSubActFlow++;
				ActionWeakup(   ); // exp / money
				//ActionHit( CurAction.nSkillID ,CurAction.nTarGridX , CurAction.nTarGridY );
				//ActionMove( CurAction.nTarGridX , CurAction.nTarGridY  );
				break;
			case 1:
				nSubActFlow++;
				CurAction = null; // clear act
				break;
			}
			break;


		default:
			CurAction = null; // set null to avoid char block in infinite action
			break;

		}
	}
예제 #2
0
	public void ExecActionHitResult(  uAction action )
	{
		if (action == null)
			return;
		List< cHitResult> resPool = action.HitResult;
		if( resPool != null ){
			foreach (cHitResult res in resPool) {
				if (res != null) {
					// show effect
					Panel_unit pUnit = Panel_StageUI.Instance.GetUnitByIdent (res.Ident);
					if (pUnit) {
						switch( res.eHitType )
						{
						case cHitResult._TYPE._HP:{
							pUnit.ShowValueEffect( res.Value1 , 0 ); // HP
							if( res.Value1 != 0 ) // maybe change data in  battle manage
							{
//								cUnitData pData = GameDataManager.Instance.GetUnitDateByIdent (res.Ident);
//								if (pData != null) {
								pUnit.pUnitData.AddHp (res.Value1   );
//								}
							}
							
						}break;
						case cHitResult._TYPE._ADDBUFF: // add buff
						{
							if( res.Value1 != 0 ) // maybe change data in  battle manage
							{
								cUnitData pData = GameDataManager.Instance.GetUnitDateByIdent (res.Ident);
								if (pData != null) {
									pData.Buffs.AddBuff( res.Value1 , res.Value2, res.SkillID, res.Value3 );
								}
							}
							
						}break;
						case cHitResult._TYPE._DELBUFF: // remove buff
						{
							if( res.Value1 != 0 ) // maybe change data in  battle manage
							{
								cUnitData pData = GameDataManager.Instance.GetUnitDateByIdent (res.Ident);
								if (pData != null) {
									pData.Buffs.DelBuff( res.Value1 );
								}
							}
							
						}break;
						case cHitResult._TYPE._HITBACK: // HitBack
						{
							
							
						}break;
						case cHitResult._TYPE._HIT: // Hit
						{
							// Add FX effect 
							
						}break;		
						case cHitResult._TYPE._BEHIT: // Hit
						{
							// it should have fx
							
						}break;							
						}
					}
				}
			}
		}
	}
예제 #3
0
	public bool SetAction( uAction act )
	{
		if (CurAction != null)
			return false;
		//need a pool for multi act
		CurAction = act;
		nSubActFlow = 0;
		//RunAction (); // don't first run. it will broke unit update flow
		return true;
	}
예제 #4
0
//	public void Run()
//	{

//		return ;
//	}


	public uAction CreateAction( int nIdent , _ACTION act )
	{
		uAction p = new uAction ();
		p.eAct = act;
		p.nActIdent = nIdent;
		if( ActionPool == null ){
			ActionPool =  new List< uAction >();
		}
		ActionPool.Add (p); 
		return p;
	}