コード例 #1
0
        //显示实体成功的回调
        protected virtual void OnShowEntitySuccess(object sender, GameEventArgs e)
        {
            ShowEntitySuccessEventArgs args       = e as ShowEntitySuccessEventArgs;
            UserEntityData             entityData = args.UserData as UserEntityData;

            if (entityData != null && entityData.HotLogicTypeName == typeof(MyAircraft).Name)
            {
                m_MyAircraft = entityData.RuntimeEntity.HotLogicInstance as MyAircraft;
            }
        }
コード例 #2
0
        private MyAircraft m_MyAircraft = null;     //我的战机

        //初始化
        public virtual void Initialize()
        {
            //注册事件
            GameEntry.Event.Subscribe(ShowEntitySuccessEventArgs.EventId, OnShowEntitySuccess);
            GameEntry.Event.Subscribe(ShowEntityFailureEventArgs.EventId, OnShowEntityFailure);
            //滚动背景
            SceneBackground = Object.FindObjectOfType <ScrollableBackground>();
            if (SceneBackground == null)
            {
                HotLog.Warning("Can not find scene background.");
                return;
            }
            SceneBackground.VisibleBoundary.gameObject.GetOrAddComponent <HideByBoundary>();    //添加触发离开时隐藏实体
            GameEntry.Entity.ShowMyAircraft(new MyAircraftData(GameEntry.Entity.GenerateSerialId(), 10000)
            {
                Name     = "My Aircraft",
                Position = Vector3.zero
            });

            IsGameOver   = false;
            m_MyAircraft = null;
        }