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(); }
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); }
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; } }
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); }
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; } } }
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); }
public static Vector3 ToVector3(this CustomVector vector) { return(new Vector3((float)vector.x, (float)vector.y, (float)vector.z)); }
public CustomVectorView(CustomVector customVector) { _customVector = customVector; }
public CustomVectorView() { _customVector = new CustomVector(); }
public void SetPosition(Vector3 pos) { CurrentPosition = pos.ToCustomVector(); CharacterModelChanged.Invoke(this, "POS"); }