浏览代码

Tweaked for PR Feedback- added SelfDisableScript as well as changes to Click_Feedback.cs

/main
CGerrits SF 4 年前
当前提交
d23d3482
共有 5 个文件被更改,包括 62 次插入27 次删除
  1. 14
      Assets/BossRoom/Prefabs/Click_Feedback.prefab
  2. 2
      Assets/BossRoom/Prefabs/Player.prefab
  3. 36
      Assets/BossRoom/Scripts/Client/ClickFeedback.cs
  4. 26
      Assets/SelfDisable.cs
  5. 11
      Assets/SelfDisable.cs.meta

14
Assets/BossRoom/Prefabs/Click_Feedback.prefab


- component: {fileID: 6101625250476277925}
- component: {fileID: 6375111725193425194}
- component: {fileID: 7164482062141736850}
- component: {fileID: 5754560017040867806}
m_Layer: 0
m_Name: Click_Feedback
m_TagString: Untagged

m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!114 &5754560017040867806
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9137928905311479176}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b853e11fb193c8149bd7d25b17c0ddc6, type: 3}
m_Name:
m_EditorClassIdentifier:
DisabledDelay: 0.75

2
Assets/BossRoom/Prefabs/Player.prefab


m_Script: {fileID: 11500000, guid: 2d0d8ed0724e1404d9d0afcd9b8b5ee2, type: 3}
m_Name:
m_EditorClassIdentifier:
feedbackPrefab: {fileID: 9137928905311479176, guid: 86bfc5d7bdc268842947478bcdd38c08, type: 3}
FeedbackPrefab: {fileID: 9137928905311479176, guid: 86bfc5d7bdc268842947478bcdd38c08, type: 3}
--- !u!1001 &7872000410579295758
PrefabInstance:
m_ObjectHideFlags: 0

36
Assets/BossRoom/Scripts/Client/ClickFeedback.cs


public class ClickFeedback : MonoBehaviour
{
[SerializeField]
GameObject feedbackPrefab;
private GameObject feedbackObj;
private ClientInputSender m_ClientSender;
private float lastClicked;
GameObject FeedbackPrefab;
GameObject m_FeedbackObj;
ClientInputSender m_ClientSender;
private const float HOVER_HEIGHT = .1f;
// Start is called before the first frame update
void Start()

lastClicked = Time.time;
m_FeedbackObj = Instantiate(FeedbackPrefab);
m_FeedbackObj.SetActive(false);
if (!feedbackObj)
{
feedbackObj = Instantiate(feedbackPrefab);
}
position.y += .1f;
position.y += HOVER_HEIGHT;
feedbackObj.transform.position = position;
feedbackObj.SetActive(true);
lastClicked = Time.time;
}
// Update is called once per frame
void Update()
{
if (feedbackObj && Time.time - lastClicked >= .75)
{
Destroy(feedbackObj);
feedbackObj = null;
}
m_FeedbackObj.transform.position = position;
m_FeedbackObj.SetActive(true);
}
private void OnDestroy()

26
Assets/SelfDisable.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Will Disable this game object once active after the delay duration has passed.
/// </summary>
public class SelfDisable : MonoBehaviour
{
public float DisabledDelay;
float disableTimestamp;
// Update is called once per frame
void Update()
{
if (Time.time >= disableTimestamp)
{
gameObject.SetActive(false);
}
}
void OnEnable()
{
disableTimestamp = Time.time + DisabledDelay;
}
}

11
Assets/SelfDisable.cs.meta


fileFormatVersion: 2
guid: b853e11fb193c8149bd7d25b17c0ddc6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存