Week11
1.讓槍(使用手把)在射擊時可以給予回饋
程式碼的部分就是在第三週時所交的課程內容
程式碼內容:
using System.Collections;using System.Collections.Generic;
using UnityEngine;
using Valve.VR;
public class steamVR : MonoBehaviour
{
public SteamVR_Action_Boolean triggerDown;
public SteamVR_Action_Vibration hapticAction;
public SteamVR_Action_Single squeezeAction;
public SteamVR_Action_Vector2 touchpadTouch;
// Start is called before the first frame update
void Update()
{
if (triggerDown.GetState(SteamVR_Input_Sources.Any))
{
hapticAction.Execute(0, 1, 150, 75, SteamVR_Input_Sources.LeftHand);
print("triggerDown");
}
float triggerValue = squeezeAction.GetAxis(SteamVR_Input_Sources.Any);
Vector2 padPos = touchpadTouch.GetAxis(SteamVR_Input_Sources.Any);
if (triggerValue > 0.0f)
{
print(triggerValue);
}
if (padPos != Vector2.zero)
{
print(padPos);
}
}
}
2.找出VR化的優點
讓遊戲VR化後,可以有更真實的體驗感,而手把給予回饋的同時,
會讓人覺得自己能在這遊戲中練習射擊精準度外,同時可以讓人
感覺到與2D遊戲不同的感覺
3.遊戲執行會有的部分
(1) 鴨子原本可能在地上跑
if(被射擊到){
就往上飛
}
(2) if(打到鴨子)
{
加一分
}
else
{
狗狗會出來笑你
}
沒有留言:
張貼留言