예제 #1
0
	// pre
	public void SetCmder( Panel_unit unit )
	{
		//cancel old
		if (pCmder != null) {
			pCmder.OnSelected( false );
		}
		// clear	

		// setup origin param
		pCmder = unit;
		if( pCmder == null ){			
			return ;
		}


		// who will disable
		pCmder.OnSelected (true);

		// CMD param
		CMD.nCmderIdent = pCmder.Ident();
		CMD.nOrgGridX = pCmder.X();
		CMD.nOrgGridY = pCmder.Y();

		// keep cmd type
		CMD.eCMDSTATUS = _CMD_STATUS._WAIT_CMDID;
		CMD.eCMDTARGET = _CMD_TARGET._ALL;
		CMD.eCMDID 	   = _CMD_ID._NONE;	

	}
예제 #2
0
	public void SetTarget( Panel_unit unit )
	{
		CMD.nTarIdent = 0;
		if( unit != null ){
			CMD.nTarIdent = unit.Ident();
		}

		if( CMD.nAOEID > 0 ){
			CMD.eCMDAOETARGET =  _CMD_TARGET._UNIT;

			int x = pCmder.X();
			int y = pCmder.Y();
			if( unit != null ){
				x = unit.X();
				y = unit.Y();
			}
			Panel_StageUI.Instance.ClearOverCellEffect ();
			Panel_StageUI.Instance.CreateAOEOverEffect( x , y , CMD.nAOEID );
			
			return;
			// block cmd
		}

		cCMD.Instance.eCMDTARGET =  _CMD_TARGET._UNIT;

		// trig attack event
		// check Need Make Cmd
		MakeCmd ();
		// close cmd ui
		//Clear ();
		PanelManager.Instance.CloseUI( Name );
	}
예제 #3
0
	public void CreateMoveOverEffect( Panel_unit unit )
	{
		MoveEftObj.RecycleAll();

		if( OverCellPool != null ){
			OverCellPool.Clear ();
		}
		if (unit == null)
			return;

		//return; // 
		// find move
		cUnitData pdata = GameDataManager.Instance.GetUnitDateByIdent ( unit.Ident() ); 
		// don't zoc 
//		List<iVec2> posList = GetUnitPosList ( );

	//	List<iVec2> moveList =  Grids.GetRangePool (unit.Loc, pdata.GetMov()  , 1);
		Grids.ClearIgnorePool();
		Grids.AddIgnorePool( GetUnitPKPosPool(unit , true  ) );

		List<iVec2> moveList =  Grids.MoveAbleCell (unit.Loc, pdata.GetMov() );

		// try ZOC!!!
	//	List<iVec2> final = Panel_StageUI.Instance.Grids.FilterZocPool (unit.Loc, ref moveList, ref posList);
	//	moveList = final;

		long  tick =  System.DateTime.Now.Ticks; 

		// start create over eff
		foreach( iVec2 v in moveList )
		{
			if ( cMyGrids.IsWalkAbleTile( Grids.GetValue( v ) ) == false  )
			{
				continue;
			}
			// check if this vec can reach


//			List<iVec2> path = PathFinding( unit , unit.Loc , v , pdata.GetMov() );
//			if( path.Count <= 0 )
//				continue;

			// create move over cell
			//GameObject over = ResourcesManager.CreatePrefabGameObj(TilePlaneObj, "Prefab/MoveOverEffect");
			GameObject over = MoveEftObj.Spawn(  TilePlaneObj.transform );
		
			if( over != null )
			{
				over.name = string.Format("Move Over({0},{1},{2})", v.X , v.Y , 0 );
				SynGridToLocalPos( over , v.X , v.Y) ;
				//UIEventListener.Get(over).onClick += OnOverClick;
				
				OverCellPool.Add( v.GetKey() , over );
				over.SetActive( true );
			//	over.transform.SetParent ( TilePlaneObj.transform );
			}
		}

		long  during =  System.DateTime.Now.Ticks - tick ; 

		Debug.Log( "create moveeffect cell with ticket:" + during );
	}