ハートのTarget指定方法を変更

お客さんの向きのみ反転させるように変更
This commit is contained in:
kimura 2021-09-08 12:29:27 +09:00
parent b341647d30
commit d3f8f5064d
7 changed files with 83 additions and 4 deletions

View File

@ -5301,6 +5301,7 @@ GameObject:
m_Component:
- component: {fileID: 4886416728471897984}
- component: {fileID: 4886416728471897985}
- component: {fileID: 5450916343452979085}
m_Layer: 0
m_Name: customer_normal
m_TagString: Untagged
@ -5346,6 +5347,21 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!114 &5450916343452979085
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4886416728471897999}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0eb44b30c9454383898faae0c3666b94, type: 3}
m_Name:
m_EditorClassIdentifier:
bodySides:
- {fileID: 4886416730379292501}
- {fileID: 4886416728696845434}
--- !u!1 &4886416728477582529
GameObject:
m_ObjectHideFlags: 0

View File

@ -57,6 +57,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
animator: {fileID: 5409985851491668857}
customerDirection: {fileID: 4855338754077236085}
orderPopup: {fileID: 5409985850085678672}
leftPopcorn: {fileID: 1950136324582499262}
rightPopcorn: {fileID: 1950136324150437342}
@ -90,7 +91,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
bigHeart: {fileID: 7988005957398545984}
smallHeart: {fileID: 992423202615605163}
target: {fileID: 0}
--- !u!210 &3225622249943924906
SortingGroup:
m_ObjectHideFlags: 0
@ -215,6 +215,16 @@ PrefabInstance:
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6511433195714067906, guid: db654393793a67d45a7d0b70a68b73a6,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7358655632798716600, guid: db654393793a67d45a7d0b70a68b73a6,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8422870931014696725, guid: db654393793a67d45a7d0b70a68b73a6,
type: 3}
propertyPath: m_IsActive
@ -245,6 +255,18 @@ Animator:
type: 3}
m_PrefabInstance: {fileID: 631677504613307640}
m_PrefabAsset: {fileID: 0}
--- !u!114 &4855338754077236085 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5450916343452979085, guid: db654393793a67d45a7d0b70a68b73a6,
type: 3}
m_PrefabInstance: {fileID: 631677504613307640}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5409985851491668855}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0eb44b30c9454383898faae0c3666b94, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &5409985849609444268 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4886416730379292500, guid: db654393793a67d45a7d0b70a68b73a6,

View File

@ -37,6 +37,7 @@ public class CustomerController : MonoBehaviour
private static readonly int WalkSideEat = Animator.StringToHash("WalkSideEat");
[SerializeField] private Animator animator;
[SerializeField] private CustomerDirection customerDirection;
[SerializeField] private GameObject orderPopup;
[SerializeField] private SpriteRenderer leftPopcorn;
@ -250,8 +251,14 @@ public class CustomerController : MonoBehaviour
private void SetWayPoint(Vector3 point)
{
wayPoint = point;
wayPoint.z = wayPoint.y + Mathf.Abs(walkSideBottomPos);
transform.localRotation = Quaternion.Euler((wayPoint - transform.localPosition).x >= 0 ? Vector3.zero : Vector3.up * 180);
if ((wayPoint - transform.localPosition).x >= 0)
{
customerDirection.SetDefaultSide();
}
else
{
customerDirection.SetFlipSide();
}
}
public void ShowWantFlavor(int flavor)

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public class CustomerDirection : MonoBehaviour
{
[SerializeField] private List<Transform> bodySides = new List<Transform>();
public void SetDefaultSide()
{
foreach (var bodySide in bodySides)
{
bodySide.localRotation = Quaternion.Euler(Vector3.zero);
}
}
public void SetFlipSide()
{
foreach (var bodySide in bodySides)
{
bodySide.localRotation = Quaternion.Euler(Vector3.up * 180);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0eb44b30c9454383898faae0c3666b94
timeCreated: 1631070899

View File

@ -5,10 +5,16 @@ public class HeartAnimation : MonoBehaviour
{
[SerializeField] private GameObject bigHeart;
[SerializeField] private GameObject smallHeart;
[SerializeField] private Transform target;
private Transform target;
private float animationDelay = .3f;
private float animationDuration = .5f;
private float heartToMeterDuration = .4f;
public void SetTarget(Transform transform)
{
target = transform;
}
public void GetHeart(Action callback = null)
{
smallHeart.SetActive(false);

View File

@ -246,6 +246,7 @@ public class Market : MonoBehaviour
{
customerController.HideOrderPopup();
var heartAnimation = customerController.GetComponent<HeartAnimation>();
heartAnimation.SetTarget(HeartMeter.Instance.transform);
heartAnimation.GetHeart(() =>
{
HeartMeter.Instance.AddHeart(1);