public void Initialize()
    {
        DemoSF_GameEntry.Event.Subscribe(ShowEntitySuccessEventArgs.EventId, OnShowEntitySuccess);
        DemoSF_GameEntry.Event.Subscribe(ShowEntityFailureEventArgs.EventId, OnShowEntityFailure);

        m_SceneBackground = Object.FindObjectOfType <DemoSF_ScrollableBackground>();

        // 创建实体
        DemoSF_GameEntry.Entity.ShowEntity <DemoSF_Aircraft>(
            DemoSF_EntityExtension.GenerateSerialId(),
            "Assets/DemoStarForce/Prefabs/PlayerShip.prefab",
            "PlayerGroup");

        GameOver     = false;
        m_MyAircraft = null;
    }
示例#2
0
    protected override void OnShow(object userData)
    {
        base.OnShow(userData);

        CachedTransform.localPosition = transform.position;
        CachedTransform.localRotation = transform.rotation;
        CachedTransform.localScale    = Vector3.one;

        // 移动范围
        DemoSF_ScrollableBackground sceneBackground = FindObjectOfType <DemoSF_ScrollableBackground> ();

        m_PlayerMoveBoundary = new Rect(sceneBackground.PlayerMoveBoundary.bounds.min.x, sceneBackground.PlayerMoveBoundary.bounds.min.z,
                                        sceneBackground.PlayerMoveBoundary.bounds.size.x, sceneBackground.PlayerMoveBoundary.bounds.size.z);

        // 加载武器,最后一个参数为当前飞机的ID,武器将附加到飞机身上
        DemoSF_GameEntry.Entity.ShowEntity <DemoSF_Weapon>(
            DemoSF_EntityExtension.GenerateSerialId(),
            "Assets/DemoStarForce/Prefabs/DefaultWeapon.prefab",
            "WeaponGroup",
            this.Entity.Id.ToString());
    }