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

139 lines
2.6 KiB
C#

// ***********************************************************************
// Assembly : Game
// Author : Kimch
// Created : 2021-04-23
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
// <copyright file= "SkillPalm" company="Kunpo"></copyright>
// <summary></summary>
// ***********************************************************************
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace G
{
/// <summary>
/// 如来神掌
/// </summary>
public class SkillPalm : MonoBehaviour
{
public Transform rising_fire;
public Transform rising_fire2;
private Collider _collider;
private Collider _subCollider;
private bool _collisionOn;
private bool _showOn;
private float _showTime = 1.5f;
private void Awake()
{
_collider = this.GetComponent<Collider>();
_subCollider = this.transform.Find("death").GetComponent<Collider>();
}
private void OnEnable()
{
SplashOn(true, 0f, 0.1f);
}
private void Start()
{
//_collider.enabled = false;
//this.gameObject.SetActive(false);
//SplashOn(true, 0f, 0.1f);
}
/// <summary>
///
/// </summary>
/// <param name="col"></param>
/// <param name="delay2"></param>
/// <param name="delay"></param>
public void SplashOn(bool col, float delay2, float delay)
{
_collisionOn = col;
_showTime = 1.5f;
Invoke(nameof(ShowOn), delay);
}
/// <summary>
///
/// </summary>
public void SplashOff()
{
if (_collider.enabled)
{
_collider.enabled = false;
}
this.gameObject.SetActive(false);
CancelInvoke(nameof(ShowOn));
}
public void ShowOn()
{
if (_collisionOn)
{
_collider.enabled = false;
_subCollider.enabled = true;
}
//transform.position = _cha1.TransformPoint(Vector3.forward * _dis) + Vector3.up * 0.02f;
//transform.rotation = _cha1.rotation;
_showOn = true;
}
private void FixedUpdate()
{
if (!_showOn)
{
return;
}
_showTime -= Time.deltaTime;
if (_showTime > 1.3f)
{
return;
}
if (_showTime > 1f)
{
if (_subCollider.enabled)
{
_subCollider.enabled = false;
}
if (!_collider.enabled)
{
_collider.enabled = true;
}
}
else if (_showTime > 0.5f)
{
if (_collider.enabled)
{
_collider.enabled = false;
}
}
else if (_showTime > 0f)
{
if (_collider.enabled)
{
_collider.enabled = false;
}
}
else
{
this.gameObject.SetActive(false);
this.transform.position = Vector3.up * 100f;
}
}
}
}