public void Update() { if (CanvasHelper.ActiveMenu != MenuType.None) { return; } var ply = RAPI.getLocalPlayer(); if (SceneManager.GetActiveScene().name != network.gameSceneName || ply == null) { return; } var localPlayerTPS = ply.currentModel.thirdPersonSettings; if (!localPlayerTPS.ThirdPersonState) { return; } localPlayerTPS.lerpCameraMovementBackSpeed = 9999; localPlayerTPS.lerpCameraMovementSpeed = 9999; localPlayerTPS.lerpCameraRotationSpeed = 9999; ThirdPerson TP = ply.gameObject.GetComponentInChildren <ThirdPerson>(); Vector3 vec = (Vector3)Traverse.Create(TP).Field("localCameraRotation").GetValue(); vec += new Vector3(Input.GetAxis("Mouse Y"), -Input.GetAxis("Mouse X"), 0f); vec += new Vector3(-Input.GetAxis("Mouse Y"), Input.GetAxis("Mouse X"), 0f) * gameSettings.controls.MouseSensitivity; Traverse.Create(TP).Field("localCameraRotation").SetValue(vec); }
private void ack_move(int err, wire obj) { a_move ack = (a_move)obj; Debug.Log("a_move:" + err + ":" + ack.uid + ack.pos); int uid = ack.uid; if (Player.Instance.Uid == uid) { return; } ThirdPerson p = GetCharacter(uid); if (p == null) { Debug.Log("ASYC UID NULL:" + uid); return; } Vector3 pos = new Vector3(); Quaternion rot = new Quaternion(); Tool.ToNative(ref pos, ack.pos); Tool.ToNative(ref rot, ack.rot); p.MoveTo(pos, rot, false, false); Debug.Log("ack_move uid:" + uid + pos + rot); }
public void ReturnRightString_WhenPrintToStringWithParameters() { var expectedResult = $"Person\r\n\tName = Me\r\n\tHeight = {ThirdPerson.Height}\r\n\tAge = 20\r\n\tParents = empty\r\n"; ThirdPerson.PrintToString(config => config.SelectProperty(x => x.Name).Trimmed(4).Exclude(x => x.Id)) .Should() .Be(expectedResult); }
void ComponentStart() { controller = GetComponent <ThirdPersonController>(); int uid = Player.Instance.Uid; Vector2 pos = Player.Instance.Pos; mainPlayer = ThirdPersonManager.Instance.CreateCharacter(uid, pos); controller.Attach(mainPlayer); Debug.Log("GameScene MainPlayer:" + pos); }
void StartScript() { //Output this to console when the Button is clicked print("StartScript"); this.gameObject.SetActive(false); Time.timeScale = 1; ThirdPerson.GetComponent <PlayerController>().paused = false; ThirdPerson.GetComponent <PlayerController>().endGame = false; }
public void SyncCharacter(int uid) { ThirdPerson player = GetCharacter(uid); r_move @r_move = new r_move(); @r_move.pos = new vector2(); @r_move.rot = new rotation(); Tool.ToProto(ref @r_move.pos, player.transform.position); Tool.ToProto(ref @r_move.rot, player.transform.rotation); NetInstance.Gate.Send(@r_move); //Debug.Log("r_move"); }
public void DeleteCharacter(int uid) { if (!pool.ContainsKey(uid)) { return; } Debug.Log("DeleteCharacter:" + uid); ThirdPerson p = pool[uid]; pool[uid] = null; Destroy(p.gameObject); }
void Awake() { behaviours = new List <GenericBehaviour> (); overridingBehaviours = new List <GenericBehaviour>(); anim = GetComponent <Animator> (); hFloat = Animator.StringToHash("H"); vFloat = Animator.StringToHash("V"); camScript = playerCamera.GetComponent <ThirdPerson> (); rBody = GetComponent <Rigidbody> (); groundedBool = Animator.StringToHash("Grounded"); colExtents = GetComponent <Collider>().bounds.extents; }
private void Start() { if (Camera.main != null) { camera = Camera.main.transform; } else { UnityEngine.Debug.Log("[WARNING] Not found main camera!"); } character = GetComponent <ThirdPerson>(); player = GameObject.FindWithTag("Player").transform; }
public ThirdPerson CreateCharacter(int uid, Vector2 pos) { if (pool.ContainsKey(uid)) { return(pool[uid]); } GameObject obj = Instantiate(thirdperson, new Vector3(pos.x, 0, pos.y), Quaternion.identity); ThirdPerson p = obj.GetComponent <ThirdPerson>(); Debug.Log("CreateCharacter:" + uid + p + p.transform.position); p.Uid = uid; pool[uid] = p; return(p); }
public void Demo() { var printer = ObjectPrinter.For <Person>() //1. Исключить из сериализации свойства определенного типа .Exclude(typeof(string)) //2. Указать альтернативный способ сериализации для определенного типа .Printing <string>().Using(x => x + ".0") //3. Для всех типов, имеющих культуру, есть возможность ее указать .SetCultureInfo <int>(CultureInfo.CurrentCulture) //4. Настроить сериализацию конкретного свойства .SelectProperty(properties => properties.Name).Using(name => $"<em>{name}</em>") //5. Настроить обрезание строковых свойств (метод должен быть виден только для строковых свойств) .SelectProperty(properties => properties.Name).Trimmed(2) //6. Исключить из сериализации конкретного свойства .Exclude(properties => properties.Id); var peronSerialization = printer.PrintToString(Person); //7. Синтаксический сахар в виде метода расширения, сериализующего по-умолчанию var secondPeronSerialization = SecondPerson.PrintToString(); //8. ...с конфигурированием var thirdPeronSerialization = ThirdPerson.PrintToString(config => config.SelectProperty(x => x.Name).Trimmed(4).Exclude(x => x.Id)); }
public void endTopScreen() { ThirdPerson.GetComponent <PlayerController>().top10.SetActive(false); }
////////////interface public void Attach(ThirdPerson p) { player = p; follow.Follow(p); worldmap.UpdatePosition(p.transform.position); }
public void Follow(ThirdPerson player) { follow_target = player; }
void LeaderboardScript() { ThirdPerson.GetComponent <PlayerController>().atualizaLeaderBoard(); ThirdPerson.GetComponent <PlayerController>().top10.SetActive(true); }
void closeButtonScript() { ThirdPerson.GetComponent <PlayerController>().top10.SetActive(false); }