private void HandleLeftClick(NetworkPlayer me, MouseClickEventArgs e) { uiManager.ContextMenu.Hide(); // ignore other players for now since we don't have // a left button action on players yet. Going to be for selecting/targeting players. var player = e.GetNetworkPlayer(); if (player) { UnityEngine.Debug.Log("We left clicked on a player."); return; } var npc = e.GetNetworkNpc(); if (npc) { me.MoveToAndInteractWith(NpcInteraction.Create(me, npc, -1), CheckIfRunning()); return; } var worldObject = e.GetNetworkObject(); //var worldObject = e.Object.transform.GetComponentInParent<NetworkObject>(); if (worldObject) { me.MoveToAndInteractWith(ObjectInteraction.Create(me, worldObject), CheckIfRunning()); return; } if (moveSound) { moveSound.Play(); } var terrainHit = e.GetTerrain(); //var terrain = e.Object.transform.GetComponent<Terrain>(); if (terrainHit.Terrain) { HandleTerrainInteraction(e, terrainHit.Terrain, terrainHit.Point); return; } WalkTo(me, terrainHit.Point); }
private void HandleNpcInteraction(NetworkNpc targetNpc, int actionId) { var myPlayer = playerManager.Me; if (!myPlayer) { return; } var npc = targetNpc; if (npc) { myPlayer.MoveToAndInteractWith(NpcInteraction.Create(myPlayer, npc, actionId), CheckIfRunning()); } }