feat(Emitter): 给发射器添加了一个字段控制初始是否发射
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -9,6 +10,7 @@ namespace Script.Gameplay.Facility
|
|||||||
public class EmitterController : BaseFacilityController
|
public class EmitterController : BaseFacilityController
|
||||||
{
|
{
|
||||||
[Header("发射器设置")]
|
[Header("发射器设置")]
|
||||||
|
[SerializeField] private bool isEmittingOnStart = false;
|
||||||
[SerializeField] private GameObject prefabToEmit;
|
[SerializeField] private GameObject prefabToEmit;
|
||||||
[SerializeField] private Transform emitPoint;
|
[SerializeField] private Transform emitPoint;
|
||||||
[SerializeField] private Vector3 emitDirection = Vector3.forward;
|
[SerializeField] private Vector3 emitDirection = Vector3.forward;
|
||||||
@@ -18,7 +20,15 @@ namespace Script.Gameplay.Facility
|
|||||||
[SerializeField] private float destroyDelay = 5f; // 生成对象多少秒后销毁
|
[SerializeField] private float destroyDelay = 5f; // 生成对象多少秒后销毁
|
||||||
|
|
||||||
private Coroutine emitCoroutine;
|
private Coroutine emitCoroutine;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
if (isEmittingOnStart)
|
||||||
|
{
|
||||||
|
emitCoroutine = StartCoroutine(EmitRoutine());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 接收信号
|
// 接收信号
|
||||||
public override void OnSignalReceived(bool active, GameObject sender)
|
public override void OnSignalReceived(bool active, GameObject sender)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user