Пример #1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.D))
        {
            simpleDelegate.CallFromOutside((x, y) => x + y);
        }

        if (Input.GetKeyDown(KeyCode.F))
        {
            SimpleDelegate.HogeDelegate hogeDelegate = (x, y) => x * y;
            simpleDelegate.CallFromOutside(hogeDelegate);
        }

        if (Input.GetKeyDown(KeyCode.G))
        {
            //simpleDelegate.hogeDelegate += (x, y) => x + y;
            simpleDelegate.hogeDelegate = new SimpleDelegate.HogeDelegate(Method1) + new SimpleDelegate.HogeDelegate(Method2);
        }

        if (Input.GetKeyDown(KeyCode.H))
        {
            simpleDelegate.hogeDelegate += Method2;
        }
    }