Ejemplo n.º 1
0
    void BlackBallCloseEnd()
    {
        mainCamera.cullingMask = 1 << LayerMask.NameToLayer("ChangePlayer");
        skyBoxRenderer.material.renderQueue = 500;

        ActionTrack actionTrack;
        float       currentTime = Time.realtimeSinceStartup - startTime;
        int         hero        = CoreEntry.portalMgr.GetCurrentHeroResId();

        if (hero == 0)
        {
            // 六芒星进入
            actionTrack           = new ActionTrack();
            actionTrack.startTime = currentTime + 1.7f;
            actionTrack.endTime   = currentTime + 1.7f;
            actionTrack.Start     = StartEnter;
            actionTlist.Add(actionTrack);
        }

        // 等待新角色放入
        actionTrack = new ActionTrack();
        if (hero == 0)
        {
            actionTrack.startTime = currentTime + 1.7f + 0.5f;
        }
        else
        {
            actionTrack.startTime = currentTime + 1.7f;
        }

        actionTrack.endTime = 100000.0f;
        actionTrack.Start   = WaitForNewToyStart;
        actionTrack.Update  = WaitForNewToy;
        actionTlist.Add(actionTrack);
    }
Ejemplo n.º 2
0
        public void SetTrackGroup(TrackGroup trackGroup, float timeScale = 1.0f)
        {
            DoReset();

            m_Length = trackGroup.Length * timeScale;
            for (int i = 0; i < trackGroup.TracksLength; i++)
            {
                ActionTrack         actionTrack = trackGroup.Tracks(i).Value;
                TimelineActionTrack tlaTrack    = new TimelineActionTrack(m_Context, actionTrack, timeScale);
                m_ActionTracks.Add(tlaTrack);
            }
        }
Ejemplo n.º 3
0
    // 球体封闭
    bool BlackBallClose(ActionTrack track, float timePass, float actionLength)
    {
        float darkFactor = timePass / actionLength;

        if (darkFactor > 1.0f)
        {
            darkFactor = 1.0f;
        }

        skyBoxRenderer.material.SetFloat("_AlphaLerp", darkFactor);
        return(true);
    }
Ejemplo n.º 4
0
        public void SetData(int index, ActionTrack actionTrack)
        {
            m_Index       = index;
            m_ActionTrack = actionTrack;

            m_ItemDrawers.Clear();
            foreach (var d in m_ActionTrack.Actions)
            {
                ActionItemDrawer itemDrawer = new ActionItemDrawer(m_DrawerConfig, this);
                itemDrawer.SetData(d);

                m_ItemDrawers.Add(itemDrawer);
            }
        }
Ejemplo n.º 5
0
    // 视角从广角变普通
    bool FovLargeToNormal(ActionTrack track, float timePass, float actionLength)
    {
        float fovFactor = timePass / actionLength;

        if (fovFactor > 1.0f)
        {
            fovFactor = 1.0f;
        }

        float newFov = largeFov + (oldFov - largeFov) * fovFactor;

        mainCamera.fieldOfView = newFov;
        return(true);
    }
Ejemplo n.º 6
0
        public void Run(AnimationDescription desc)
        {
            foreach (var p in desc.Properties)
            {
                var t = new PropertyTrack(p);
                tracks.Add(t);
                t.Start(totalTime);
            }

            foreach (var a in desc.Actions)
            {
                var t = new ActionTrack(a);
                tracks.Add(t);
                t.Start(totalTime);
            }
        }
Ejemplo n.º 7
0
    void WaitForNewToyEnd()
    {
        float       currentTime = Time.realtimeSinceStartup - startTime;
        ActionTrack actionTrack;
        float       timeOffset = 0.0f;

        if (startShowed)
        {
            switchSphereTransform.animation.Play("qiehuanjuese_002");

            // 六芒星消失完毕
            actionTrack           = new ActionTrack();
            actionTrack.startTime = currentTime + 0.58f;
            actionTrack.endTime   = currentTime + 0.58f;
            actionTrack.Start     = StartFadeDone;
            actionTlist.Add(actionTrack);

            timeOffset = 0.58f;
        }
        else
        {
            switchSphereTransform.animation.Play("qiehuanjuese_003");
        }


        // 主角出现
        actionTrack           = new ActionTrack();
        actionTrack.startTime = currentTime + 2.92f + timeOffset;
        actionTrack.endTime   = currentTime + 2.92f + timeOffset;
        actionTrack.Start     = PlayerComeIn;
        actionTlist.Add(actionTrack);

        // 主角播出场动画
        actionTrack           = new ActionTrack();
        actionTrack.startTime = currentTime + 5.0f + timeOffset;
        actionTrack.endTime   = currentTime + 5.0f + timeOffset;
        actionTrack.Start     = PlayerPlayAnimation;
        actionTlist.Add(actionTrack);

        // 全部搞定
        actionTrack           = new ActionTrack();
        actionTrack.startTime = currentTime + 8.42f + timeOffset;
        actionTrack.endTime   = currentTime + 8.42f + timeOffset;
        actionTrack.Start     = AllDone;
        actionTlist.Add(actionTrack);
    }
Ejemplo n.º 8
0
        private void DrawTrackOperation(Rect rect)
        {
            using (new GUILayout.AreaScope(rect))
            {
                using (new GUILayout.HorizontalScope())
                {
                    if (GUILayout.Button("+", "ButtonLeft"))
                    {
                        ActionTrack actionTrack = new ActionTrack();
                        m_GroupData.Tracks.Add(actionTrack);

                        ActionTrackDrawer trackDrawer = new ActionTrackDrawer(DrawerConfig, this);
                        trackDrawer.SetData(m_GroupData.Tracks.Count - 1, actionTrack);
                        m_TrackDrawers.Add(trackDrawer);

                        SelectTrackIndex = m_TrackDrawers.Count - 1;
                    }
                    using (new EditorGUI.DisabledGroupScope(false))
                    {
                        if (GUILayout.Button("-", "ButtonRight"))
                        {
                            if (SelectTrackIndex >= 0)
                            {
                                m_GroupData.Tracks.RemoveAt(SelectTrackIndex);
                                m_TrackDrawers.RemoveAt(SelectTrackIndex);
                            }
                            SelectTrackIndex--;
                        }
                    }
                    //using (new EditorGUI.DisabledGroupScope(false))
                    //{
                    //    if (GUILayout.Button("\u2191", "ButtonMid"))//move up
                    //    {
                    //    }
                    //}
                    //using (new EditorGUI.DisabledGroupScope(false))
                    //{
                    //    if (GUILayout.Button("\u2193", "ButtonRight"))//move down
                    //    {
                    //    }
                    //}
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 构造函数
        /// 根据轨道 action 数据,构建包含的所有action存入容器
        /// </summary>
        /// <param name="context"></param>
        /// <param name="actionTrack"></param>
        public TimelineActionTrack(IContext context, ActionTrack actionTrack, float timeScale)
        {
            SetEnv(context);

            m_ActionFactroy = context.GetObject <IActionFactory>();

            for (int i = 0; i < actionTrack.ActionsLength; i++)
            {
                ActionData actionData = actionTrack.Actions(i).Value;
                if (actionData.Platform == ActionPlatform.All || actionData.Platform == ActionPlatform.Client)
                {
                    AActionItem actionItem = m_ActionFactroy.RetainAction(actionData);
                    if (actionItem == null)
                    {
                        DebugUtility.LogError(LOG_TAG, "TimelineActionTrack::Init->item is null");
                        continue;
                    }
                    actionItem.SetEnv(context, actionData, timeScale);
                    m_ActionItems.Add(actionItem);
                }
            }
        }
Ejemplo n.º 10
0
    void Start()
    {
        startTime = Time.realtimeSinceStartup;
        buttonTex = GlobalFunctions.LoadTexture("Ui/RawTextures/ExitLevel");
        float scale  = CoreEntry.screenHeight / 1000.0f;
        float width  = 235 * scale;
        float height = 116 * scale;

        rectButton.Set(CoreEntry.screenWidth - 10 - width, CoreEntry.screenHeight - 10 - height, width, height);

        ActionTrack actionTrack;

        // 视角从普通变成广角
        actionTrack           = new ActionTrack();
        actionTrack.startTime = 0.0f;
        actionTrack.endTime   = 0.5f;
        actionTrack.Update    = FovNormalToLarge;
        actionTrack.End       = FovNormalToLargeEnd;
        actionTlist.Add(actionTrack);


        // 视角从广角变普通
        actionTrack           = new ActionTrack();
        actionTrack.startTime = 0.6f;
        actionTrack.endTime   = 1.1f;
        actionTrack.Update    = FovLargeToNormal;
        actionTlist.Add(actionTrack);

        // 球体封闭
        actionTrack           = new ActionTrack();
        actionTrack.startTime = 0.4f;
        actionTrack.endTime   = 0.7f;
        actionTrack.Update    = BlackBallClose;
        actionTrack.End       = BlackBallCloseEnd;
        actionTlist.Add(actionTrack);

        mainCamera          = CoreEntry.cameraMgr.GetMainCamera();
        mainCameraTransform = mainCamera.transform;


        GameObject switchSphere = CoreEntry.resourceMgr.InstantiateObject("Prefabs/Effect/SwitchSphere 4");

        if (switchSphere != null)
        {
            switchSphereTransform          = switchSphere.transform;
            switchSphereTransform.position = mainCameraTransform.position;

            skyBoxRenderer = GlobalFunctions.GetTransform(switchSphereTransform, "skyball 02").GetComponent <Renderer>();
            skyBoxRenderer.material.renderQueue = 5000;
            sphereRotation1 = switchSphereTransform.rotation;
            sphereRotation2 = Quaternion.LookRotation(switchSphereTransform.right, switchSphereTransform.up);
            sphereRotation3 = Quaternion.LookRotation(-switchSphereTransform.forward, switchSphereTransform.up);

            cameraAnchor = GlobalFunctions.GetTransform(switchSphereTransform, "camera_guadian");

#if true
            oldCanmerPos = cameraAnchor.position;
            oldAnchor    = mainCameraTransform.parent;
            oldFov       = mainCamera.fieldOfView;
            oldCullMask  = mainCamera.cullingMask;

            mainCameraTransform.parent        = cameraAnchor;
            mainCameraTransform.localRotation = Quaternion.identity;
            mainCameraTransform.localPosition = Vector3.zero;
#endif

            //CoreEntry.cameraMgr.MountCamera(cameraAnchor);

            switchSphereTransform.animation.Play("qiehuanjuese_000");
        }

        // 加载新角色资源
        newPlayerId = -1;

        CoreEntry.eventMgr.AddListener("changePlayerDone", OnDone);

        CoreEntry.eventMgr.TriggerEvent <bool>("showHeroSwitch", true);
    }
Ejemplo n.º 11
0
    bool WaitForNewToy(ActionTrack track, float timePass, float actionLength)
    {
        int hero = CoreEntry.portalMgr.GetCurrentHeroResId();

        if (hero == 0)
        {
            if (lastBranchStage == 2)
            {
                switchSphereTransform.animation.Play("qiehuanjuese_005");

                float       currentTime = Time.realtimeSinceStartup - startTime;
                ActionTrack actionTrack = new ActionTrack();
                actionTrack.startTime = currentTime + 0.4f;
                actionTrack.endTime   = 100000.0f;
                actionTrack.Update    = WaitForNewToy;
                actionTlist.Add(actionTrack);

                lastBranchStage = 1;
                bShowButton     = false;
                return(false);
            }
            else
            {
                if (newPlayerId != hero)
                {
                    if (newPlayerTransform != null)
                    {
                        Object.Destroy(newPlayerTransform.gameObject);
                        newPlayerTransform = null;
                    }

                    switchSphereTransform.animation.Play("qiehuanjuese_loop");
                    bShowButton = true;
                    startShowed = true;
                    newPlayerId = hero;
                }

                lastBranchStage = 1;
                return(true);
            }
        }
        else if (CoreEntry.sceneMgr.IsPlayerDied(hero))
        {
            if (lastBranchStage == 1)
            {
                switchSphereTransform.animation.Play("qiehuanjuese_004");

                float       currentTime = Time.realtimeSinceStartup - startTime;
                ActionTrack actionTrack = new ActionTrack();
                actionTrack.startTime = currentTime + 0.4f;
                actionTrack.endTime   = 100000.0f;
                actionTrack.Update    = WaitForNewToy;
                actionTlist.Add(actionTrack);

                lastBranchStage = 2;
                bShowButton     = false;
                return(false);
            }
            else
            {
                if (newPlayerId != hero)
                {
                    switchSphereTransform.animation.Play("qiehuanjuese_fail");
                    bShowButton = true;
                    newPlayerId = hero;
                    MakeNewPlayer(newPlayerId);

                    newPlayerTransform.gameObject.SetActive(true);
                    newPlayerTransform.animation.clip = null;

                    // 播放空闲动画
                    Actor actor = newPlayerTransform.GetComponent <Actor>();

                    if (actor != null)
                    {
                        actor.PlayAction("hero_dead");
                        CoreEntry.eventMgr.TriggerEvent <bool>("showHeroSwitch", true);
                    }
                }

                //if( newPlayerTransform != null )
                //	newPlayerTransform.GetComponent<Actor>().PlayAction("hero_dead");

                lastBranchStage = 2;
                return(true);
            }
        }
        else
        {
            if (PlayerDataMgr.instance.GetHeroDataByResId(hero) != null)
            {
                if (newPlayerId != hero)
                {
                    newPlayerId = hero;
                    MakeNewPlayer(hero);
                }

                lastBranchStage = 3;
                track.End       = WaitForNewToyEnd;
                bShowButton     = false;
                return(false);
            }
        }

        return(true);
    }