示例#1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
示例#2
0
    private void Start()
    {
        if (isMainRole)
        {
            last_pos = transform.position;
            RoleData roleData = RoleData.mainRole;
            nav.speed = roleData.GetAttr(RoleAttribute.stamina) * 0.025f;
            show      = RoleShow.mainRole;
            transform.localEulerAngles = new Vector3(0, roleData.GetAttr(RoleAttribute.orientation), 0);

            int longitude = roleData.GetAttr(RoleAttribute.longitude);
            int latitude  = roleData.GetAttr(RoleAttribute.latitude);
            MinCamera.SetPos(Tools.UnitPosToWorldPoint(new Vector2Int(longitude, latitude)));
        }
    }
示例#3
0
    private void MoveTo(Vector3 pos, bool move = false)
    {
        float x = pos.x;
        float z = pos.z;

        if (x < 0)
        {
            x = 0;
        }
        if (z < 0)
        {
            z = 0;
        }
        float max = WorldCreate.instance.size * WorldCreate.instance.scale - 1;

        if (x > max)
        {
            x = max;
        }
        if (z > max)
        {
            z = max;
        }
        Vector3 point = CorrectPos(new Vector3(x, pos.y, z));

        if (isMainRole)
        {
            MinCamera.SetPos(point);
            Vector2Int p = Tools.WorldPointToUnitPos(point);
            EventManager.SendEvent(EventTyp.ChangePos, p);
        }

        if (IsSame(point, target) || move)
        {
            BeginMove(point);
        }
        else
        {
            target = point;
        }
    }