コード例 #1
0
    private bool GetValueFromToggle()
    {
        string boatOpt = boat.selectedOption.text;

        if (boatOpt != anchor.ToString())
        {
            BoatAnchor opt = (BoatAnchor)Enum.Parse(typeof(BoatAnchor), boatOpt);
            anchor = opt;
        }

        Boat boatObj = GameManager.Singleton.GetBoat((int)anchor);

        int val = int.Parse(shift.selectedOption.text);

        if (val < 0)
        {
            if (boatObj.OnLineNumber < Math.Abs(val))
            {
                return(false);
            }
        }

        shiftValue = val;
        return(true);
    }
コード例 #2
0
    /// <summary>
    /// Function of MapInvestment(Shift +1/-1 or +2/-2).
    /// </summary>
    /// <param name="anchor">Anchor.</param>
    /// <param name="shift">Shift.</param>
    public void ShiftBoat(BoatAnchor anchor, int shift)
    {
        UIManager.Singleton.OpenMask();
        Boat shifted = null;

        if (anchor == BoatAnchor.LEFT)
        {
            shifted = boats[0];
        }
        else if (anchor == BoatAnchor.MIDDLE)
        {
            shifted = boats[1];
        }
        else if (anchor == BoatAnchor.RIGHT)
        {
            shifted = boats[2];
        }

        shifted.isShifted = true;
        StartCoroutine(BoatMoving(shifted, shift));
    }