コード例 #1
0
ファイル: Main.cs プロジェクト: alina-gmc/Overcooked-cooker
        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
ファイル: Main.cs プロジェクト: alina-gmc/Overcooked-cooker
 private double getPlayerAngle(PlayerControls player)
 {
     return(Convert.ToDouble(PlayerUtil.GetChefAngles(player)));
 }
コード例 #3
0
ファイル: Main.cs プロジェクト: alina-gmc/Overcooked-cooker
        private Vector3 getPlayerPosition(PlayerControls player)
        {
            Vector3 playerPos = PlayerUtil.GetChefPosition(player);

            return(playerPos);
        }