public void updateLocalPlayerSkin(ushort skin) { var old = LocalPlayerSkin; LocalPlayerSkin = skin; GameObject player = HeroController.instance.gameObject; clientSkin playerSkin = getSkinForIndex(skin); var anim = player.GetComponent <tk2dSpriteAnimator>(); anim.GetClipByName("Idle").frames[0].spriteCollection.spriteDefinitions[0].material.mainTexture = playerSkin.Knight; anim.GetClipByName("Sprint").frames[0].spriteCollection.spriteDefinitions[0].material.mainTexture = playerSkin.Sprint; if (old != skin) { //todo network call here _serverKnightsManager.sendServerKnightUpdate(0, (ushort)skin); UI.UIManager.InfoBox.AddMessage($"You are now {getSkinNameForIndex(skin)}"); } }
public void listenForInput() { if (!enabled) { return; } if (lastEmoteTime != null) { var ms = (DateTime.Now - lastEmoteTime).TotalMilliseconds; if (ms < 500) { //Dont spam emotes return; } } bool choosing = false; InputManager.ActiveDevice.RightStick.LowerDeadZone = 0.2f; if (InputManager.ActiveDevice.RightStick.IsPressed) { Index = (ushort)(Math.Floor((InputManager.ActiveDevice.RightStick.Angle - segment / 2) / segment) + 1); choosing = true; } if (Input.GetKeyDown(Keys.emote_1)) { choosing = true; Index = 2; } else if (Input.GetKeyDown(Keys.emote_2)) { choosing = true; Index = 4; } else if (Input.GetKeyDown(Keys.emote_3)) { choosing = true; Index = 1; } else if (Input.GetKeyDown(Keys.emote_4)) { choosing = true; Index = 5; } else if (Input.GetKeyDown(Keys.emote_5)) { choosing = true; Index = 3; } if (choosing) { choosingEmote(Index); } else { if (Index != 0) { showEmote(Index, HeroController.instance.gameObject); //fire a network call here _serverKnightsManager.sendServerKnightUpdate(1, Index); lastEmoteTime = DateTime.Now; Index = 0; } } }