public void Ctor_True_Test() { var elem = XElement.Parse("<EOkno doc='1'/>"); var target = new PositionData(elem); Assert.IsTrue(target.PodleDokumentu); }
public static unsafe void Write(global::Improbable.Worker.Internal.GcHandlePool _pool, PositionData _data, global::Improbable.Worker.Internal.Pbio.Object *_obj) { { global::Improbable.Coordinates_Internal.Write(_pool, _data.coords, global::Improbable.Worker.Internal.Pbio.AddObject(_obj, 1)); } }
public static unsafe void Write(global::Improbable.Worker.Internal.GcHandlePool _pool, PositionData _data, global::Improbable.Worker.CInterop.SchemaObject _obj) { { global::Improbable.Coordinates_Internal.Write(_pool, _data.coords, _obj.AddObject(1)); } }
public bool HandleMessage(INetMessage message) { int unitId = message.Reader.GetInt(); var serializePositionData = message.Reader.GetString(); PositionData positionData = MessageSerializerService.DeserializeObjectOfType <PositionData>(serializePositionData); var session = SessionCache.Instance.GetSessionById(message.Client.CurrentSessionId); if (session == null || !session.IsStarted) { return(true); } if (session.Units.ContainsKey(unitId)) { NetDataWriter _dataWriter = new NetDataWriter(); _dataWriter.Reset(); _dataWriter.Put((byte)NetOperationCode.SendUnit); _dataWriter.Put(unitId); _dataWriter.Put(serializePositionData); foreach (var p in session.Players) { session.SendToAll(_dataWriter, DeliveryMethod.Sequenced); } } return(true); }
private void SetAirWallPosition(PositionData pd) { leftAirWallTransform.localPosition = pd.LeftAirWallPosition; rightAirWallTransform.localPosition = pd.RightAirWallPosition; nearAirWallTransform.localPosition = pd.NearAirWallPosition; farAirWallTransform.localPosition = pd.FarAirWallPosition; }
// Receives movement data for a specific player and syncs their local object private void SyncPlayerMovement(object[] data) { var posData = new PositionData(data); if (posData.ID == PhotonNetwork.LocalPlayer.ActorNumber) { return; } if (!networkPlayers.ContainsKey(posData.ID)) { return; } // TODO: Add the player if they don't already exist var go = networkPlayers[posData.ID]; //TODO: Remove magic number for player height offset if (networkLerps.ContainsKey(posData.ID)) { StopCoroutine(networkLerps[posData.ID]); networkLerps[posData.ID] = StartCoroutine(LerpToPosition(go, posData)); } else { networkLerps.Add(posData.ID, StartCoroutine(LerpToPosition(go, posData))); } go.transform.rotation = Quaternion.Euler(0, posData.YRotation, 0); }
public void SyncCharacterPostion(ulong characterId, PositionData pos) { var character = ObjManager.Instance.FindCharacterById(characterId); if (null == character) { return; } var loc = GameLogic.GetTerrainPosition(GameUtils.DividePrecision(pos.Pos.x), GameUtils.DividePrecision(pos.Pos.y)); character.Position = loc; character.TargetDirection = new Vector3(GameUtils.DividePrecision(pos.Dir.x), 0, GameUtils.DividePrecision(pos.Dir.y)); character.StopMove(); if (character.GetObjType() == OBJ.TYPE.MYPLAYER) { (character as ObjMyPlayer).AdjustHeightPosition(); var e = new Postion_Change_Event(character.Position); EventDispatcher.Instance.DispatchEvent(e); } else { var navAgent = character.GetNavMeshAgent(); if (null != navAgent) { navAgent.Warp(loc); } } }
private void onPlayerMoved(PositionData positionData, Vector3 newPosition) { if (positionData == null) { return; } positionData.PlayerMoved -= onPlayerMoved; if (base.gameObject.IsDestroyed()) { return; } DataEntityHandle entityByComponent = dataEntityCollection.GetEntityByComponent(positionData); if (DataEntityHandle.IsNullValue(entityByComponent)) { return; } GameObjectReferenceData component = dataEntityCollection.GetComponent <GameObjectReferenceData>(entityByComponent); if (component != null) { GameObject gameObject = component.GameObject; if (!gameObject.IsDestroyed()) { placeRemotePlayer(gameObject, entityByComponent, newPosition); } } }
/// <summary> /// Get OptionData from OptionManager. /// </summary> /// <param name="positionData"></param> /// <param name="key"></param> /// <returns></returns> private bool GetOptionData(PositionData positionData, string key) { OptionData optionData = OptionsManager.GetOptionData(key); if (optionData == null) { return(false); } if (positionData.OptionData == null)//Log only on the very first time. { Logger.NoticeFormat("{0}.PDB:: +++ OptionData {1}, HashCode({2}), is added to the Position object successfully. ", Symbol, optionData.GetOptionKey(), optionData.GetHashCode()); } //Log every 1 minute else if (DateTime.Now.Second % 50 == 48) //TODO: The else part will be removed after evaluation and testing. { Logger.InfoFormat( "{0}.PDB:: ### OptionData {1}, HashCode({2}) was updated on the Position object successfully. ", Symbol, optionData.GetOptionKey(), optionData.GetHashCode()); } positionData.OptionData = optionData; return(true); }
IEnumerator DownloadUnkou() { string url = "https://trainposinfo.shinkeisei.co.jp/ShinkeiseiMobileWeb/webresources/jp.co.shinkeisei.entity.trainpositioninfo"; Dictionary <string, string> header = new Dictionary <string, string>(); header.Add("appkey", "PS8W2qMBYGYJLEKDpqvxWiYC"); WWW www = new WWW(url, null, header); yield return(www); IList json = (IList)Json.Deserialize(www.text); if (www.error == null) { DestroyTrain(); foreach (IDictionary data in json) { PositionData pd = new PositionData(); pd.laststop = data["laststop"].ToString(); pd.trainno = ParseInt(data["trainno"]); pd.delayminute = ParseInt(data["delayminute"]); IDictionary data2 = (IDictionary)data["trainPositionInfoPK"]; pd.stationid = ParseInt(data2["stationid"]); pd.sectionid = ParseInt(data2["sectionid"]); pd.sectionid_sub = ParseInt(data2["sectionidSub"]); pd.blockno = data2["blockno"].ToString(); pd.orbitnumber = data2["orbitnumber"].ToString(); position.Add(pd); } } }
// Get a list of Positions. public BindingList <PositionData> PositionList() { using (SqlConnection conn = new SqlConnection(conStr)) { conn.Open(); BindingList <PositionData> list = new BindingList <PositionData>(); string sql = "Execute PositionList"; Console.WriteLine(sql); using (SqlCommand command = new SqlCommand(sql, conn)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { PositionData position = new PositionData { PositionID = reader.GetInt32(0), PositionName = reader.GetString(1) }; list.Add(position); } } } return(list); } }
public IActionResult Delete(PositionData request) { try { BaseResponse response = _positionsClient.DeleteAsync(request); LogData logData = new() { CallSide = nameof(PositionsController), CallerMethodName = nameof(Delete), CreatedOn = _dateTimeUtil.GetCurrentDateTime(), Request = request, Response = response }; _logger.AddLog(logData); return(Ok(response)); } catch (Exception ex) { LogData logData = new() { CallSide = nameof(PositionsController), CallerMethodName = nameof(Delete), CreatedOn = _dateTimeUtil.GetCurrentDateTime(), Request = request, Response = ex }; _logger.AddErrorLog(logData); return(InternalServerError()); } }
private void SetData(PositionData data) { this.txtLOID.Text = data.LOID.ToString(); this.txtCode.Text = data.CODE.Trim(); this.txtName.Text = data.NAME.Trim(); }
void Awake() { m_FingerTouch.AddOnBeginDragHandler(OnMoveBegain); m_FingerTouch.AddOnEndDragHandler(OnMoveEnd); m_FingerTouch.AddOnDragHandler(OnMoveing); Vector2 limit = (m_Scene.sizeDelta - m_Role.sizeDelta) * 0.5f; m_PosLimit[0] = -limit.x; m_PosLimit[1] = limit.x; m_PosLimit[2] = -limit.y; m_PosLimit[3] = limit.y; m_LastReportPos = m_Role.localPosition; m_LastReportTime = Time.realtimeSinceStartup * 1000; FlagDrop.value = (int)Flag - 1; FlagDrop.onValueChanged.AddListener(v => { Flag = (SyncEnum)FlagDrop.value + 1; }); curPosData = new PositionData { position = m_SyncRole.localPosition, angle = m_SyncRole.localEulerAngles.z, time = Time.realtimeSinceStartup * 1000, isFinal = true, }; positionDatas = new List<PositionData>(10); positionDatas.Add(curPosData); }
public bool HandleMessage(INetMessage message) { Console.WriteLine($"SetUnitPositionHandler. PeerId: {message.Client.NetPeer.Id}"); if (message.Client.CurrentSessionId == null) { return(true); } var session = SessionCache.Instance.GetSessionById(message.Client.CurrentSessionId); if (session == null || session.IsStarted) { return(true); } int unitId = message.Reader.GetInt(); PositionData positionData = MessageSerializerService.DeserializeObjectOfType <PositionData>(message.Reader.GetString()); if (session.Units.ContainsKey(unitId)) { session.Units[unitId].UnitData.PositionData = positionData; } return(true); }
void SyncPositionForce(PositionData posData) { m_SyncRole.localPosition = posData.position; var angle = m_SyncRole.localEulerAngles; angle.z = posData.angle; m_SyncRole.localEulerAngles = angle; }
IEnumerator DelaySend() { float nowTime = Time.realtimeSinceStartup * 1000; PositionData data = new PositionData { position = m_Role.localPosition, angle = m_Role.localEulerAngles.z, time = nowTime, isFinal = !m_IsMoving, }; float latency = int.Parse(m_LatencyInput.text); float shake = int.Parse(m_ShakeInput.text); float minLatency = m_LastLentacy - (nowTime - m_LastReportTime); if(minLatency <= 0 || minLatency < latency - shake) { minLatency = latency - shake; minLatency = minLatency < 0 ? 0 : minLatency; } m_LastLentacy = Random.Range(minLatency, latency + shake); m_LastReportTime = nowTime; m_LastReportPos = m_Role.localPosition; m_LastReportPos[3] = m_Role.localEulerAngles.z; yield return new WaitForSeconds(m_LastLentacy / 1000); OnUpdateNetPosition(data); }
public BPBox() { Center = new PositionData(); HalfExtents = new PositionData(); Rotation = new PositionData(); LocalScale = new PositionData(); }
public virtual long Write(TermsConsumer termsConsumer) { PostingsConsumer postingsConsumer = termsConsumer.StartTerm(text); long totTF = 0; for (int i = 0; i < docs.Length; i++) { int termDocFreq; if (field.omitTF) { termDocFreq = -1; } else { termDocFreq = positions[i].Length; } postingsConsumer.StartDoc(docs[i], termDocFreq); if (!field.omitTF) { totTF += positions[i].Length; for (int j = 0; j < positions[i].Length; j++) { PositionData pos = positions[i][j]; postingsConsumer.AddPosition(pos.pos, pos.payload, -1, -1); } } postingsConsumer.FinishDoc(); } termsConsumer.FinishTerm(text, new TermStats(docs.Length, field.omitTF ? -1 : totTF)); return(totTF); }
// Use this for initialization void Awake() { foreach (CarController car in _carContainer.GetComponentsInChildren<CarController>(true)) { _carPositions[car] = new PositionData(); } }
void Start() { stats = gameObject.GetComponent <EnemyStats>(); empiezaLaPelea = false; //Creamos un objeto PositionData para guardar la pos inicial del Nyapos y que no var�e posicionInicial = new PositionData(transform.position, transform.rotation); rb = GetComponent <Rigidbody>(); timerBalas = 0; nav = GetComponent <UnityEngine.AI.NavMeshAgent>(); nav.speed = MoveSpeed; caseSwitch = 5; currentBalas = maxbalas; colliderBrazo = brazoFuerte.GetComponent <Collider>(); colliderBrazo.enabled = false; dmColliderCuerpo = cuerpoGO.GetComponent <DamageColliderNyapos>(); dmColliderBrazo = brazoFuerte.GetComponent <DamageColliderNyapos>(); dmColliderBrazo.damage = damage; dmColliderBrazo.player = target; dmColliderBrazo.haspegado = false; dmColliderCuerpo.damage = damage; dmColliderCuerpo.player = target; dmColliderCuerpo.haspegado = false; posicionActual = new PositionData(transform.position, transform.rotation); transformacion = false; segundaFase = false; health.SetMaxHealth(stats.Salud); }
public LODRequestData(string type, DataEntityHandle penguinHandle, PositionData positionData) { this = default(LODRequestData); Type = type; PenguinHandle = penguinHandle; PositionData = positionData; }
private Yad.Net.Messaging.Common.Message CreateInitMessage() { GameInitMessage giMsg = (GameInitMessage)MessageFactory.Create(MessageType.GameInit); int count = -1; PositionData[] arrPd = null; lock (((ICollection)_playerCollection).SyncRoot){ count = _playerCollection.Count; short[] ids = new short[count]; int index = 0; foreach (Player p in _playerCollection.Values) { ids[index++] = p.Id; } arrPd = new PositionData[count]; for (int i = 0; i < count; ++i) { arrPd[i] = new PositionData(ids[i]); } } SetStartPositions(arrPd); Array.Sort(arrPd); giMsg.PositionData = arrPd; return(giMsg); }
public PositionData Copy() { PositionData clone = new PositionData(); clone.position = position; return(clone); }
//public static Bitmap ParseTo8BppBmp(string file) //{ // List<Palette> paletteList = new List<Palette>(); // using (FileStream fileData = new FileStream(file, FileMode.Open, FileAccess.Read)) // { // // these are the same for all // const int pixelDataOffset = 0x4000; // const int paletteOffset = 0x1f84; // int numImageBytes = (int)(fileData.Length - pixelDataOffset); // BinaryReader br = new BinaryReader(fileData); // byte[] header = br.ReadBytes(4); // if (Encoding.ASCII.GetString(header, 0, 4) != "GTMP") // { // return null; // } // br.BaseStream.Seek(pixelDataOffset, SeekOrigin.Begin); // // read the raw 16x8 squares and make them into their rects // byte[] imageArray = br.ReadBytes(numImageBytes); // List<ImageSlice> slices = ParseSlices(imageArray); // // read the palettes // br.BaseStream.Seek(paletteOffset, SeekOrigin.Begin); // for (int i = 0; i < 16; ++i) // { // Palette p = new Palette(256); // for (int j = 0; j < p.colours.Length; ++j) // { // // colours are in BGR format // ushort color = br.ReadUInt16(); // p.colours[j] = color; // } // paletteList.Add(p); // } // br.BaseStream.Seek(4, SeekOrigin.Begin); // // image positiioning seems to be on an absolute 512x504 canvas even if there's // // only enough image data in the file to cover 512x8 // Bitmap bm = new Bitmap(512, 504, PixelFormat.Format8bppIndexed); // Color[] paletteEntries = bm.Palette.Entries; // for (int i = 0; i < paletteList.Count; ++i) // { // for (int j = 0; j < paletteList[i].colours.Length; ++j) // { // paletteEntries[i * 16 + j] = GT3Tex.MakeColorFromBGR555(paletteList[i].colours[j]); // } // } // //using (Graphics g = Graphics.FromImage(bm)) // //{ // // g.FillRectangle(Brushes.Black, new Rectangle(0, 0, 512, 504)); // //} // List<PositionData> pd = ParsePositionData(br, 0); // ArrangeSlicesIndexed(bm, slices, paletteList, pd); // return bm; // } //} public static List <PositionData> ParsePositionDataDemo(BinaryReader br, int maxDataSize) { // max of 0x1f80 bytes of position data // 4 is the size of the pos struct //struct TileInfo //{ // unsigned char x; // * 16 for pixel pos // unsigned char y; // * 8 for pixel pos // unsigned short tileIndex; // & 0x0FFF = which tile, & 0xF000 >> 12 = which palette //}; int dataSize = maxDataSize == 0 ? 0x1f80 : maxDataSize; int maxNumOfDataStructs = dataSize / 4; List <PositionData> pdList = new List <PositionData>(); int zeroDataSeen = 0; while (maxNumOfDataStructs > 0) { const ushort paletteMask = 0xF800; PositionData pd = new PositionData(); byte x = br.ReadByte(); byte y = br.ReadByte(); // the x value is technically two bits of data // the low 5 bits are the x coordinate // the upper three (really just the high bit) are a flag // if this flag is set, then the tile index is actually a BGR555 solid colour // and is used for all 16 x 8 pixels instead of a tile byte xPos = (byte)(x & 0x1F); byte isSolidColourFlag = (byte)((x & 0xE0) >> 5); // turn these into pixel coordinates instead of tile coordinates // to make it easier later pd.x = xPos * 16; pd.y = y * 8; ushort tileAndPal = br.ReadUInt16(); if (isSolidColourFlag == 0) { pd.tile = (ushort)(tileAndPal & 0x04FF); pd.palette = (byte)((tileAndPal & paletteMask) >> 11); } else { pd.tile = tileAndPal; pd.palette = 0xFF; } if ((pd.x + pd.y + pd.palette + pd.tile) == 0) { if (++zeroDataSeen == 2) { pdList.RemoveAt(pdList.Count - 1); break; } } else { zeroDataSeen = 0; } pdList.Add(pd); --maxNumOfDataStructs; } return(pdList); }
public void DeSerializeJson() { positions = new List <Vector3>(); string textFile = ""; switch (ballIndex) { case 1: textFile = File.ReadAllText(Application.dataPath + "/ball_path.json"); break; case 2: textFile = File.ReadAllText(Application.dataPath + "/ball_path2.json"); break; case 3: textFile = File.ReadAllText(Application.dataPath + "/ball_path3.json"); break; case 4: textFile = File.ReadAllText(Application.dataPath + "/ball_path4.json"); break; default: break; } PositionData posCollection = JsonUtility.FromJson <PositionData>(textFile); for (int i = 0; i < posCollection.x.Length; i++) { positions.Add(new Vector3(posCollection.x[i], posCollection.y[i], posCollection.z[i])); } }
/// <summary> /// 检查逃跑,并结束当局游戏,扣分两家平分 /// </summary> /// <param name="user"></param> /// <param name="table"></param> /// <param name="userPos"></param> private void CheckFlee(GameUser user, TableData table, PositionData userPos) { table.IsClosed = true; if (table.IsStarting) { int multipleMinNum = ConfigEnvSet.GetInt("Game.FleeMultipleNum", 10); PositionData pos = null; List <PositionData> posList = new List <PositionData>(); //计算炸弹数量 foreach (PositionData position in table.Positions) { if (position.UserId == user.UserId) { pos = position; } else { posList.Add(position); } var obj = _cardRole.ParseCardGroup(position.CardData.ToArray()); for (int i = 0; i < obj.Count; i++) { var item = obj.GetSame(i); if (item.Length == 4 || (item.Length == 2 && _cardRole.GetCardSize(item[0]) > (int)CardSize.C_2)) { table.DoDouble(); } } } table.IsFlee = true; if (table.MultipleNum < multipleMinNum) { table.SetDouble(multipleMinNum); } DoSettlement(table, false, pos, posList); var param = new Parameters(); param.Add("FleeUserId", user.UserId); var userList = ClientNotifier.GetUserList(table, user.UserId); SyncNotifyAction(ActionIDDefine.Cst_Action2013, userList, param, c => { DoComplatedSettlement(table); // TraceLog.WriteComplement("桌子:{0}玩家{1}逃跑通知", table.TableId, user.UserId); }); NotifyUserChange(user.UserId); } else { //还没有开始时,可以离开位置等待新玩家 user.Property.InitTablePos(); userPos.Init(); table.IsClosed = false; int periodAiStart = ConfigEnvSet.GetInt("Game.Table.AIIntoTime", 5000); table.ReStartTimer(periodAiStart); var userList = ClientNotifier.GetUserList(table, user.UserId); SyncNotifyAction(ActionIDDefine.Cst_Action2003, userList, null, null); } }
public override void ApplyData(string s) { if (usePlayerSpawnpoint && SaveSystem.playerSpawnpoint != null) { SetPosition(SaveSystem.playerSpawnpoint.transform.position, SaveSystem.playerSpawnpoint.transform.rotation); } else if (!string.IsNullOrEmpty(s)) { if (multiscene) { var currentScene = SceneManager.GetActiveScene().buildIndex; for (int i = 0; i < m_multisceneData.positions.Count; i++) { if (m_multisceneData.positions[i].scene == currentScene) { SetPosition(m_multisceneData.positions[i].position, m_multisceneData.positions[i].rotation); break; } } } else { var data = SaveSystem.Deserialize <PositionData>(s, m_data); if (data == null) { return; } m_data = data; SetPosition(data.position, data.rotation); } } }
private bool createRemotePlayer(DataEntityHandle remotePlayerHandle, bool attemptSpawn = true) { if (!dataEntityCollection.HasComponent <GameObjectReferenceData>(remotePlayerHandle)) { dataEntityCollection.AddComponent <GameObjectReferenceData>(remotePlayerHandle); } if (!dataEntityCollection.HasComponent <AirBubbleData>(remotePlayerHandle)) { dataEntityCollection.AddComponent <AirBubbleData>(remotePlayerHandle); } PositionData component = dataEntityCollection.GetComponent <PositionData>(remotePlayerHandle); RemotePlayerData component2 = dataEntityCollection.GetComponent <RemotePlayerData>(remotePlayerHandle); component2.PlayerRemoved += onPlayerRemoved; playerRemovedListeners.Add(component2); PresenceData component3 = dataEntityCollection.GetComponent <PresenceData>(remotePlayerHandle); if (component3 != null) { component3.PresenceDataUpdated += onPresenceDataUpdated; } if (!dataEntityCollection.HasComponent <LODRequestReference>(remotePlayerHandle)) { LODRequestData requestData = new LODRequestData(LODSystem.REMOTE_PLAYER, remotePlayerHandle, component); requestData.OnGameObjectGeneratedEvent += onLODGameObjectGenerated; requestData.OnGameObjectRevokedEvent += onLODGameObjectRevoked; LODRequest request = Service.Get <LODService>().Request(requestData, attemptSpawn); dataEntityCollection.AddComponent <LODRequestReference>(remotePlayerHandle).Request = request; } return(false); }
public override void OnInit() { playerTransform = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); leftAirWallTransform = GameObject.Find("LeftAirWall").GetComponent <Transform>(); rightAirWallTransform = GameObject.Find("RightAirWall").GetComponent <Transform>(); farAirWallTransform = GameObject.Find("FarAirWall").GetComponent <Transform>(); nearAirWallTransform = GameObject.Find("NearAirWall").GetComponent <Transform>(); SetPositionData(); leftScale = playerTransform.localScale; if (leftScale.x >= 0) { leftScale.x = 0 - leftScale.x; } rightScale = new Vector3(-leftScale.x, leftScale.y, leftScale.z); index = facade.GetPresentIndex(); PositionData pd = null; positionDataDict.TryGetValue(index, out pd); if (pd != null) { SetAirWallPosition(pd); } }
public bool SetData(XElement data, int document, int position, int profileType) { if (data == null) { return(false); } if (_data == data) { return(true); } _data = data; bool created = false; if (data.Element(Xml.EOkno) == null) { data.SetElementValue(Xml.EOkno, string.Empty); created = true; } PositionData model = new PositionData(ObjectData = data.Element(Xml.EOkno)); _viewmodel.SetModel(model); if (created) { _viewmodel.SetDefaults(); } return(true); }
// ————— // ————— Send web request to get json of active object // ————— IEnumerator getPositionFromServer() { coRoutineRunning = true; // php page that spits out a json object WWW positionRequest = new WWW("http://bennorskov.com/experiments/currentState.php"); yield return(positionRequest); if (positionRequest.error != null) { print("server request error " + positionRequest.error); } else { print(positionRequest.text); PositionData positionData = JsonUtility.FromJson <PositionData>(positionRequest.text); if (currentPosition != positionData.id) { turnOffTextDisplays(); getNextPosition(positionData.id, positionData.displayText); } } coRoutineRunning = false; }
private PositionData GetData() { PositionData data = new PositionData(); data.CODE = this.txtCode.Text.Trim(); data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text); data.NAME = this.txtName.Text.Trim(); return data; }
// Use this for initialization void Awake() { foreach (CarController car in _carContainer.GetComponentsInChildren<CarController>(true)) { _carPositions[car] = new PositionData(); } _resetTimer = GameObject.FindWithTag("GameController").GetComponent<RaceManager>().TimeToStart; }
private void OnStartPaint(PositionData posData) { indicator.gameObject.SetActive(true); indicator.SetAsLastSibling(); int x = PlayerPrefs.GetInt("penOffsetX"); int y = PlayerPrefs.GetInt("penOffsetY"); indicator.position = posData.worldPos - new Vector2(x,y); }
private void OnPaintMovement(PositionData posData) { int x = PlayerPrefs.GetInt("penOffsetX",0); int y = PlayerPrefs.GetInt("penOffsetY",0); indicator.position = posData.worldPos - new Vector2(x, y); Vector2 stPos = posData.preWorldPos; Vector2 endPos = posData.worldPos; brushOffset = new Vector2(PlayerPrefs.GetInt("brushOffsetX", 0),PlayerPrefs.GetInt("brushOffsetY", 0)); stPos -= brushOffset; endPos -= brushOffset; Brush(stPos, endPos); }
public void OnPointerDown(PointerEventData eventData) { Vector2 localCursor; RectTransformUtility.ScreenPointToLocalPointInRectangle(rectT, eventData.position, eventData.pressEventCamera, out localCursor); Vector2 offset = rectT.rect.position; Vector2 pos = localCursor - offset; //DrawPoint(pos); var posdata = new PositionData(pos,eventData.position,lastPos,lastWorldPos); if(OnStartPaint != null) { OnStartPaint(posdata); } lastPos = pos; lastWorldPos = eventData.position; }
// Use this for initialization void Awake() { foreach (CarController car in _carContainer.GetComponentsInChildren<CarController>(true)) { _carPositions[car] = new PositionData(); } // Chargement du path pour les voitures : GameObject p = GameObject.Find ("Path V"); this._path_v = new Transform[p.transform.childCount]; for (int i = 0; i < p.transform.childCount; i++) { this._path_v[i] = p.transform.GetChild(i); } }
private void OnPaintEnd(PositionData posData) { indicator.gameObject.SetActive(false); }
public async Task<PositionData> GetLocationUpdate() { Geoposition position = await mainPage.locator.GetGeopositionAsync(); PositionData pData = new PositionData(); try { cts = new CancellationTokenSource(); CancellationToken token = cts.Token; Geoposition pos = await mainPage.locator.GetGeopositionAsync().AsTask(token); Location location = new Location(pos.Coordinate.Point.Position.Latitude, pos.Coordinate.Point.Position.Longitude); pData.CToken = token; pData.GPosition = pos; pData.location = location; } catch { } return pData; }
// Use this for initialization void Awake() { foreach (CarController car in _carContainer.GetComponentsInChildren<CarController>(true)) { _carPositions[car] = new PositionData(); car.checkpointManager = this; orderedCars.Add(car); } }