// 移動中処理 void Translate() { // 移動処理 float t = m_TransCnt / m_TransTimeSec; gameObject.transform.position = Vector3.Lerp(m_LeavePos, m_MovePos, t); m_TransCnt += Time.deltaTime; // 移動が終わった if (m_TransCnt > m_TransTimeSec) { m_TransCnt = 0.0f; //m_CameraObj.transform.position = m_MovePos; m_Trans = PlayerTrans.Attack; } }
// Use this for initialization void Start() { m_TransCnt = 0; m_CameraObj = GameObject.Find("Camera (eye)"); m_OriginPos = m_CameraObj.transform.position; m_LeavePos = m_OriginPos; m_EnemyObjs = new GameObject[2]; m_EnemyObjs[0] = gameObject; m_EnemyObjs[1] = gameObject; m_Trans = PlayerTrans.Attack; m_HitPoint = m_MaxHitPoint; m_DamageCamera.m_DamageProductionSec = m_DamageSec; }
/// <summary> /// 敵の近づく際の命令 /// </summary> public void Proximity(HandData hand) { switch (hand) { case HandData.Right: m_MovePos = m_EnemyObjs[0].transform.position; break; case HandData.Left: m_MovePos = m_EnemyObjs[1].transform.position; break; } Vector3 interpolation = transform.position - m_MovePos; interpolation = interpolation.normalized * 1.5f; m_MovePos += interpolation; interpolation.y = 0.0f; m_LeavePos = gameObject.transform.position; m_Trans = PlayerTrans.Translate; }
/// <summary> /// 敵から離れる時の命令 /// </summary> public void LongDistance() { m_LeavePos = gameObject.transform.position; m_MovePos = m_OriginPos; m_Trans = PlayerTrans.Translate; }