Example #1
0
 void Update()
 {
     if (nextAnimation != null)
     {
         nextAnimation.Play();
         nextAnimation = null;
     }
 }
Example #2
0
    //camera chase to heroes
    public IEnumerator PlayCameraEndBattle()
    {
        List <Hero> heros = heroPlayerSet.Where(p => p.controller.actionStat != Controller.ActionStat.Dead &&
                                                p.controller.role.Base.Type == DEngine.Common.GameLogic.RoleType.Hero && p.controller.roleType != RoleType.Building).ToList();

        Vector3 lookPoint = Camera.main.transform.position;

        lookPoint.y = 0;
        foreach (Hero hero in heros)
        {
            if (hero.controller != null)
            {
                hero.controller.OnIdle();
            }

            if (hero.gameObject != null)
            {
                hero.gameObject.transform.LookAt(lookPoint);
            }
        }

        yield return(new WaitForSeconds(0.5f));

        cameraAnimEndBattle.Play();
        cameraAnimEndBattle.AnimationFinished += FinishedCameraAnimation;
    }
 void Update()
 {
     if (!isCamera)
     {
         if (playing)
         {
             UpdateAnimationTime();
             UpdateAnimation();
             UpdatePointReached();
         }
         else
         {
             if (nextAnimation != null && _percentage >= 1)
             {
                 nextAnimation.Play();
                 nextAnimation = null;
             }
         }
     }
 }
Example #4
0
 //相机移动的路径
 public void CameraMoveByPath(int pathID)
 {
     if (playAni != null)
     {
         playAni.Stop();
     }
     playAni = pathAnimator[pathID];
     if (playAni != null)
     {
         playAni.Play();
     }
 }
Example #5
0
 public void CameraMoveByPath(int pathId)
 {
     if (_playAni != null)
     {
         _playAni.Stop();
     }
     _playAni = PathAnimator[pathId];
     if (_playAni != null)
     {
         _playAni.Play();
     }
 }
 void Update()
 {
     if (Input.GetMouseButtonUp(0))
     {
         if (animator.isPlaying)
         {
             animator.Pause();
         }
         else
         {
             animator.Play();
         }
     }
     if (Input.GetMouseButtonUp(1))
     {
         animator.Seek(0);
         if (!animator.isPlaying)
         {
             animator.Play();
         }
     }
 }
Example #7
0
    void OnTriggerEnter(Collider collision)
    {
        if (collision != target) //The colliding object isn't our object
        {
            return;              //don't do anything if it's not our target
        }

        if (triggered == false)
        {
            camerapos = playercamera.transform;
            playing   = true;
            curve.Play();
        }

        triggered = true;
    }
Example #8
0
 void Start()
 {
     animator.Play();
 }
Example #9
0
    void OnGUI()
    {
        if (pathAnimator == null)
        {
            return;
        }

        if (GUILayout.Button("START"))
        {
            pathAnimator.Play();
        }
        if (GUILayout.Button("PAUSE"))
        {
            pathAnimator.Pause();
        }
        if (GUILayout.Button("STOP"))
        {
            pathAnimator.Stop();
        }
        if (GUILayout.Button("SWITCH"))
        {
            pathAnimator.Stop();
            if (pathAnimator == pathAnimatorA)
            {
                pathAnimator = pathAnimatorB;
            }
            else
            {
                pathAnimator = pathAnimatorA;
            }
            pathAnimator.Play();
        }
        if (GUILayout.Button("JUMP"))
        {
            pathAnimator.Stop();
            pathAnimator.Seek(0.75f);
            pathAnimator.Play();
        }
        if (!pathAnimator.isPlaying)
        {
            if (GUILayout.Button("REPLAY"))
            {
                if (pathAnimator.mode != CameraPathBezierAnimator.modes.reverse)
                {
                    pathAnimator.Seek(0);
                }
                else
                {
                    pathAnimator.Seek(1);
                }
                pathAnimator.Play();
            }
        }

        GUILayout.Space(10.0f);
        GUILayout.Label("ANIMATION MODE");
        GUILayout.Label("current:" + pathAnimator.mode);
        if (GUILayout.Button("FORWARD"))
        {
            pathAnimator.mode = CameraPathBezierAnimator.modes.once;
        }
        if (GUILayout.Button("REVERSE"))
        {
            pathAnimator.mode = CameraPathBezierAnimator.modes.reverse;
        }
        if (GUILayout.Button("LOOP"))
        {
            pathAnimator.mode = CameraPathBezierAnimator.modes.loop;
        }

        //Urgh! This is cheap way of doing things - better to keep this value stored somewhere instead of setting it every frame...
        CameraPathBezier bezier = pathAnimator.bezier;

        GUILayout.Space(10.0f);
        GUILayout.Label("CAMERA MODE");
        GUILayout.Label("current:" + bezier.mode);
        if (GUILayout.Button("USER CONTROLLED"))
        {
            bezier.mode = CameraPathBezier.viewmodes.usercontrolled;
        }
        if (GUILayout.Button("MOUSE LOOK"))
        {
            bezier.mode = CameraPathBezier.viewmodes.mouselook;
        }
        if (GUILayout.Button("FOLLOW PATH"))
        {
            bezier.mode = CameraPathBezier.viewmodes.followpath;
        }
        if (GUILayout.Button("REVERSE FOLLOW PATH"))
        {
            bezier.mode = CameraPathBezier.viewmodes.reverseFollowpath;
        }
    }
Example #10
0
    public virtual bool StartCameraAnim()
    {
        if (attacker.camp == CampType.Enemy)
            return false;

        // 摄像机轨迹动画
        string camParam = skilldata.Camera;
        if (camParam.Equals("null"))
            return false;

        JsonData camJson = JsonMapper.ToObject(camParam);
        if (camJson.IsArray == false)
            return false;

        //Fight.Inst.RestoreCameraParam();

        int camPathIdx = (int)camJson[0];

        camAnim = Fight.Inst.GetCameraAnim(camPathIdx);
        camAnim.animationTarget = Fight.Inst.mainCam.transform;
        camAnim.transform.position = attacker.position;
        camAnim.transform.rotation = attacker.rotation;
        camAnim.bezier._targetPosition = attacker.position + camAnim.bezier.targetPosition;

        if (camAnim.nextAnimation != null)
        {
            var ca = camAnim.nextAnimation;
            ca.animationTarget = Fight.Inst.mainCam.transform;
            //ca.transform.position = attacker.position;
            //ca.transform.rotation = attacker.rotation;
            ca.bezier.targetPosition = attacker.position + ca.bezier.targetPosition;
        }
        //GameObject bip01 = Helper.FindObjectExceptInactive(attacker.gameObject, "Bip01");
        //if (bip01 != null)
        //    camAnim.bezier.target = bip01.transform;
        //else
        //    camAnim.bezier.target = attacker.transform;
        camAnim.Play();

        Fight.Inst.SetBigSkillLight(attacker);

        // 结束摄像机动画
        float time = attacker.GetAnimLength(FireAnim);
        float outtime = (float)camJson[1];
        if (outtime > 0.001f) {
            time = outtime;
        }

        if (stopCameraAnimCoroutine != null)
            StopCoroutine(stopCameraAnimCoroutine);// 需要停止之前
        if (time > 0f)
        {
            stopCameraAnimCoroutine = DelayStopCameraAnim(time);
            StartCoroutine(stopCameraAnimCoroutine);
        }

        //StopEvent("StopCamAnim");// 需要停止之前
        //if (time > 0f)
        //{
        //    AddEvent("StopCamAnim", time, delegate
        //    {
        //        Debug.LogError("stop cam anim");
        //        StopCameraAnim();
        //    });
        //}
        //StopEvent("StopCamAnim");// 需要停止之前

        return true;
    }