67 lines
1.5 KiB
C#
67 lines
1.5 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2020-09-02
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "Bullet_arrowshower" company="Kimch"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace G
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 范围箭
|
|||
|
/// </summary>
|
|||
|
public class Bullet_arrowshower : MonoBehaviour
|
|||
|
{
|
|||
|
public Transform sub_arrow;
|
|||
|
public float arrowRange = 0.5f;
|
|||
|
public int arrowCount = 4;
|
|||
|
|
|||
|
private EnemyDamage _wd;
|
|||
|
private bool _createSub;
|
|||
|
|
|||
|
private void CreateSub()
|
|||
|
{
|
|||
|
for (int i = 0; i < arrowCount; i++)
|
|||
|
{
|
|||
|
var subArrowPos = Random.insideUnitSphere * arrowRange + transform.position;
|
|||
|
var c_arrow = Object.Instantiate(sub_arrow, subArrowPos, transform.rotation);
|
|||
|
c_arrow.GetComponent<EnemyDamage>().PressDamage(_wd.damage);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
_wd = GetComponent<EnemyDamage>();
|
|||
|
}
|
|||
|
|
|||
|
private void OnEnable()
|
|||
|
{
|
|||
|
_createSub = false;
|
|||
|
}
|
|||
|
|
|||
|
private void Update()
|
|||
|
{
|
|||
|
if (!_createSub)
|
|||
|
{
|
|||
|
_createSub = true;
|
|||
|
CreateSub();
|
|||
|
}
|
|||
|
|
|||
|
Vector3 position = transform.position;
|
|||
|
if (position.y > 0.2f)
|
|||
|
{
|
|||
|
transform.position = position - (Vector3.up * Time.deltaTime * 3f);
|
|||
|
return;
|
|||
|
}
|
|||
|
this.gameObject.SetActive(false);
|
|||
|
transform.position = Vector3.one * 16f;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|