Example #1
0
    SavedDBData_party.PostionData SetFirstPos(List <string> datalist)
    {
        Vector2 pos = Vector2.zero;

        Player.DIRECTION dir   = Player.DIRECTION.NONE;
        string           mname = "";
        int successcode        = 0;

        try
        {
            foreach (var data in datalist)
            {
                var datas = data.Split(' ');
                var head  = datas[0];
                switch (head)
                {
                case "pos":
                    var x = float.Parse(datas[1]);
                    var y = float.Parse(datas[2]);
                    pos = new Vector2(x, y);
                    successcode++;
                    break;

                case "dir":
                    dir = (Player.DIRECTION)Enum.ToObject(typeof(Player.DIRECTION), int.Parse(datas[1]));
                    successcode++;
                    break;

                case "mapName":
                    mname = datas[1];
                    successcode++;
                    break;

                default:
                    ThrowErrorLog(null, _fileName, ErrorCode_uncollectName, _serchId, $"firstPos-{head}");
                    break;
                }
            }
            if (successcode == 3)
            {
                return(new SavedDBData_party.PostionData(pos, dir, mname));
            }
            else
            {
                ThrowErrorLog(null, _fileName, ErrorCode_format, _serchId, "firstPos");
                return(null);
            }
        }catch (Exception e)
        {
            ThrowErrorLog(e, _fileName, ErrorCode_default, _serchId, "firstPos");
            return(null);
        }
    }
Example #2
0
    private void Update()
    {
        //var nowDirection = _player._NowDirection;
        //if (nowDirection != _plDirection) SwichDirection(_player._NowDirection);
        //_plDirection = nowDirection;
        //var nowMoving = _player._moving;
        //if (_moveNow != nowMoving)
        //{
        //    if (nowMoving) MoveStart();
        //    else MoveStop();
        //}
        //_moveNow = nowMoving;
        //if (_moveNow) Moving()
        var nowDirection = _player._NowDirection;

        if (nowDirection != _beforeDirection)
        {
            _callback_swichDirection?.Invoke(nowDirection);
        }
        _beforeDirection = nowDirection;

        var nowMoving = _player._moving;

        if (_beforeMove != nowMoving)
        {
            if (nowMoving)
            {
                _callback_startMove?.Invoke();
            }
            else
            {
                _callback_startMove?.Invoke();
            }
        }
        _beforeMove = nowMoving;
        if (_beforeMove)
        {
            _callback_moving?.Invoke();
        }
    }
Example #3
0
 public PostionData(Vector2 pos, Player.DIRECTION dir, string mapName)
 {
     _pos       = pos;
     _direction = dir;
     _mapName   = mapName;
 }