浏览代码

Added Random Toggle Action

/main
Thomas ICHÉ 6 年前
当前提交
4fae75e9
共有 2 个文件被更改,包括 34 次插入0 次删除
  1. 23
      Runtime/Actions/RandomToggleGameObjectAction.cs
  2. 11
      Runtime/Actions/RandomToggleGameObjectAction.cs.meta

23
Runtime/Actions/RandomToggleGameObjectAction.cs


using NaughtyAttributes;
using UnityEngine;
namespace GameplayIngredients.Actions
{
public class RandomToggleGameObjectAction : ActionBase
{
[ReorderableList]
public GameObject[] Targets;
public override void Execute(GameObject instigator = null)
{
var random = Targets[Random.Range(0,Targets.Length)];
foreach (var target in Targets)
{
if (target != null)
target.SetActive(random == target);
}
}
}
}

11
Runtime/Actions/RandomToggleGameObjectAction.cs.meta


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