Esempio n. 1
0
    public static Box FindMy(BoxType t, BoxGender g, GameObject gO)
    {
        var x = gO.GetComponentsInChildren <Box>();

        foreach (var item in x)
        {
            if (item.type == t && item.gender == g)
            {
                return(item);
            }
        }
        print("warning, found no box " + t.ToString() + " , " + g.ToString() + ", for " + gO.name);
        return(null);
    }
Esempio n. 2
0
    public void DefineBoxDetails(BoxType _type, PartType _part, Species _species = Species.UNKNOWN)
    {
        boxDetails.type    = _type;
        boxDetails.species = _species;
        boxDetails.part    = _part;

        string finalNamePart = _species.ToString().ToLower();

        if (_part != PartType.UNKNOWN)
        {
            finalNamePart = _part.ToString().ToLower();
        }

        boxDetails.boxTypeName = _type.ToString().Substring(0, 1) + finalNamePart;
    }
Esempio n. 3
0
    void Start()
    {
        boxDetails         = new BoxDetails();
        boxDetails.type    = _type;
        boxDetails.part    = _bodyPart;
        boxDetails.species = _species;

        string finalNamePart = _species.ToString().ToLower();

        if (_bodyPart != PartType.UNKNOWN)
        {
            finalNamePart = _bodyPart.ToString().ToLower();
        }
        boxDetails.boxTypeName = _type.ToString().Substring(0, 1) + finalNamePart;

        isEmpty = true;
    }
        private void Render()
        {
            // Nupiešk visą box's meniu
            int     y = BoxsY;
            int     x;
            BoxType bt = BoxType.None;

            for (int b = 0; b < 2; b++)
            {
                x = (App.ScreenWidth - (BoxWidth * BoxInLine + BoxInLine * 2)) / 2;
                for (int i = 0; i < 3; i++)
                {
                    boxList.Add(new BoxFrame(++bt, x, y, BoxWidth, BoxFrame.BoxHeight, bt.ToString(), (i == 0 && b == 0)));
                    boxList[boxList.Count - 1].Render();
                    x = x + BoxWidth + 2;
                }
                y = y + BoxFrame.BoxHeight + 2;
            }
        }
Esempio n. 5
0
        private void DrawElements(Rect rect, int index, bool isActive, bool isFocus)
        {
            GUILayout.Space(5f);
            float singleLine = EditorGUIUtility.singleLineHeight;

            GameObject gameObject = manager.boxGameObjects[index];
            BoxType    boxType    = BoxType.None;

            if (gameObject.GetComponent <Box>())
            {
                boxType = gameObject.GetComponent <Box>().BoxType;
            }

            if (!gameObject)
            {
                manager.boxGameObjects.Remove(gameObject);
            }

            boxType = (BoxType)EditorGUI.EnumPopup(new Rect(rect.x, rect.y, rect.width, singleLine), "Box", boxType);

            if (boxType == BoxType.None)
            {
                return;
            }

            #region Adding Box
            if (gameObject.GetComponent <Box>() == null)
            {
                switch (boxType)
                {
                case BoxType.Hurtbox:
                    gameObject.AddComponent <Hurtbox>();
                    gameObject.GetComponent <Hurtbox>().BoxType = BoxType.Hurtbox;
                    break;

                case BoxType.Hitbox:
                    gameObject.AddComponent <Hitbox>();
                    gameObject.GetComponent <Hitbox>().BoxType = BoxType.Hitbox;
                    break;

                case BoxType.GroundBox:
                    gameObject.AddComponent <Groundbox>();
                    gameObject.GetComponent <Groundbox>().BoxType = BoxType.GroundBox;
                    break;

                default:
                    break;
                }
            }
            else
            {
                if (boxType == BoxType.Hurtbox && !gameObject.GetComponent <Hurtbox>())
                {
                    DestroyImmediate(gameObject.GetComponent <Box>());
                    gameObject.AddComponent <Hurtbox>();
                    gameObject.GetComponent <Hurtbox>().BoxType = BoxType.Hurtbox;
                }
                else if (boxType == BoxType.Hitbox && !gameObject.GetComponent <Hitbox>())
                {
                    DestroyImmediate(gameObject.GetComponent <Box>());
                    gameObject.AddComponent <Hitbox>();
                    gameObject.GetComponent <Hitbox>().BoxType = BoxType.Hitbox;
                }
                else if (boxType == BoxType.GroundBox && !gameObject.GetComponent <Groundbox>())
                {
                    DestroyImmediate(gameObject.GetComponent <Box>());
                    gameObject.AddComponent <Groundbox>();
                    gameObject.GetComponent <Groundbox>().BoxType = BoxType.GroundBox;
                }
            }

            #endregion

            Box box = gameObject.GetComponent <Box>();

            GUILayout.Space(5f);
            box.ColliderType = (ColliderType)EditorGUI.EnumPopup(new Rect(rect.x, rect.y + 20f, rect.width, singleLine), "Collider", box.ColliderType);
            box.BoxArea      = (BoxArea)EditorGUI.EnumPopup(new Rect(rect.x, rect.y + 40f, rect.width, singleLine), "Body Area", box.BoxArea);
            box.Parent       = (Transform)EditorGUI.ObjectField(new Rect(rect.x, rect.y + 60f, rect.width, singleLine), "Parent", box.Parent, typeof(Transform), true);

            if (boxType == BoxType.Hitbox)
            {
                box.Color        = Color.red;
                gameObject.layer = (int)Layer.Hitbox;
            }
            else if (boxType == BoxType.Hurtbox)
            {
                box.Color        = Color.blue;
                gameObject.layer = (int)Layer.Hurtbox;
            }
            else if (boxType == BoxType.GroundBox)
            {
                box.Color        = Color.yellow;
                gameObject.layer = (int)Layer.PlayerStatic;
            }

            if (box.ColliderType == ColliderType.Sphere)
            {
                SetSphereCollider(rect, ref gameObject);
            }
            else if (box.ColliderType == ColliderType.Box)
            {
                SetBoxCollider(rect, ref gameObject);
            }

            if (box.Parent != null)
            {
                box.transform.SetParent(box.Parent);
                box.transform.position = box.Parent.position;
            }

            gameObject.name = boxType.ToString() + " " + box.BoxArea.ToString();

            bubbleList.elementHeight = 140f;
        }