/// <summary> /// プレーヤー1体spawn。hud(スコア)との関連付けする。 /// </summary> /// <param name="pinfo"></param> /// <param name="pos"></param> /// <returns></returns> private PlayerController SpawnPlayer(PlayerInfo pinfo, Transform pos) { var pobj = Instantiate(pinfo.prefab.transform, pos.position, pos.rotation); var pc = pobj.GetComponent <PlayerController>(); var hudsc = hud.AddHudScore(pinfo.name); hudsc.SetColor(pinfo.hudColor); pc.onScoreUpdate.AddListener(hudsc.OnUpdateScore); pc.stageSearcher = this; allPlayers.Add(pc); return(pc); }