/// <summary> /// Initialize只在第一次创建时执行初始化代码,之后切换Scene时都不用再次初始化,所以Data也没有改变 /// </summary> /// <param name="gameObject"></param> public IPlayer(GameObject gameObject) : base(gameObject) { Props = GameMainProgram.Instance.dataBaseMgr.Props; if (GameObjectInScene != null) { animator = GameObjectInScene.GetComponent <Animator>(); Rgbd = GameObjectInScene.GetComponent <Rigidbody>(); // 关联中介者 PlayerMedi = new PlayerMediator(this); PlayerMedi.Initialize(); } }
/// <summary> /// Initialize只在第一次创建时执行初始化代码,之后切换Scene时都不用再次初始化,所以Data也没有改变 /// </summary> /// <param name="gameObject"></param> public IPlayer(GameObject gameObject) : base(gameObject) { Speed = 5; if (GameObjectInScene != null) { animator = GameObjectInScene.GetComponent <Animator>(); Rgbd = GameObjectInScene.GetComponent <Rigidbody>(); // 关联中介者 PlayerMedi = new PlayerMediator(this); PlayerMedi.Initialize(); } }
/// <summary> /// Initialize只在第一次创建时执行初始化代码,之后切换Scene时都不用再次初始化,所以Data也没有改变 /// </summary> /// <param name="gameObject"></param> public IPlayer(GameObject gameObject) : base(gameObject) { EquipPack = new IEquip[35]; PropPack = new IProp[35]; Fit = new int[8] { 99, 99, 99, 99, 99, 99, 99, 99 }; // 初始值>34表示未装备 if (GameObjectInScene != null) { animator = GameObjectInScene.GetComponent <Animator>(); Rgbd = GameObjectInScene.GetComponent <Rigidbody>(); // 关联中介者 PlayerMedi = new PlayerMediator(this); PlayerMedi.Initialize(); } // LoadData(); 请在子类构造函数最尾处调用 }