private void OnAttackDone(NaviUnit unit, int eventCode) { if (onUnitEvent != null) { onUnitEvent(this, 2); } }
// ==================================================================================================================== #region callbacks /// <summary>called when a unit completed something, like moving to a target node</summary> private void OnUnitEvent(NaviUnit unit, int eventCode) { // eventcode 1 = unit finished moving if (eventCode == 1) { if (!hideMarkersOnMove && prevNode != null) { // the markers where not hidden when the unit started moving, // then they should be now as they are invalid now prevNode.ShowNeighbours(((Unit)selectedUnit).maxMoves, false); } // do a fake click on the unit to "select" it again this.OnNaviUnitClick(unit.gameObject); allowInput = true; // allow input again } // eventcode 2 = unit done attacking if (eventCode == 2) { allowInput = true; // allow input again if (!useTurns) { this.OnNaviUnitClick(unit.gameObject); } } }
private void OnUnitEvent(NaviUnit unit, int eventCode) { // eventcode 1 = 完成移动 if (eventCode == 1) { if (!useTurns) // 不是你的回合 { Unit u = (unit as Unit); u.currMoves = u.maxMoves; } if (!hideMarkersOnMove && prevNode != null) // 无效移动 { prevNode.ShowNeighbours(((Unit)selectedUnit).maxMoves, false); } this.OnNaviUnitClick(unit.gameObject); // 重复选中 allowInput = true; } // eventcode 2 = 攻击完成 if (eventCode == 2) { allowInput = true; if (!useTurns) { this.OnNaviUnitClick(unit.gameObject); } } }
/// <summary>called by the weapon when it is done doing its thing</summary> private void OnAttackDone(NaviUnit unit, int eventCode) { // tell whomever is listening that I am done with my attack. eventCode 2 if (onUnitEvent != null) { onUnitEvent(this, 2); } }
public static NaviUnit SpawnUnit(GameObject unitFab, TileNode node) { GameObject go = (GameObject)GameObject.Instantiate(unitFab); go.transform.position = node.transform.position; NaviUnit unit = go.GetComponent <NaviUnit>(); unit.LinkWith(node); return(unit); }
// ==================================================================================================================== #region callbacks /// <summary>called when a unit completed something, like moving to a target node</summary> private void OnUnitEvent(NaviUnit unit, int eventCode) { // eventcode 1 = unit finished moving if (eventCode == 1) { Unit u = (unit as Unit); if (randomMovement) { // choose a new spot to move to u.ChooseRandomTileAndMove(); } else { if (!useTurns) { // units can't use their moves up in this case, so reset after it moved u.currMoves = u.maxMoves; } if (!hideMarkersOnMove && prevNode != null) { // the markers where not hidden when the unit started moving, // then they should be now as they are invalid now prevNode.ShowNeighbours(((Unit)selectedUnit).maxMoves, false); } // do a fake click on the unit to "select" it again this.OnNaviUnitClick(unit.gameObject); allowInput = true; // allow input again } } // eventcode 2 = unit done attacking if (eventCode == 2) { allowInput = true; // allow input again if (!useTurns) { this.OnNaviUnitClick(unit.gameObject); } } }
// ==================================================================================================================== #region callbacks /// <summary>called when a unit completed something, like moving to a target node</summary> private void OnUnitEvent(NaviUnit unit, int eventCode) { // eventcode 1 = unit finished moving if (eventCode == 1) { Character u = (unit as Character); //if (randomMovement) //{ // // choose a new spot to move to // //u.ChooseRandomTileAndMove(); //} //else //{ //if (!useTurns) //{ // // units can't use their moves up in this case, so reset after it moved // u.currMoves = u._moves; //} if (!hideMarkersOnMove && prevNode != null) { // the markers where not hidden when the unit started moving, // then they should be now as they are invalid now prevNode.ShowNeighbours(((Character)selectedUnit)._moves, false); } movementAllowed = false; CombatMenu.FindObjectOfType<CombatMenu>().moveEnabled = false; // do a fake click on the unit to "select" it again this.OnNaviUnitClick(unit.gameObject); //allowInput = true; // allow input again //} } // eventcode 2 = unit done attacking if (eventCode == 2) { //allowInput = true; // allow input again //if (!useTurns) //{ this.OnNaviUnitClick(unit.gameObject); // } } if (unit.GetComponent<Character>().TurnDone()) { ClickNextActiveCharacter(); } }
/// <summary>called when a unit completed something, like moving to a target node</summary> private void OnUnitEvent(NaviUnit unit, int eventCode) { // eventcode 1 = unit finished moving if (eventCode == 1) { if (!hideMarkersOnMove && prevNode != null) { // the markers where not hidden when the unit started moving, // then they should be now as they are invalid now prevNode.ShowNeighbours(((Unit)selectedUnit).maxMoves, false); } // do a fake click on the unit to "select" it again this.OnNaviUnitClick(unit.gameObject); allowInput = true; // allow input again } // eventcode 2 = unit done attacking if (eventCode == 2) { allowInput = true; // allow input again if (!useTurns) { this.OnNaviUnitClick(unit.gameObject); } } }
/// <summary>called by the weapon when it is done doing its thing</summary> private void OnAttackDone(NaviUnit unit, int eventCode) { // tell whomever is listening that I am done with my attack. eventCode 2 if (onUnitEvent != null) onUnitEvent(this, 2); }