浏览代码

Added quad for click feedback on player move

/main
CGerrits SF 4 年前
当前提交
d0f44a55
共有 6 个文件被更改,包括 196 次插入86 次删除
  1. 100
      Assets/BossRoom/Prefabs/Player.prefab
  2. 9
      Assets/BossRoom/Scripts/Client/ClientInputSender.cs
  3. 98
      Assets/BossRoom/Prefabs/Click_Feedback.prefab
  4. 7
      Assets/BossRoom/Prefabs/Click_Feedback.prefab.meta
  5. 57
      Assets/BossRoom/Scripts/Client/ClickFeedback.cs
  6. 11
      Assets/BossRoom/Scripts/Client/ClickFeedback.cs.meta

100
Assets/BossRoom/Prefabs/Player.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &606642622058593710
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 80535263913599867}
- component: {fileID: 332961461464523551}
- component: {fileID: 1396173073952796847}
m_Layer: 0
m_Name: Capsule
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &80535263913599867
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 606642622058593710}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1935255767028652502}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &332961461464523551
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 606642622058593710}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1396173073952796847
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 606642622058593710}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &1150911143890575567
GameObject:
m_ObjectHideFlags: 0

m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &1935255767028652502
Transform:
m_ObjectHideFlags: 0

m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 80535263913599867}
m_Children: []
m_Father: {fileID: 4600110157238723791}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

- component: {fileID: 6970334877957368017}
- component: {fileID: 4602672899881656135}
- component: {fileID: 7690172137830037487}
- component: {fileID: 3285811633627501599}
m_Layer: 3
m_Name: Player
m_TagString: Player

m_Script: {fileID: 11500000, guid: 797d92969c575574d868e069887e8486, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &3285811633627501599
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4600110157238723781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2d0d8ed0724e1404d9d0afcd9b8b5ee2, type: 3}
m_Name:
m_EditorClassIdentifier:
feedbackPrefab: {fileID: 9137928905311479176, guid: 86bfc5d7bdc268842947478bcdd38c08, type: 3}
--- !u!1001 &7872000410579295758
PrefabInstance:
m_ObjectHideFlags: 0

9
Assets/BossRoom/Scripts/Client/ClientInputSender.cs


using System;
using MLAPI;
using UnityEngine;

{
enabled = false;
}
}
}
public event Action<Vector3> OnClientClick;
void Awake()

{
// The MLAPI_INTERNAL channel is a reliable sequenced channel. Inputs should always arrive and be in order that's why this channel is used.
m_NetworkCharacter.InvokeServerRpc(m_NetworkCharacter.SendCharacterInputServerRpc, hit.point,
"MLAPI_INTERNAL");
"MLAPI_INTERNAL");
//Send our client only click request
OnClientClick.Invoke(hit.point);
}
}

98
Assets/BossRoom/Prefabs/Click_Feedback.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &9137928905311479176
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2500332623759108304}
- component: {fileID: 6101625250476277925}
- component: {fileID: 6375111725193425194}
- component: {fileID: 7164482062141736850}
m_Layer: 0
m_Name: Click_Feedback
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2500332623759108304
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9137928905311479176}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!33 &6101625250476277925
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9137928905311479176}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &6375111725193425194
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9137928905311479176}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!64 &7164482062141736850
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9137928905311479176}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}

7
Assets/BossRoom/Prefabs/Click_Feedback.prefab.meta


fileFormatVersion: 2
guid: 86bfc5d7bdc268842947478bcdd38c08
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

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


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BossRoom.Client
{
/**Responsible for managing and creating a feedback icon where the player clicked to move */
[RequireComponent(typeof(ClientInputSender))]
public class ClickFeedback : MonoBehaviour
{
[SerializeField]
GameObject feedbackPrefab;
private GameObject feedbackObj;
private ClientInputSender m_ClientSender;
private float lastClicked;
// Start is called before the first frame update
void Start()
{
m_ClientSender = GetComponent<ClientInputSender>();
m_ClientSender.OnClientClick += onClick;
lastClicked = Time.time;
}
void onClick(Vector3 position)
{
if (!feedbackObj)
{
feedbackObj = Instantiate(feedbackPrefab);
}
position.y += .1f;
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;
}
}
private void OnDestroy()
{
m_ClientSender.OnClientClick -= onClick;
}
}
}

11
Assets/BossRoom/Scripts/Client/ClickFeedback.cs.meta


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