void Start()
    {
        if (tag == "Item")
        {
            worldCreation = FindObjectOfType <WorldCreation>();

            StatSets();
            Debug.Log("ID: " + itemId);

            ReturnItems();

            item = this;

            Debug.Log("ItemName: " + itemName + " Rarity: " + itemRarity + " Life: " + lifeValue + " Rage: " + rage + " Arcane: " + arcane + " Speed: " + speed + " Life: " + lifeValue);
        }
    }
Beispiel #2
0
    private void Start()
    {
        PlayerInputs.instance.PIA.debug.ToggleDC.performed += ctx => ToggleDC();
        PlayerInputs.instance.PIA.debug.Enter.performed    += ctx => ExecuteCommand();
        PlayerInputs.instance.PIA.debug.AnyKey.performed   += ctx => anyKey = true;

        Fill = new DebugCommand <float[]>("/fill", "fills in a specified area with the chosen block", "/fill <blockType> <x1 y1> <x2 y2>", (value) =>
        {
            if (value[0] < 0 || value[0] >= 255)
            {
                return;
            }

            int width      = (int)Mathf.Abs(value[1] - value[3]);
            int height     = (int)Mathf.Abs(value[2] - value[4]);
            Vector2[,] pos = new Vector2[width, height];

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    pos[x, y] = new Vector2(value[1] + x + 0.01f, value[2] + y + 0.01f);
                }
            }

            BlockManager.instance.SetTiles(pos, (int)value[0]);
        });

        Marker = new DebugCommand <float[]>("/set marker", "creates a marker at the specified position", "/set marker <number> <x1 y1>", (value) =>
        {
            if (value[0] < 21 && value[0] > 0)
            {
                markers[(int)value[0]] = new Vector2(value[1], value[2]);
            }
        });

        Initialize = new DebugCommand("/initialize", "initializes the world", "/initialize", () =>
        {
            WorldManager.instance.worldName = "New World";
            WorldManager.instance.Initialize();
        });

        NewWorld = new DebugCommand <float[]>("/create world", "creates and initializes a new world", "/create world <world width> <world height> <chunk width> <chunk height>", (value) =>
        {
            WorldCreation.New(new Vector2Int((int)value[0], (int)value[1]), new Vector2Int((int)value[2], (int)value[3]));
        });

        HelpMenu = new DebugCommand <bool>("/help", "toggles the help menu", "/help <toggle>", (value) =>
        {
            showHelp = value;
        });

        CommandTest = new DebugCommand <float[]>("/commandtest", "tests a command", "/commandtest <amount>", (value) =>
        {
            Debug.Log($"command returns: {value[0]} {value[5]}");
        });


        commands = new List <object>
        {
            CommandTest,
            HelpMenu,
            NewWorld,
            Initialize,
            Marker,
            Fill
        };
    }