浏览代码

Further tweaks to click feedback

/main
CGerrits SF 4 年前
当前提交
63336deb
共有 6 个文件被更改,包括 127 次插入27 次删除
  1. 2
      Assets/BossRoom/Prefabs/Click_Feedback.prefab
  2. 88
      Assets/BossRoom/Scripts/Client/Game/Character/CharacterSwap.cs
  3. 11
      Assets/BossRoom/Scripts/Client/Game/Character/CharacterSwap.cs.meta
  4. 27
      Assets/BossRoom/Scripts/Client/Game/SelfDisable.cs
  5. 26
      Assets/SelfDisable.cs
  6. 0
      /Assets/BossRoom/Scripts/Client/Game/SelfDisable.cs.meta

2
Assets/BossRoom/Prefabs/Click_Feedback.prefab


m_Script: {fileID: 11500000, guid: b853e11fb193c8149bd7d25b17c0ddc6, type: 3}
m_Name:
m_EditorClassIdentifier:
DisabledDelay: 0.75
m_DisabledDelay: 0.75

88
Assets/BossRoom/Scripts/Client/Game/Character/CharacterSwap.cs


using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
namespace BossRoom.Client
{
//DEBUG SCRIPT: Meant to serve as a placeholder to allow artists to quickly cycle through player models.
public class CharacterSwap : MonoBehaviour
{
[System.SerializableAttribute]
public class CharacterModelSet
{
public GameObject ears;
public GameObject head;
public GameObject mouth;
public GameObject hair;
public GameObject eyes;
public GameObject torso;
public GameObject gear_right_hand;
public GameObject gear_left_hand;
public GameObject hand_right;
public GameObject hand_left;
public GameObject shoulder_right;
public GameObject shoulder_left;
public void setFullActive(bool isActive)
{
ears.SetActive(isActive);
head.SetActive(isActive);
mouth.SetActive(isActive);
hair.SetActive(isActive);
eyes.SetActive(isActive);
torso.SetActive(isActive);
gear_left_hand.SetActive(isActive);
hand_right.SetActive(isActive);
hand_left.SetActive(isActive);
shoulder_right.SetActive(isActive);
shoulder_left.SetActive(isActive);
gear_left_hand.SetActive(isActive);
gear_right_hand.SetActive(isActive);
}
}
[SerializeField]
int m_ModelIndex;
int m_lastModelIndex;
public CharacterModelSet[] characterModels;
void Awake()
{
if (m_ModelIndex >= characterModels.Length)
{
m_ModelIndex = 0;
}
SwapToModel(m_ModelIndex);
}
public void SwapToModel(int idx)
{
if (idx >= characterModels.Length)
{
print("Index out of bounds");
return;
}
for (int x = 0; x < characterModels.Length; x++)
{
characterModels[x].setFullActive(x == idx);
}
}
// Update is called once per frame
void Update()
{
if (m_lastModelIndex != m_ModelIndex)
{
m_lastModelIndex = m_ModelIndex;
SwapToModel(m_ModelIndex);
}
}
}
}

11
Assets/BossRoom/Scripts/Client/Game/Character/CharacterSwap.cs.meta


fileFormatVersion: 2
guid: a3048059d1dc86848a814084448ace11
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

27
Assets/BossRoom/Scripts/Client/Game/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
{
[SerializeField]
float m_DisabledDelay;
float m_DisableTimestamp;
// Update is called once per frame
void Update()
{
if (Time.time >= m_DisableTimestamp)
{
gameObject.SetActive(false);
}
}
void OnEnable()
{
m_DisableTimestamp = Time.time + m_DisabledDelay;
}
}

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;
}
}

/Assets/SelfDisable.cs.meta → /Assets/BossRoom/Scripts/Client/Game/SelfDisable.cs.meta

正在加载...
取消
保存