using System;
using UnityEngine;
public class Project_Event : MonoBehaviour
{
void Start()
{
Player player = new Player();
player.d1 += Test5;
// player.d1();//直接使用事件委託本體,無法執行,會報錯
// 事件對調度做出了限制
// 所以在Player.cs , Player 的 class之中
// 新增了public void Call() { if (d1 != null){ d1();} }
// 使 d1 能在外部 利用 Call() 調度。
player.Call();
}
void Test5()
{
Debug.Log("執行 Test 5 !");
}
}