Beispiel #1
0
    void Start()
    {
        // two diffrent ways to make an item.
        sword             = new ClassInfo2();
        sword.name        = "Sword";
        sword.id          = 1;
        sword.description = "This is a sword!";

        hammer = new ClassInfo2("Hammer", 2, "This is a hammer.");

        //third way to do same thing.
        bread = CreateItem("bread", 3, "I can eat this.");
    }
Beispiel #2
0
    private ClassInfo2 CreateItem(string name, int id, string description)
    {
        ClassInfo2 item = new ClassInfo2(name, id, description);

        return(item);
    }