public static MeteorUnit InitPlayer(LevelScriptBase script) { MonsterEx mon = SceneMng.InitPlayer(script); GameObject objPrefab = Resources.Load("MeteorUnit") as GameObject; GameObject ins = GameObject.Instantiate(objPrefab, Vector3.zero, Quaternion.identity) as GameObject; MeteorUnit unit = ins.GetComponent <MeteorUnit>(); MeteorManager.Instance.LocalPlayer = unit; unit.Camp = EUnitCamp.EUC_FRIEND;//流星阵营 unit.Init(mon.Model, mon); MeteorManager.Instance.OnGenerateUnit(unit); //LuaFunction onInit = ScriptMng.ins.GetFunc("OnInit"); //LuaFunction OnStart = ScriptMng.ins.GetFunc("OnStart"); //onInit.call(unit.InstanceId); unit.SetGround(false); unit.transform.position = Global.GLevelItem.wayPoint.Count > mon.SpawnPoint ? Global.GLevelItem.wayPoint[mon.SpawnPoint].pos : GameObject.Find("StartPoint").transform.position;//等关卡脚本实现之后在设置单机出生点.PlayerEx.Instance.SpawnPoint unit.transform.eulerAngles = new Vector3(0, mon.SpawnDir, 0); //OnStart.call(); U3D.InsertSystemMsg(unit.name + " 加入游戏"); return(unit); }