浏览代码

Merge branch 'master' into vfx-demo

/main
Thomas ICHÉ 5 年前
当前提交
17c3cd7a
共有 5 个文件被更改,包括 79 次插入23 次删除
  1. 23
      Runtime/LevelScripting/Events/OnTriggerEvent.cs
  2. 37
      Runtime/LevelScripting/Logic/NTimesLogic.cs
  3. 11
      Runtime/LevelScripting/Logic/NTimesLogic.cs.meta
  4. 20
      Runtime/LevelScripting/Logic/RandomLogic.cs
  5. 11
      Runtime/LevelScripting/Logic/RandomLogic.cs.meta

23
Runtime/LevelScripting/Events/OnTriggerEvent.cs


using NaughtyAttributes;
using UnityEngine;
public int EnterMaxCount = 0;
public int ExitMaxCount = 0;
private int m_RemainingEnterCount;
private int m_RemainingExitCount;
[ReorderableList]
public Callable[] onTriggerEnter;

public bool OnlyInteractWithTag = true;
public string Tag = "Player";
void Start()
{
m_RemainingEnterCount = EnterMaxCount;
m_RemainingExitCount = ExitMaxCount;
}
if (EnterMaxCount > 0)
{
if (m_RemainingEnterCount == 0) return;
m_RemainingEnterCount--;
}
if (OnlyInteractWithTag && other.tag == Tag )
{
Callable.Call(onTriggerEnter, other.gameObject);

private void OnTriggerExit(Collider other)
{
if (ExitMaxCount > 0)
{
if (m_RemainingExitCount == 0) return;
m_RemainingExitCount--;
}
if (OnlyInteractWithTag && other.tag == Tag )
{
Callable.Call(onTriggerExit, other.gameObject);

37
Runtime/LevelScripting/Logic/NTimesLogic.cs


using NaughtyAttributes;
using System.Collections;
using UnityEngine;
using UnityEngine.Events;
namespace GameplayIngredients.Logic
{
public class NTimesLogic : LogicBase
{
[ReorderableList]
public Callable[] Calls;
[Min(1), SerializeField]
protected int Count = 1;
int m_RemainingCount;
void Awake()
{
Reset();
}
public void Reset()
{
m_RemainingCount = Count;
}
public override void Execute(GameObject instigator = null)
{
if(m_RemainingCount > 0)
{
m_RemainingCount--;
Callable.Call(Calls, instigator);
}
}
}
}

11
Runtime/LevelScripting/Logic/NTimesLogic.cs.meta


fileFormatVersion: 2
guid: e5238971271a4cd43b4a07ba72a48e09
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 6d0a734cdedf48d478f3fcc7612af66f, type: 3}
userData:
assetBundleName:
assetBundleVariant:

20
Runtime/LevelScripting/Logic/RandomLogic.cs


using NaughtyAttributes;
using System.Collections;
using UnityEngine;
using UnityEngine.Events;
namespace GameplayIngredients.Logic
{
public class RandomLogic : LogicBase
{
[ReorderableList]
public Callable[] RandomCalls;
public override void Execute(GameObject instigator = null)
{
int r = Random.Range(0, RandomCalls.Length);
Callable.Call(RandomCalls[r], instigator);
}
}
}

11
Runtime/LevelScripting/Logic/RandomLogic.cs.meta


fileFormatVersion: 2
guid: 0de0c9f608a44664f8864259a781085e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 6d0a734cdedf48d478f3fcc7612af66f, type: 3}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存