void Start()
	{
		if(pathAnimatorA==null)
			return;
		
		pathAnimator = pathAnimatorA;
	}
	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;
	}
Esempio n. 3
0
 void Update()
 {
     if (nextAnimation != null)
     {
         nextAnimation.Play();
         nextAnimation = null;
     }
 }
Esempio n. 4
0
    void Start()
    {
        if (pathAnimatorA == null)
        {
            return;
        }

        pathAnimator = pathAnimatorA;
    }
Esempio n. 5
0
    public static void CreatePath()
    {
        GameObject newPath = new GameObject("New Camera Path");
        CameraPathBezierAnimator animator = newPath.AddComponent <CameraPathBezierAnimator>();

        newPath.AddComponent <CameraPathBezier>();

        if (Camera.main)
        {
            animator.animationTarget = Camera.main.transform;
        }
    }
Esempio n. 6
0
 public void CameraMoveByPath(int pathId)
 {
     if (_playAni != null)
     {
         _playAni.Stop();
     }
     _playAni = PathAnimator[pathId];
     if (_playAni != null)
     {
         _playAni.Play();
     }
 }
Esempio n. 7
0
 //相机移动的路径
 public void CameraMoveByPath(int pathID)
 {
     if (playAni != null)
     {
         playAni.Stop();
     }
     playAni = pathAnimator[pathID];
     if (playAni != null)
     {
         playAni.Play();
     }
 }
Esempio n. 8
0
 void LateUpdate()
 {
     if (playing)
     {
         UpdateAnimationTime();
         UpdateAnimation();
     }
     else
     {
         if (nextAnimation != null && _percentage >= 1)
         {
             nextAnimation.Play();
             nextAnimation = null;
         }
     }
 }
 void Update()
 {
     if (!isCamera)
     {
         if (playing)
         {
             UpdateAnimationTime();
             UpdateAnimation();
             UpdatePointReached();
         }
         else
         {
             if (nextAnimation != null && _percentage >= 1)
             {
                 nextAnimation.Play();
                 nextAnimation = null;
             }
         }
     }
 }
Esempio n. 10
0
 void LateUpdate()
 {
     if (isCamera)
     {
         if (playing)
         {
             UpdateAnimationTime();
             UpdateAnimation();
             UpdatePointReached();
             usedAnimationTime += Time.deltaTime;
         }
         else
         {
             if (nextAnimation != null && _percentage >= 1)
             {
                 nextAnimation.Play();
                 nextAnimation = null;
             }
         }
     }
 }
Esempio n. 11
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;
        }
    }
Esempio n. 12
0
 void Start()
 {
     animator = GetComponent <CameraPathBezierAnimator>();
 }
	void Start () {
		animator = GetComponent<CameraPathBezierAnimator>();
	}
 void LateUpdate()
 {
     if (isCamera)
     {
         if (playing)
         {
             UpdateAnimationTime();
             UpdateAnimation();
             UpdatePointReached();
         }
         else
         {
             if (nextAnimation != null && _percentage >= 1)
             {
                 nextAnimation.Play();
                 nextAnimation = null;
             }
         }
     }
 }
 void OnEnable()
 {
     bezierControlPoint = (CameraPathBezierControlPoint)target;
     bezier = bezierControlPoint.bezier;
     animator = bezier.GetComponent<CameraPathBezierAnimator>();
 }
 void OnEnable()
 {
     animator = (CameraPathBezierAnimator)target;
     bezier   = animator.GetComponent <CameraPathBezier>();
 }
 void OnEnable()
 {
     bezierControlPoint = (CameraPathBezierControlPoint)target;
     bezier             = bezierControlPoint.bezier;
     animator           = bezier.GetComponent <CameraPathBezierAnimator>();
 }
 void OnEnable()
 {
     animator = (CameraPathBezierAnimator)target;
     bezier = animator.GetComponent<CameraPathBezier>();
 }
Esempio n. 19
0
    protected virtual void StopCameraAnim()
    {
        if (camAnim == null)
            return;

        Time.timeScale = GameMgr.timeScale;
        camAnim.Stop();
        camAnim.gameObject.SetActive(false);
        ShowAllFriend();

        camAnim = null;
        Fight.Inst.RestoreCameraParam();

        if (table != null)
        {
            LuaMgr.CallMethod(table, "OnStopCameraAnim", table);
        }
    }
Esempio n. 20
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;
    }
Esempio n. 21
0
    public void Start(NfSkill preskill)
    {
        Time.timeScale = GameMgr.timeScale;
        transform = attacker.transform;
        animation = attacker.mAnim;
        gameObject = attacker.gameObject;

        attacker.RestoreDir();

        hit = false;
        enabled = true;
        isAddAnger = false;

        try
        {
            tiggerSkill = null;
            camAnim = null;
            preSkill = preskill;

            setHideMeshList();

            OnSkillBegin();
        }
        catch (KeyNotFoundException e)
        {
            End();
            Debug.LogError("skill(" + id + ") " + e.Message);
            Debug.LogError(e.StackTrace);

        #if UNITY_EDITOR
            MessageBox.Show("skill error", "skill(" + id + ") " + e.Message);
        #endif
        }
    }