Exemplo n.º 1
0
 private void OnAttackDone(NaviUnit unit, int eventCode)
 {
     if (onUnitEvent != null)
     {
         onUnitEvent(this, 2);
     }
 }
Exemplo n.º 2
0
    // ====================================================================================================================
    #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);
            }
        }
    }
Exemplo n.º 3
0
    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);
            }
        }
    }
Exemplo n.º 4
0
 /// <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);
     }
 }
Exemplo n.º 5
0
    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);
    }
Exemplo n.º 6
0
    // ====================================================================================================================
    #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);
            }
        }
    }
Exemplo n.º 7
0
    // ====================================================================================================================
    #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();
        }
    }
Exemplo n.º 8
0
    /// <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);
            }
        }
    }
Exemplo n.º 9
0
	/// <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);
	}