示例#1
0
        private PlayerInfo getPlayerInfo(PlayerControls playerControl, Dictionary <String, String> containerMap)
        {
            PlayerInfo playerInfo = new PlayerInfo();

            playerInfo.name = playerControl.name;
            playerInfo.p    = new PlayerInfo.Position();
            Vector3 playerPos = getPlayerPosition(playerControl);

            playerInfo.p.x     = Math.Round(playerPos.x, 2);
            playerInfo.p.y     = Math.Round(playerPos.y, 2);
            playerInfo.p.z     = Math.Round(playerPos.z, 2);
            playerInfo.p.a     = Math.Round(getPlayerAngle(playerControl), 2);
            playerInfo.isCarry = PlayerUtil.IsCarrying(playerControl);
            if (playerInfo.isCarry == false)
            {
                playerInfo.carry = "None";
            }
            else
            {
                String     result      = "";
                GameObject playerCarry = PlayerUtil.GetCarrying(playerControl);
                //Logger.Log($"player holding: {playerCarry.name}, {playerCarry.GetInstanceID().ToString()}");
                bool flag = false;
                foreach (var dic in containerMap)
                {
                    if (dic.Key.Equals(playerCarry.GetInstanceID().ToString()))
                    {
                        flag = true;
                        if (dic.Value == "")
                        {
                            result = playerCarry.name + "+" + "None";
                        }
                        else
                        {
                            result = playerCarry.name + "+" + dic.Value;
                        }
                        break;
                    }
                }
                if (flag == false)
                {
                    result = playerCarry.name;
                }
                playerInfo.carry = result;
            }
            return(playerInfo);
        }
示例#2
0
 private double getPlayerAngle(PlayerControls player)
 {
     return(Convert.ToDouble(PlayerUtil.GetChefAngles(player)));
 }
示例#3
0
        private Vector3 getPlayerPosition(PlayerControls player)
        {
            Vector3 playerPos = PlayerUtil.GetChefPosition(player);

            return(playerPos);
        }