Beispiel #1
0
    public void SavePoints()
    {
        CanCreatePath = false;
        MyPath newPath = new MyPath();

        newPath.Points = new List <CustomVector>();
        SphereCollider[] tmp = RootPoint.GetComponentsInChildren <SphereCollider>();
        foreach (SphereCollider sph in tmp)
        {
            CustomVector Point = new CustomVector(sph.transform.localPosition);
            newPath.Points.Add(Point);
        }

        newPath.Name = PathName.text;

        if (!CurrentSession.Paths.Contains(newPath))
        {
            CurrentSession.Paths.Add(newPath);
        }


        BinaryFormatter formatter = new BinaryFormatter();
        FileStream      file      = File.Create(Application.persistentDataPath + "/paths.save");

        formatter.Serialize(file, CurrentSession);
        file.Close();
        SetActiveMessage(-1);
        ShowPaths();
    }
Beispiel #2
0
 public Character(string Id)
 {
     this.Id         = Id;
     CharacterInfo   = new CharacterInfo();
     CharacterStats  = new Stats();
     Inventory       = new Inventory();
     Equipments      = new Equipments();
     CurrentPosition = new CustomVector(Fix64.Zero, (Fix64)3, Fix64.Zero);
     TargetPosition  = new CustomVector(Fix64.Zero, Fix64.Zero, Fix64.Zero);
 }
Beispiel #3
0
    void OnDrag(PointerEventData eDt)
    {
        if (isE)
        {
            //Debug.Log("Position: " + eventData.position);
            NwPos = eDt.position;
            if (NwPos != OdPos)
            {
                //var angle = Vector2.Angle(NwPos, OdPos);
                var nwPos = NwPos - PnlPos;
                var odPos = OdPos - PnlPos;

                var ag = CustomVector.Angle(nwPos, odPos);
                reTrfm.Rotate(0, 0, ag);
            }
            OdPos = NwPos;
        }
    }
Beispiel #4
0
        internal static int DefaultMain(DefaultConfig !config)
        {
            IPContract.Imp ipConn = ((!)config.ipRef).Acquire();
            if (ipConn == null)
            {
                throw new Exception("Unable to acquire handle to the IP network");
            }
            ipConn.RecvReady();


            char[][] !in ExHeap ifNames;
            ipConn.SendGetInterfaces();
            ipConn.RecvInterfaceList(out ifNames);

            for (int i = 0; i < ifNames.Length; ++i)
            {
                CustomVector.Expose(ifNames, i);
                char[] in ExHeap ifName = ifNames[i];
                if (ifName == null)
                {
                    throw new Exception("ifName is null");
                }
                string !deviceName = Bitter.ToString2(ifName);
                CustomVector.UnExpose(ifNames, i);
                ipConn.SendGetInterfaceState(Bitter.FromString2(deviceName));
                switch receive {
                case ipConn.InterfaceNotFound():
                    Console.WriteLine("Unexpected error");
                    break;

                case ipConn.InterfaceState(InterfaceInfo ifInfo):
                    WriteInterfaceLine(ifInfo, deviceName);
                    break;

                case ipConn.ChannelClosed():
                    throw new Exception("ipConn channel closed");
                }
            }

            delete ifNames;
            delete ipConn;

            return(0);
        }
Beispiel #5
0
    void OnDrag(PointerEventData eDt)
    {
        if (m_isCanDrag)
        {
            if (isE)
            {
                NwPos          = eDt.position;
                m_fDeltaRotate = CustomVector.Angle(NwPos - PnlPos, OdPos - PnlPos);
                if (NwPos != OdPos)
                {
                    var nwPos = NwPos - PnlPos;
                    var odPos = OdPos - PnlPos;

                    var ag = CustomVector.Angle(nwPos, odPos);
                    RotateDirection = ag > 0 ? 1 : -1;
                    reTrfm.Rotate(0, 0, ag);
                }
                OdPos = NwPos;
            }
        }
    }
Beispiel #6
0
    public PlayerState GetPlayerState()
    {
        if (Input.GetMouseButton(0))
        {
            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out hit))
            {
                TargetPosition = hit.point.ToCustomVector();
                return(new PlayerState()
                {
                    Name = Id,
                    Position = CurrentPosition,
                    TargetPosition = TargetPosition,
                });
            }
        }

        return(null);
    }
Beispiel #7
0
 public static Vector3 ToVector3(this CustomVector vector)
 {
     return(new Vector3((float)vector.x, (float)vector.y, (float)vector.z));
 }
Beispiel #8
0
 public CustomVectorView(CustomVector customVector)
 {
     _customVector = customVector;
 }
Beispiel #9
0
 public CustomVectorView()
 {
     _customVector = new CustomVector();
 }
Beispiel #10
0
 public void SetPosition(Vector3 pos)
 {
     CurrentPosition = pos.ToCustomVector();
     CharacterModelChanged.Invoke(this, "POS");
 }