2025-05-18 01:04:31 +08:00

51 lines
1.1 KiB
C#

// ***********************************************************************
// Assembly : Unity
// Author : Kimch
// Created : 2017-11-14
//
// Last Modified By : Kimch
// Last Modified On :
// ***********************************************************************
// <copyright file= "Shadow" company=""></copyright>
// <summary></summary>
// ***********************************************************************
using UnityEngine;
namespace G
{
/// <summary>
/// 影子
/// </summary>
public class Shadow : MonoBehaviour
{
private Transform _parent;
public void PickParent(Transform parent, float shadowScale)
{
_parent = parent;
this.transform.localScale = Vector3.one * shadowScale;
}
public void Finish()
{
_parent = null;
this.transform.position = Vector3.one * 3f;
this.gameObject.SetActive(false);
}
private void LateUpdate()
{
if (_parent)
{
var shadowPos = _parent.position;
shadowPos.y = 0f;
this.transform.position = shadowPos;
}
else
{
Finish();
}
}
}
}