54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
// ***********************************************************************
|
|
// Assembly : Game
|
|
// Author : Kimch
|
|
// Created : 2020-09-02
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "Bullet_tornado_b" company="Kimch"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
using UnityEngine;
|
|
|
|
namespace G
|
|
{
|
|
/// <summary>
|
|
/// 龙卷风
|
|
/// </summary>
|
|
public class Bullet_tornado_b : MonoBehaviour
|
|
{
|
|
private Vector3 _originScale;
|
|
|
|
private void Awake()
|
|
{
|
|
_originScale = transform.localScale;
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
this.transform.localScale = _originScale;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
this.GetComponent<Animation>()["tornado"].speed = 0.3f;
|
|
this.transform.position += this.transform.forward * 0.1f;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
float delta = 0.5f * Time.deltaTime;
|
|
this.transform.position += this.transform.forward * delta;
|
|
this.transform.localScale += new Vector3(-5f * delta, delta, -5f * delta);
|
|
Vector3 localScale = transform.localScale;
|
|
|
|
if (localScale.y > 4f)
|
|
{
|
|
this.transform.position = Vector3.one * 5f;
|
|
this.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
}
|