Created
February 12, 2019 17:10
-
-
Save chittai/ecf87d7ef142cdcf67e6d6b2820ebb8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using VRM; | |
public class Running : MonoBehaviour { | |
Vector3 _girlStartScale; | |
Vector3 _girlPosition; | |
Animator _animator; | |
VRMBlendShapeProxy _proxy; | |
// Use this for initialization | |
void Start () { | |
_girlStartScale = new Vector3(1, 1, 1); | |
_girlPosition = transform.position; | |
_animator = GetComponent<Animator>(); | |
_proxy = GetComponent<VRMBlendShapeProxy>(); | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
if (Input.GetMouseButtonDown(0)) | |
{ | |
_animator.enabled = true; | |
StartCoroutine("RunningCoroutine"); | |
} | |
} | |
IEnumerator RunningCoroutine() | |
{ | |
var _scaleValue = 15; | |
var _positionYValue = -23.4f; | |
var _positionZValue = 3f; | |
Vector3 _girlMaxScale = new Vector3(_scaleValue, _scaleValue, _scaleValue); | |
Vector3 _girlMaxPosition = new Vector3(transform.position.x, _positionYValue, transform.position.z + _positionZValue); | |
float _propotion = 0f; | |
float _speed = 0.01f; | |
while (_propotion < 1) | |
{ | |
transform.position = Vector3.Lerp(_girlPosition, _girlMaxPosition, _propotion); | |
transform.localScale = Vector3.Lerp(_girlStartScale, _girlMaxScale, _propotion); | |
yield return null; | |
if (_propotion >= 0.1f) | |
_speed = 0.025f; | |
_propotion += _speed; | |
} | |
_animator.enabled = false; | |
_proxy.SetValue("OUT", 1.0f); | |
var cameraShake = GameObject.Find("HoloPlay Capture").GetComponent<CameraShake>(); | |
cameraShake.Shake(0.5f, 0.2f); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment