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

74 lines
1.5 KiB
C#

// ***********************************************************************
// Assembly : Game
// Author : Kimch
// Created : 2020-09-02
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
// <copyright file= "BulletPet2" company="Kimch"></copyright>
// <summary></summary>
// ***********************************************************************
using UnityEngine;
public static class MonoEx
{
public static ParticleEmitter particleEmitter(this Transform behaviour)
{
return new ParticleEmitter();
}
}
namespace G
{
/// <summary>
///
/// </summary>
public class BulletPet2 : MonoBehaviour
{
public float delay_collision = 0.2f;
public float delay_destroy = 0.6f;
private float _delay;
private Collider _collider;
private bool _impactOn;
private void Awake()
{
_collider = this.GetComponent<Collider>();
this.gameObject.SetActive(false);
}
private void OnEnable()
{
_collider.enabled = false;
_delay = 0f;
_impactOn = false;
Vector3 forward = this.transform.forward;
forward.y = 0f;
this.transform.rotation = Quaternion.LookRotation(forward);
}
private void Update()
{
if (_delay > delay_destroy)
{
_collider.enabled = false;
this.gameObject.SetActive(false);
}
else if (!_impactOn && _delay > delay_collision)
{
EntityPet.Instance.AttackFinish();
_collider.enabled = true;
_impactOn = true;
}
_delay += Time.deltaTime;
}
}
}