Skip to content

Instantly share code, notes, and snippets.

@TSUMIKISEISAKU
Created September 7, 2023 05:10
Show Gist options
  • Save TSUMIKISEISAKU/1e8ad7f9d10ab01633437bef1d284b9b to your computer and use it in GitHub Desktop.
Save TSUMIKISEISAKU/1e8ad7f9d10ab01633437bef1d284b9b to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// コンクリート破砕デモ用入力取得
/// </summary>
public class ConcreteBreakTrigger_Demo : MonoBehaviour
{
[SerializeField, Tooltip("コンクリートへのダメージ適用(オプション)")]
private DamageApplier _damageApplier;
[SerializeField, Tooltip("破片のパーティクルの制御")]
private ConcreteParticlesHandler _particleHandler;
[SerializeField, Tooltip("効果音")]
private AudioSource _sfxSource;
[SerializeField, Tooltip("コントローラーの入力取得")]
private ControllerInputHandler _controllerInputHandler;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (_controllerInputHandler.RightTriggerDown())
{
_sfxSource.Play();
}
else if (_controllerInputHandler.RightTriggerUp())
{
_sfxSource.Stop();
_particleHandler.Stop();
}
if (_controllerInputHandler.RightTriggerHold())
{
_controllerInputHandler.VibrateRightController();
_controllerInputHandler.VibrateLeftController();
_damageApplier?.ApplyDamage(true);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment