public static String GetIngredient(ServerIngredientContainer container)
        {
            String  result = "";
            Boolean flag   = true;

            AssembledDefinitionNode[] containerContents = container.GetContents();
            ArrayList contents = new ArrayList();

            foreach (AssembledDefinitionNode node in containerContents)
            {
                ItemUtil.GetIngredientsInNode(node, contents);
            }
            foreach (String content in contents)
            {
                if (flag == true)
                {
                    result = result + content;
                    flag   = false;
                }
                else
                {
                    result = result + "+" + content;
                }
            }
            return(result);
        }
        public static ArrayList GetIngredientContainerContents(GameObject gameObject)
        {
            ServerIngredientContainer serverIngredientContainer = gameObject.GetComponent <ServerIngredientContainer>();

            AssembledDefinitionNode[] plateContents = serverIngredientContainer.GetContents();

            //Logger.Log($"Plate contents size: {plateContents.Length}");

            ArrayList contents = new ArrayList();

            foreach (AssembledDefinitionNode node in plateContents)
            {
                ItemUtil.GetIngredientsInNode(node, contents);
            }

            return(contents);
        }
Beispiel #3
0
        private ContainerInfo getContainerInfo(ServerIngredientContainer container)
        {
            ContainerInfo cInfo = new ContainerInfo();

            cInfo.name = container.name;
            cInfo.id   = container.gameObject.GetInstanceID().ToString();
            cInfo.p    = new ContainerInfo.Position();
            Vector3 cPos = getContainerPosition(container);

            cInfo.p.x           = Math.Round(cPos.x, 2);
            cInfo.p.y           = Math.Round(cPos.y, 2);
            cInfo.p.z           = Math.Round(cPos.z, 2);
            cInfo.hasIngredient = ContainerUtil.HasIngredient(container);
            if (cInfo.hasIngredient == false)
            {
                cInfo.ingredient = "None";
            }
            else
            {
                cInfo.ingredient = ContainerUtil.GetIngredient(container);
            }
            return(cInfo);
        }
 public static Vector3 GetContainerPosition(ServerIngredientContainer container)
 {
     return(container.transform.position);
 }
 public static bool HasIngredient(ServerIngredientContainer container)
 {
     return(GetIngredient(container) != "");
 }
Beispiel #6
0
        private Vector3 getContainerPosition(ServerIngredientContainer container)
        {
            Vector3 containerPos = ContainerUtil.GetContainerPosition(container);

            return(containerPos);
        }