Merge branch 'main' of 121.165.94.243:capers/bluewater into NTG
This commit is contained in:
commit
72c961dbc4
File diff suppressed because it is too large
Load Diff
@ -30,6 +30,12 @@ namespace BlueWaterProject
|
||||
public GameObject mouseSpot;
|
||||
public GameObject boat;
|
||||
public GameObject assaultCard;
|
||||
public GameObject radarTargetUi;
|
||||
|
||||
[Title("DataBase", "Particle")]
|
||||
public GameObject nukeFire;
|
||||
public GameObject grenadeFire;
|
||||
|
||||
|
||||
[Title("DataBase", "Sprites")]
|
||||
public Sprite[] cardType;
|
||||
|
37
BlueWater/Assets/02.Scripts/Player/Canon.cs
Normal file
37
BlueWater/Assets/02.Scripts/Player/Canon.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using Blobcreate.ProjectileToolkit;
|
||||
using UnityEngine;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace BlueWaterProject
|
||||
{
|
||||
public class Canon : MonoBehaviour
|
||||
{
|
||||
public float power;
|
||||
public float reloadTime;
|
||||
public GameObject radarTargetUI;
|
||||
|
||||
public Rigidbody projectilePrefab;
|
||||
public Transform launchPoint;
|
||||
public float timeOfFlight = 1f;
|
||||
public Transform predictedPos;
|
||||
|
||||
private void Init()
|
||||
{
|
||||
projectilePrefab = DataManager.Inst.grenadeFire.GetComponent<Rigidbody>();
|
||||
launchPoint = transform.Find("FirePoint");
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
public void Fire()
|
||||
{
|
||||
var myRigid = Instantiate(projectilePrefab, launchPoint.position, launchPoint.rotation);
|
||||
var v = Projectile.VelocityByTime(myRigid.transform.position, predictedPos.position, timeOfFlight);
|
||||
myRigid.AddForce(v, ForceMode.VelocityChange);
|
||||
}
|
||||
}
|
||||
}
|
11
BlueWater/Assets/02.Scripts/Player/Canon.cs.meta
Normal file
11
BlueWater/Assets/02.Scripts/Player/Canon.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e8c36fe9172849798f9c4fd87b77ec7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,3 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Blobcreate.ProjectileToolkit;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
@ -14,9 +16,6 @@ namespace BlueWaterProject
|
||||
private Rigidbody rb;
|
||||
private Vector2 movementInput;
|
||||
|
||||
[Title("Child Object")]
|
||||
private GameObject character;
|
||||
|
||||
[Title("쉽의 기본 설정")]
|
||||
[Tooltip("최대 스피드")]
|
||||
public float maxSpeed = 10f;
|
||||
@ -28,6 +27,7 @@ namespace BlueWaterProject
|
||||
public float turnSpeed = 10f;
|
||||
|
||||
[Title("캐릭터의 기본 설정")]
|
||||
private GameObject character;
|
||||
[Tooltip("캐릭터의 이동 속도")]
|
||||
public float characterSpeed = 10f;
|
||||
|
||||
@ -36,6 +36,13 @@ namespace BlueWaterProject
|
||||
public Transform[] inCameraRadar = new Transform[10];
|
||||
public Transform target;
|
||||
|
||||
[Title("캐논")]
|
||||
public Rigidbody projectilePrefab;
|
||||
public Transform launchPoint;
|
||||
public float timeOfFlight;
|
||||
public Transform predictedPos;
|
||||
public List<Canon> Canons { get; } = new (GlobalValue.MAX_CANON_COUNT);
|
||||
|
||||
public bool IsAssaultMode { get; set; }
|
||||
public bool IsInShipMode { get; set; }
|
||||
public bool IsDredgeMode { get; set; }
|
||||
@ -53,7 +60,12 @@ namespace BlueWaterProject
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
CanonInit();
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (IsInShipMode)
|
||||
@ -132,7 +144,7 @@ namespace BlueWaterProject
|
||||
|
||||
private void OnInteractionE(InputValue value)
|
||||
{
|
||||
Fire();
|
||||
UiManager.Inst.CheckRadarOverlap();
|
||||
}
|
||||
|
||||
private void OnInteraction(InputValue value) //F
|
||||
@ -168,7 +180,9 @@ namespace BlueWaterProject
|
||||
{
|
||||
UiManager.Inst.AddCard();
|
||||
}
|
||||
|
||||
|
||||
#region TakeAim & Fire
|
||||
|
||||
private void OnTakeAim(InputValue value) // Space
|
||||
{
|
||||
SwitchTakeAim(!IsTakeAim);
|
||||
@ -195,16 +209,11 @@ namespace BlueWaterProject
|
||||
UiManager.Inst.AimOnOff(isOn);
|
||||
}
|
||||
|
||||
[SerializeField] Rigidbody projectilePrefab;
|
||||
[SerializeField] Transform launchPoint;
|
||||
[SerializeField] float timeOfFlight;
|
||||
[SerializeField] Transform predictedPos;
|
||||
|
||||
private void Fire()
|
||||
#endregion
|
||||
|
||||
private void CanonInit()
|
||||
{
|
||||
var myRigid = Instantiate(projectilePrefab, launchPoint.position, launchPoint.rotation);
|
||||
var v = Projectile.VelocityByTime(myRigid.transform.position, predictedPos.position, timeOfFlight);
|
||||
myRigid.AddForce(v, ForceMode.VelocityChange);
|
||||
GetComponentsInChildren(Canons);
|
||||
}
|
||||
}
|
||||
}
|
8
BlueWater/Assets/02.Scripts/Ui.meta
Normal file
8
BlueWater/Assets/02.Scripts/Ui.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e5e4b4be23064a139346ef906143f46
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
21
BlueWater/Assets/02.Scripts/Ui/RadarNeedle.cs
Normal file
21
BlueWater/Assets/02.Scripts/Ui/RadarNeedle.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace BlueWaterProject
|
||||
{
|
||||
public class RadarNeedle : MonoBehaviour
|
||||
{
|
||||
[field: SerializeField]
|
||||
[field: Tooltip("바늘 회전 속도 \n 360 = 1초에 1바퀴 \n 음수는 시계방향")]
|
||||
public float RotationSpeed { get; set; }
|
||||
private float currentRotationZ = 0f;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
currentRotationZ += RotationSpeed * Time.deltaTime;
|
||||
currentRotationZ = currentRotationZ % 360; // 360을 초과하지 않도록
|
||||
transform.eulerAngles = new Vector3(0, 0, currentRotationZ);
|
||||
}
|
||||
}
|
||||
}
|
11
BlueWater/Assets/02.Scripts/Ui/RadarNeedle.cs.meta
Normal file
11
BlueWater/Assets/02.Scripts/Ui/RadarNeedle.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b9354e94ca0743c98216572c03343d5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
33
BlueWater/Assets/02.Scripts/Ui/RadarTargetUI.cs
Normal file
33
BlueWater/Assets/02.Scripts/Ui/RadarTargetUI.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace BlueWaterProject
|
||||
{
|
||||
public class RadarTargetUI : MonoBehaviour
|
||||
{
|
||||
public float RotationZ { get; private set; }
|
||||
public Image Image { get; private set; }
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
Image = GetComponent<Image>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
transform.rotation = Quaternion.Euler(0, 0, RotationZ + Image.fillAmount * -180);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 레이더 타겟 초기화 (노란색 부분)
|
||||
/// </summary>
|
||||
/// <param name="rotation">위치 조절</param>
|
||||
/// <param name="fillAmount">크기 조절 0.1 = 360의 10퍼센트</param>
|
||||
public void RadarTargetInit(float rotation, float fillAmount)
|
||||
{
|
||||
RotationZ = rotation;
|
||||
Image.fillAmount = fillAmount;
|
||||
}
|
||||
}
|
||||
}
|
11
BlueWater/Assets/02.Scripts/Ui/RadarTargetUI.cs.meta
Normal file
11
BlueWater/Assets/02.Scripts/Ui/RadarTargetUI.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2318ac00dd2af443a8f5b7d0960ce541
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
123
BlueWater/Assets/02.Scripts/Ui/UiManager.cs
Normal file
123
BlueWater/Assets/02.Scripts/Ui/UiManager.cs
Normal file
@ -0,0 +1,123 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Doozy.Runtime.Reactor.Animators;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace BlueWaterProject
|
||||
{
|
||||
public class UiManager : Singleton<UiManager>
|
||||
{
|
||||
[Title("Card")]
|
||||
private Transform cardLayoutGroup;
|
||||
public UIAnimator CardLayoutGroupAnimator { get; set; }
|
||||
|
||||
[Title("TakeAim")]
|
||||
private GameObject takeAim;
|
||||
private Texture2D cursorTexture;
|
||||
private bool isTakeAim;
|
||||
|
||||
[Title("Radar")]
|
||||
private Transform radar;
|
||||
private Transform radarTargets;
|
||||
public List<RadarTargetUI> RadarTargetUis { get; } = new (GlobalValue.MAX_CANON_COUNT);
|
||||
public RadarNeedle RadarNeedle { get; private set; }
|
||||
|
||||
|
||||
private void Init()
|
||||
{
|
||||
cardLayoutGroup = transform.Find("CardLayoutGroup");
|
||||
CardLayoutGroupAnimator = cardLayoutGroup.GetComponent<UIAnimator>();
|
||||
takeAim = transform.Find("Aim").gameObject;
|
||||
|
||||
radar = transform.Find("Radar");
|
||||
radarTargets = radar.Find("RadarTargets");
|
||||
|
||||
RadarNeedle = radar.Find("RadarNeedle").GetComponent<RadarNeedle>();
|
||||
}
|
||||
|
||||
protected override void OnAwake()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
CursorTextureChange();
|
||||
AssaultCardInit();
|
||||
|
||||
for (var i = 0; i < GameManager.Inst.player.Canons.Count; i++)
|
||||
{
|
||||
RadarTargetInit();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddCard() //TODO Test button and function, delete later
|
||||
{
|
||||
Instantiate(DataManager.Inst.assaultCard, cardLayoutGroup);
|
||||
}
|
||||
|
||||
public void AimOnOff(bool isOn)
|
||||
{
|
||||
takeAim.SetActive(isOn);
|
||||
isTakeAim = isOn;
|
||||
}
|
||||
|
||||
private void CursorTextureChange()
|
||||
{
|
||||
cursorTexture = DataManager.Inst.cursorTexture;
|
||||
//var hotSpot = new Vector2(cursorTexture.width / 2f, cursorTexture.height / 2f);
|
||||
var hotSpot = Vector2.zero;
|
||||
Cursor.SetCursor(cursorTexture, hotSpot, CursorMode.Auto);
|
||||
}
|
||||
|
||||
private void AssaultCardInit()
|
||||
{
|
||||
for (int i = 0; i < DataManager.Inst.CardList.Count; i++)
|
||||
{
|
||||
var obj = Instantiate(DataManager.Inst.assaultCard, cardLayoutGroup);
|
||||
var draggableCard = obj.GetComponent<DraggableCard>();
|
||||
draggableCard.card = DataManager.Inst.GetCardDictionaryFromKey(DataManager.Inst.CardList[i]);
|
||||
draggableCard.CardInit();
|
||||
}
|
||||
}
|
||||
|
||||
public void RadarTargetInit()
|
||||
{
|
||||
var obj = Instantiate(DataManager.Inst.radarTargetUi, radarTargets);
|
||||
var radarTargetUi = obj.GetComponent<RadarTargetUI>();
|
||||
radarTargetUi.RadarTargetInit(Random.Range(0f, 360f), Random.Range(0.1f, 0.2f));
|
||||
RadarTargetUis.Add(radarTargetUi);
|
||||
}
|
||||
|
||||
public void CheckRadarOverlap()
|
||||
{
|
||||
var needleRotationZ = RadarNeedle.transform.eulerAngles.z;
|
||||
|
||||
for (var i = 0; i < RadarTargetUis.Count; i++)
|
||||
{
|
||||
var radarTargetUI = RadarTargetUis[i];
|
||||
var startAngle = radarTargetUI.RotationZ;
|
||||
var endAngle = radarTargetUI.RotationZ + radarTargetUI.Image.fillAmount * 360f;
|
||||
|
||||
// 각도 비교 및 허용 오차 추가
|
||||
if (IsOverlap(needleRotationZ, startAngle, endAngle, GlobalValue.RADAR_OVERLAP_TOLERANCE)) // 5도의 오차 허용
|
||||
{
|
||||
radarTargetUI.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsOverlap(float needleRotation, float startAngle, float endAngle, float tolerance = 0)
|
||||
{
|
||||
// 오프셋 보정 예시
|
||||
var correctedNeedleRotation = needleRotation + 36;
|
||||
|
||||
return correctedNeedleRotation >= (startAngle - tolerance) && correctedNeedleRotation <= (endAngle + tolerance);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
using Doozy.Runtime.Reactor.Animators;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace BlueWaterProject
|
||||
{
|
||||
public class UiManager : Singleton<UiManager>
|
||||
{
|
||||
[Title("Card")]
|
||||
private Transform cardLayoutGroup;
|
||||
public UIAnimator CardLayoutGroupAnimator { get; set; }
|
||||
|
||||
[Title("TakeAim")]
|
||||
private GameObject takeAim;
|
||||
private Texture2D cursorTexture;
|
||||
private bool isTakeAim;
|
||||
|
||||
private void Init()
|
||||
{
|
||||
cardLayoutGroup = transform.Find("CardLayoutGroup");
|
||||
CardLayoutGroupAnimator = cardLayoutGroup.GetComponent<UIAnimator>();
|
||||
takeAim = transform.Find("Aim").gameObject;
|
||||
}
|
||||
|
||||
protected override void OnAwake()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
CursorTextureChange();
|
||||
AssaultCardInit();
|
||||
}
|
||||
|
||||
public void AddCard() //TODO Test button and function, delete later
|
||||
{
|
||||
Instantiate(DataManager.Inst.assaultCard, cardLayoutGroup);
|
||||
}
|
||||
|
||||
public void AimOnOff(bool isOn)
|
||||
{
|
||||
takeAim.SetActive(isOn);
|
||||
isTakeAim = isOn;
|
||||
}
|
||||
|
||||
private void CursorTextureChange()
|
||||
{
|
||||
cursorTexture = DataManager.Inst.cursorTexture;
|
||||
//var hotSpot = new Vector2(cursorTexture.width / 2f, cursorTexture.height / 2f);
|
||||
var hotSpot = Vector2.zero;
|
||||
Cursor.SetCursor(cursorTexture, hotSpot, CursorMode.Auto);
|
||||
}
|
||||
|
||||
private void AssaultCardInit()
|
||||
{
|
||||
for (int i = 0; i < DataManager.Inst.CardList.Count; i++)
|
||||
{
|
||||
var obj = Instantiate(DataManager.Inst.assaultCard, cardLayoutGroup);
|
||||
var draggableCard = obj.GetComponent<DraggableCard>();
|
||||
draggableCard.card = DataManager.Inst.GetCardDictionaryFromKey(DataManager.Inst.CardList[i]);
|
||||
draggableCard.CardInit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,12 @@ namespace BlueWaterProject
|
||||
public const int ISLAND_DATA_CAPACITY = 50;
|
||||
public const int ONE_UNIT_CAPACITY = 16;
|
||||
public const int AI_ANIMATOR_CAPACITY = 10;
|
||||
|
||||
|
||||
public const int MAX_CANON_COUNT = 5;
|
||||
|
||||
/// <summary> Radar 바늘이 레이더에 겹치는 허용 범위 </summary>
|
||||
public const float RADAR_OVERLAP_TOLERANCE = 5f;
|
||||
|
||||
public enum UnitType
|
||||
{
|
||||
NONE = -1,
|
||||
|
102
BlueWater/Assets/05.Prefabs/Particles/ShadowMissileOBJ.prefab
Normal file
102
BlueWater/Assets/05.Prefabs/Particles/ShadowMissileOBJ.prefab
Normal file
@ -0,0 +1,102 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &128572
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 450904}
|
||||
- component: {fileID: 13576440}
|
||||
- component: {fileID: 5479992}
|
||||
- component: {fileID: 11464288}
|
||||
m_Layer: 0
|
||||
m_Name: ShadowMissileOBJ
|
||||
m_TagString: Missile
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &450904
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 128572}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 8.313633, y: 5.892903, z: -13.319157}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!135 &13576440
|
||||
SphereCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 128572}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Radius: 0.15
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!54 &5479992
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 128572}
|
||||
serializedVersion: 4
|
||||
m_Mass: 1
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_CenterOfMass: {x: 0, y: 0, z: 0}
|
||||
m_InertiaTensor: {x: 1, y: 1, z: 1}
|
||||
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ImplicitCom: 1
|
||||
m_ImplicitTensor: 1
|
||||
m_UseGravity: 1
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 1
|
||||
m_Constraints: 0
|
||||
m_CollisionDetection: 0
|
||||
--- !u!114 &11464288
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 128572}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: acd27932048c3254597a02078fa2cb26, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
impactParticle: {fileID: 1282100793984216, guid: 41aeb961c68cf3d49be047342faf77b8,
|
||||
type: 3}
|
||||
projectileParticle: {fileID: 150356, guid: a9286d9ebf8c6b947917ec3f20e96819, type: 3}
|
||||
muzzleParticle: {fileID: 150312, guid: da454a5cc69c9464aa8eae6b8492536e, type: 3}
|
||||
colliderRadius: 0.1
|
||||
collideOffset: 0.1
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38edcd2a0a09548ecbfe4d1a0c129002
|
||||
timeCreated: 1552177093
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
BlueWater/Assets/05.Prefabs/Player.meta
Normal file
8
BlueWater/Assets/05.Prefabs/Player.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c4eff975f0a94ebdbccbcb3001bc3f3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
136
BlueWater/Assets/05.Prefabs/Player/SM_Prop_Cannon_01 (3).prefab
Normal file
136
BlueWater/Assets/05.Prefabs/Player/SM_Prop_Cannon_01 (3).prefab
Normal file
@ -0,0 +1,136 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1552059112848199257
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1055643547297219040}
|
||||
- component: {fileID: 2556788256821959539}
|
||||
m_Layer: 7
|
||||
m_Name: FirePoint
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: -5442936267250999957, guid: 0000000000000000d000000000000000, type: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1055643547297219040
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1552059112848199257}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.23903932, y: 0.67399514, z: 0.21174636, w: 0.6661488}
|
||||
m_LocalPosition: {x: -0.012, y: 0.818, z: 1.822}
|
||||
m_LocalScale: {x: 1.4093482, y: 1.4093485, z: 1.4093487}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2155776711209515616}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2556788256821959539
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1552059112848199257}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3e8c36fe9172849798f9c4fd87b77ec7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
power: 0
|
||||
reloadTime: 0
|
||||
projectilePrefab: {fileID: 0}
|
||||
launchPoint: {fileID: 0}
|
||||
timeOfFlight: 1
|
||||
predictedPos: {fileID: 0}
|
||||
--- !u!1 &4836829392273355565
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2155776711209515616}
|
||||
- component: {fileID: 244436262679622758}
|
||||
- component: {fileID: 1460342609431344591}
|
||||
m_Layer: 7
|
||||
m_Name: SM_Prop_Cannon_01 (3)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2155776711209515616
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4836829392273355565}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0.23903932, y: -0.67399514, z: -0.21174636, w: 0.6661488}
|
||||
m_LocalPosition: {x: -0.8625002, y: 2.4082499, z: 0.795002}
|
||||
m_LocalScale: {x: 0.7095477, y: 0.7095476, z: 0.70954806}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1055643547297219040}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: -37.15, y: -811.641, z: 2.885}
|
||||
--- !u!33 &244436262679622758
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4836829392273355565}
|
||||
m_Mesh: {fileID: 4300000, guid: 762ed5390269c4c4185e61661508264a, type: 3}
|
||||
--- !u!23 &1460342609431344591
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4836829392273355565}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 2
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 5e1235b2e417983469723d36f05de88d, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c9e74631c8994b8cb728cde8efae49a
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
90
BlueWater/Assets/05.Prefabs/Ui/RadarTarget.prefab
Normal file
90
BlueWater/Assets/05.Prefabs/Ui/RadarTarget.prefab
Normal file
@ -0,0 +1,90 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1435528194207525114
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8499389445738743036}
|
||||
- component: {fileID: 2577121006411424412}
|
||||
- component: {fileID: 6371986274854545812}
|
||||
- component: {fileID: 508809779548629235}
|
||||
m_Layer: 5
|
||||
m_Name: RadarTarget
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &8499389445738743036
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1435528194207525114}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 300, y: 300}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2577121006411424412
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1435528194207525114}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &6371986274854545812
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1435528194207525114}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 0.9263606, b: 0, a: 0.39215687}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 679b53e1abc3d4686ad690aa88542b77, type: 3}
|
||||
m_Type: 3
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 0.1
|
||||
m_FillClockwise: 0
|
||||
m_FillOrigin: 2
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &508809779548629235
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1435528194207525114}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2318ac00dd2af443a8f5b7d0960ce541, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
7
BlueWater/Assets/05.Prefabs/Ui/RadarTarget.prefab.meta
Normal file
7
BlueWater/Assets/05.Prefabs/Ui/RadarTarget.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68e1bc2a7cb0a4db89fc3777be734250
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
4
BlueWater/Assets/Behavior Designer.meta
Normal file
4
BlueWater/Assets/Behavior Designer.meta
Normal file
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b303277dfa449d4a93437535228816d
|
||||
DefaultImporter:
|
||||
userData:
|
BIN
BlueWater/Assets/Behavior Designer/Documentation.pdf
Normal file
BIN
BlueWater/Assets/Behavior Designer/Documentation.pdf
Normal file
Binary file not shown.
11
BlueWater/Assets/Behavior Designer/Documentation.pdf.meta
Normal file
11
BlueWater/Assets/Behavior Designer/Documentation.pdf.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4646946da2762db46a08e76a6c42f832
|
||||
DefaultImporter:
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Documentation.pdf
|
||||
uploadId: 598781
|
2
BlueWater/Assets/Behavior Designer/Editor.meta
Normal file
2
BlueWater/Assets/Behavior Designer/Editor.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3aa7d582439bc2f4da8254d1364e0f41
|
Binary file not shown.
@ -0,0 +1,40 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af72b091e5876924c9ab327b2d8de270
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Editor/BehaviorDesigner.Editor.dll
|
||||
uploadId: 598781
|
@ -0,0 +1,11 @@
|
||||
using UnityEditor;
|
||||
using BehaviorDesigner.Runtime;
|
||||
|
||||
namespace BehaviorDesigner.Editor
|
||||
{
|
||||
[CustomEditor(typeof(BehaviorTree))]
|
||||
public class BehaviorTreeInspector : BehaviorInspector
|
||||
{
|
||||
// intentionally left blank
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94693c6931cea70439c26417a1fc0d33
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Editor/BehaviorTreeInspector.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using BehaviorDesigner.Runtime;
|
||||
|
||||
namespace BehaviorDesigner.Editor
|
||||
{
|
||||
[CustomEditor(typeof(ExternalBehaviorTree))]
|
||||
public class ExternalBehaviorTreeInspector : ExternalBehaviorInspector
|
||||
{
|
||||
// intentionally left blank
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f0cb79f53e760c4d950b8c6ade6a242
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Editor/ExternalBehaviorTreeInspector.cs
|
||||
uploadId: 598781
|
44
BlueWater/Assets/Behavior Designer/Editor/GridShader.shader
Normal file
44
BlueWater/Assets/Behavior Designer/Editor/GridShader.shader
Normal file
@ -0,0 +1,44 @@
|
||||
Shader "Hidden/Behavior Designer/Grid" {
|
||||
SubShader {
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
fixed4 frag(v2f_img i) : Color {
|
||||
return fixed4(0.21, 0.21, 0.21, 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
fixed4 frag(v2f_img i) : Color {
|
||||
return fixed4(0.33, 0.33, 0.33, 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
fixed4 frag(v2f_img i) : Color {
|
||||
return fixed4(0.26, 0.26, 0.26, 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
fixed4 frag(v2f_img i) : Color {
|
||||
return fixed4(0.27, 0.27, 0.27, 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afbd9f0fb1c22d1409403fdef158479f
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Editor/GridShader.shader
|
||||
uploadId: 598781
|
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 956347559c803f7489f75873ef2715e5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using BehaviorDesigner.Runtime;
|
||||
using BehaviorDesigner.Runtime.ObjectDrawers;
|
||||
|
||||
namespace BehaviorDesigner.Editor.ObjectDrawers
|
||||
{
|
||||
[CustomObjectDrawer(typeof(FloatSliderAttribute))]
|
||||
public class FloatSliderDrawer : ObjectDrawer
|
||||
{
|
||||
public override void OnGUI(GUIContent label)
|
||||
{
|
||||
var floatSliderAttribute = (FloatSliderAttribute)attribute;
|
||||
if (value is SharedFloat) {
|
||||
var sharedFloat = value as SharedFloat;
|
||||
sharedFloat.Value = EditorGUILayout.Slider(label, sharedFloat.Value, floatSliderAttribute.min, floatSliderAttribute.max);
|
||||
} else {
|
||||
value = EditorGUILayout.Slider(label, (float)value, floatSliderAttribute.min, floatSliderAttribute.max);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f0987c6ff37141458ff776277e2b65a
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using BehaviorDesigner.Runtime;
|
||||
using BehaviorDesigner.Runtime.ObjectDrawers;
|
||||
|
||||
namespace BehaviorDesigner.Editor.ObjectDrawers
|
||||
{
|
||||
[CustomObjectDrawer(typeof(IntSliderAttribute))]
|
||||
public class IntSliderDrawer : ObjectDrawer
|
||||
{
|
||||
public override void OnGUI(GUIContent label)
|
||||
{
|
||||
var intSliderAttribute = (IntSliderAttribute)attribute;
|
||||
if (value is SharedInt) {
|
||||
var sharedFloat = value as SharedInt;
|
||||
sharedFloat.Value = EditorGUILayout.IntSlider(label, sharedFloat.Value, intSliderAttribute.min, intSliderAttribute.max);
|
||||
} else {
|
||||
value = EditorGUILayout.IntSlider(label, (int)value, intSliderAttribute.min, intSliderAttribute.max);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed5dac524fa5f61468bb6ca49a556b3b
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,146 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using BehaviorDesigner.Runtime.Tasks;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
using Action = BehaviorDesigner.Runtime.Tasks.Action;
|
||||
|
||||
namespace BehaviorDesigner.Editor.ObjectDrawers
|
||||
{
|
||||
[CustomObjectDrawer(typeof(StackedAction))]
|
||||
public class StackedActionDrawer : ObjectDrawer
|
||||
{
|
||||
private ReorderableList reorderableList;
|
||||
private StackedAction lastStackedAction;
|
||||
|
||||
public override void OnGUI(GUIContent label)
|
||||
{
|
||||
var stackedAction = task as StackedAction;
|
||||
|
||||
stackedAction.comparisonType = (StackedAction.ComparisonType)FieldInspector.DrawField(stackedAction,
|
||||
new GUIContent("Comparison Type", "Specifies if the tasks should be traversed with an AND (Sequence) or an OR (Selector)."),
|
||||
stackedAction.GetType().GetField("comparisonType", BindingFlags.Instance | BindingFlags.Public),
|
||||
stackedAction.comparisonType);
|
||||
|
||||
stackedAction.graphLabel = (bool)FieldInspector.DrawField(stackedAction,
|
||||
new GUIContent("Graph Label", "Should the tasks be labeled within te graph?"),
|
||||
stackedAction.GetType().GetField("graphLabel", BindingFlags.Instance | BindingFlags.Public),
|
||||
stackedAction.graphLabel);
|
||||
|
||||
if (stackedAction.actions == null) {
|
||||
stackedAction.actions = new Action[0];
|
||||
}
|
||||
|
||||
if (reorderableList == null) {
|
||||
reorderableList = new ReorderableList(stackedAction.actions, typeof(Action), true, true, true, true);
|
||||
reorderableList.drawHeaderCallback += (Rect rect) =>
|
||||
{
|
||||
EditorGUI.LabelField(rect, "Actions");
|
||||
};
|
||||
reorderableList.onAddDropdownCallback += OnAddDropdownCallback;
|
||||
reorderableList.drawElementCallback += OnDrawElementCallback;
|
||||
reorderableList.onReorderCallback += OnReorderCallback;
|
||||
reorderableList.onSelectCallback += OnSelectCallback;
|
||||
reorderableList.onCanRemoveCallback += OnCanRemoveCallback;
|
||||
reorderableList.onRemoveCallback += OnRemoveCallback;
|
||||
}
|
||||
if (stackedAction != lastStackedAction) {
|
||||
lastStackedAction = stackedAction;
|
||||
var index = EditorPrefs.GetInt("BehaviorDesigner.StackedAction." + stackedAction.ID, -1);
|
||||
if (index < stackedAction.actions.Length) {
|
||||
reorderableList.index = index;
|
||||
}
|
||||
}
|
||||
if (reorderableList.index == -1 && stackedAction.actions.Length > 0) {
|
||||
reorderableList.index = 0;
|
||||
}
|
||||
reorderableList.DoLayoutList();
|
||||
|
||||
if (reorderableList.index >= 0 && stackedAction.actions != null && reorderableList.index < stackedAction.actions.Length) {
|
||||
var selectedAction = stackedAction.actions[reorderableList.index];
|
||||
EditorGUILayout.LabelField(selectedAction.GetType().Name, BehaviorDesignerUtility.BoldLabelGUIStyle);
|
||||
FieldInspector.DrawFields(selectedAction, selectedAction);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAddDropdownCallback(Rect buttonRect, ReorderableList list)
|
||||
{
|
||||
var addMenu = new GenericMenu();
|
||||
BehaviorDesignerWindow.instance.TaskList.AddTaskTypesToMenu(0, ref addMenu, null, typeof(StackedAction), string.Empty, false, OnAddTask);
|
||||
addMenu.ShowAsContext();
|
||||
}
|
||||
|
||||
private void OnAddTask(object obj)
|
||||
{
|
||||
var stackedAction = task as StackedAction;
|
||||
var actions = stackedAction.actions;
|
||||
Array.Resize(ref actions, actions.Length + 1);
|
||||
var taskType = obj as Type;
|
||||
actions[actions.Length - 1] = Activator.CreateInstance(taskType) as Action;
|
||||
reorderableList.list = stackedAction.actions = actions;
|
||||
reorderableList.index = actions.Length - 1;
|
||||
BehaviorDesignerWindow.instance.SaveBehavior();
|
||||
}
|
||||
|
||||
private void OnDrawElementCallback(Rect rect, int index, bool isActive, bool isFocused)
|
||||
{
|
||||
var stackedAction = task as StackedAction;
|
||||
if (stackedAction.actions == null || index >= stackedAction.actions.Length || stackedAction.actions[index] == null) {
|
||||
if (stackedAction.actions != null && index < stackedAction.actions.Length) {
|
||||
var actions = stackedAction.actions;
|
||||
ArrayUtility.RemoveAt(ref actions, index);
|
||||
reorderableList.list = stackedAction.actions = actions;
|
||||
BehaviorDesignerWindow.instance.SaveBehavior();
|
||||
}
|
||||
return;
|
||||
}
|
||||
EditorGUI.LabelField(rect, stackedAction.actions[index].GetType().Name);
|
||||
if (stackedAction.actions[index].NodeData == null || stackedAction.NodeData == null || !Application.isPlaying) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (stackedAction.actions[index].NodeData.ExecutionStatus == TaskStatus.Success || stackedAction.actions[index].NodeData.ExecutionStatus == TaskStatus.Failure) {
|
||||
Texture2D texture;
|
||||
if (stackedAction.NodeData.IsReevaluating) {
|
||||
texture = stackedAction.actions[index].NodeData.ExecutionStatus == TaskStatus.Failure ? BehaviorDesignerUtility.ExecutionFailureRepeatTexture : BehaviorDesignerUtility.ExecutionSuccessRepeatTexture;
|
||||
} else {
|
||||
texture = stackedAction.actions[index].NodeData.ExecutionStatus == TaskStatus.Failure ? BehaviorDesignerUtility.ExecutionFailureTexture : BehaviorDesignerUtility.ExecutionSuccessTexture;
|
||||
}
|
||||
rect.x = rect.width + 8;
|
||||
rect.width = rect.height = 16;
|
||||
GUI.DrawTexture(rect, texture);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnReorderCallback(ReorderableList list)
|
||||
{
|
||||
var stackedActions = task as StackedAction;
|
||||
stackedActions.actions = (Action[])list.list;
|
||||
BehaviorDesignerWindow.instance.SaveBehavior();
|
||||
}
|
||||
|
||||
private void OnSelectCallback(ReorderableList list)
|
||||
{
|
||||
EditorPrefs.SetInt("BehaviorDesigner.StackedAction." + task.ID, list.index);
|
||||
}
|
||||
|
||||
private bool OnCanRemoveCallback(ReorderableList list)
|
||||
{
|
||||
var stackedActions = task as StackedAction;
|
||||
return stackedActions.actions != null && stackedActions.actions.Length > 0;
|
||||
}
|
||||
|
||||
private void OnRemoveCallback(ReorderableList list)
|
||||
{
|
||||
var stackedAction = task as StackedAction;
|
||||
var actions = stackedAction.actions;
|
||||
ArrayUtility.RemoveAt(ref actions, list.index);
|
||||
reorderableList.list = stackedAction.actions = actions;
|
||||
BehaviorDesignerWindow.instance.SaveBehavior();
|
||||
|
||||
reorderableList.index -= 1;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2dda1c5bd0726be428a9210c793769d7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Editor/Object Drawers/StackedActionDrawer.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,144 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using BehaviorDesigner.Runtime.Tasks;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace BehaviorDesigner.Editor.ObjectDrawers
|
||||
{
|
||||
[CustomObjectDrawer(typeof(StackedConditional))]
|
||||
public class StackedConditionalDrawer : ObjectDrawer
|
||||
{
|
||||
private ReorderableList reorderableList;
|
||||
private StackedConditional lastStackedConditional;
|
||||
|
||||
public override void OnGUI(GUIContent label)
|
||||
{
|
||||
var stackedConditional = task as StackedConditional;
|
||||
|
||||
stackedConditional.comparisonType = (StackedConditional.ComparisonType)FieldInspector.DrawField(stackedConditional,
|
||||
new GUIContent("Comparison Type", "Specifies if the tasks should be traversed with an AND (Sequence) or an OR (Selector)."),
|
||||
stackedConditional.GetType().GetField("comparisonType", BindingFlags.Instance | BindingFlags.Public),
|
||||
stackedConditional.comparisonType);
|
||||
|
||||
stackedConditional.graphLabel = (bool)FieldInspector.DrawField(stackedConditional,
|
||||
new GUIContent("Graph Label", "Should the tasks be labeled within te graph?"),
|
||||
stackedConditional.GetType().GetField("graphLabel", BindingFlags.Instance | BindingFlags.Public),
|
||||
stackedConditional.graphLabel);
|
||||
|
||||
if (stackedConditional.conditionals == null) {
|
||||
stackedConditional.conditionals = new Conditional[0];
|
||||
}
|
||||
|
||||
if (reorderableList == null) {
|
||||
reorderableList = new ReorderableList(stackedConditional.conditionals, typeof(Conditional), true, true, true, true);
|
||||
reorderableList.drawHeaderCallback += (Rect rect) =>
|
||||
{
|
||||
EditorGUI.LabelField(rect, "Conditionals");
|
||||
};
|
||||
reorderableList.onAddDropdownCallback += OnAddDropdownCallback;
|
||||
reorderableList.drawElementCallback += OnDrawElementCallback;
|
||||
reorderableList.onReorderCallback += OnReorderCallback;
|
||||
reorderableList.onSelectCallback += OnSelectCallback;
|
||||
reorderableList.onCanRemoveCallback += OnCanRemoveCallback;
|
||||
reorderableList.onRemoveCallback += OnRemoveCallback;
|
||||
}
|
||||
if (stackedConditional != lastStackedConditional) {
|
||||
lastStackedConditional = stackedConditional;
|
||||
var index = EditorPrefs.GetInt("BehaviorDesigner.StackedConditional." + stackedConditional.ID, -1);
|
||||
if (index < stackedConditional.conditionals.Length) {
|
||||
reorderableList.index = index;
|
||||
}
|
||||
}
|
||||
if (reorderableList.index == -1 && stackedConditional.conditionals.Length > 0) {
|
||||
reorderableList.index = 0;
|
||||
}
|
||||
reorderableList.DoLayoutList();
|
||||
|
||||
if (reorderableList.index >= 0 && stackedConditional.conditionals != null && reorderableList.index < stackedConditional.conditionals.Length) {
|
||||
var selectedConditional = stackedConditional.conditionals[reorderableList.index];
|
||||
EditorGUILayout.LabelField(selectedConditional.GetType().Name, BehaviorDesignerUtility.BoldLabelGUIStyle);
|
||||
FieldInspector.DrawFields(selectedConditional, selectedConditional);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAddDropdownCallback(Rect buttonRect, ReorderableList list)
|
||||
{
|
||||
var addMenu = new GenericMenu();
|
||||
BehaviorDesignerWindow.instance.TaskList.AddTaskTypesToMenu(2, ref addMenu, null, typeof(StackedConditional), string.Empty, false, OnAddTask);
|
||||
addMenu.ShowAsContext();
|
||||
}
|
||||
|
||||
private void OnAddTask(object obj)
|
||||
{
|
||||
var stackedConditional = task as StackedConditional;
|
||||
var conditionals = stackedConditional.conditionals;
|
||||
Array.Resize(ref conditionals, conditionals.Length + 1);
|
||||
var taskType = obj as Type;
|
||||
conditionals[conditionals.Length - 1] = Activator.CreateInstance(taskType) as Conditional;
|
||||
reorderableList.list = stackedConditional.conditionals = conditionals;
|
||||
reorderableList.index = conditionals.Length - 1;
|
||||
BehaviorDesignerWindow.instance.SaveBehavior();
|
||||
}
|
||||
|
||||
private void OnDrawElementCallback(Rect rect, int index, bool isActive, bool isFocused)
|
||||
{
|
||||
var stackedConditional = task as StackedConditional;
|
||||
if (stackedConditional.conditionals == null || index >= stackedConditional.conditionals.Length || stackedConditional.conditionals[index] == null) {
|
||||
if (stackedConditional.conditionals != null && index < stackedConditional.conditionals.Length) {
|
||||
var conditionals = stackedConditional.conditionals;
|
||||
ArrayUtility.RemoveAt(ref conditionals, index);
|
||||
reorderableList.list = stackedConditional.conditionals = conditionals;
|
||||
BehaviorDesignerWindow.instance.SaveBehavior();
|
||||
}
|
||||
return;
|
||||
}
|
||||
EditorGUI.LabelField(rect, stackedConditional.conditionals[index].GetType().Name);
|
||||
if (stackedConditional.conditionals[index].NodeData == null || stackedConditional.NodeData == null || !Application.isPlaying) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (stackedConditional.conditionals[index].NodeData.ExecutionStatus == TaskStatus.Success || stackedConditional.conditionals[index].NodeData.ExecutionStatus == TaskStatus.Failure) {
|
||||
Texture2D texture;
|
||||
if (stackedConditional.NodeData.IsReevaluating) {
|
||||
texture = stackedConditional.conditionals[index].NodeData.ExecutionStatus == TaskStatus.Failure ? BehaviorDesignerUtility.ExecutionFailureRepeatTexture : BehaviorDesignerUtility.ExecutionSuccessRepeatTexture;
|
||||
} else {
|
||||
texture = stackedConditional.conditionals[index].NodeData.ExecutionStatus == TaskStatus.Failure ? BehaviorDesignerUtility.ExecutionFailureTexture : BehaviorDesignerUtility.ExecutionSuccessTexture;
|
||||
}
|
||||
rect.x = rect.width + 8;
|
||||
rect.width = rect.height = 16;
|
||||
GUI.DrawTexture(rect, texture);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnReorderCallback(ReorderableList list)
|
||||
{
|
||||
var stackedConditionals = task as StackedConditional;
|
||||
stackedConditionals.conditionals = (Conditional[])list.list;
|
||||
BehaviorDesignerWindow.instance.SaveBehavior();
|
||||
}
|
||||
|
||||
private void OnSelectCallback(ReorderableList list)
|
||||
{
|
||||
EditorPrefs.SetInt("BehaviorDesigner.StackedConditional." + task.ID, list.index);
|
||||
}
|
||||
|
||||
private bool OnCanRemoveCallback(ReorderableList list)
|
||||
{
|
||||
var stackedConditionals = task as StackedConditional;
|
||||
return stackedConditionals.conditionals != null && stackedConditionals.conditionals.Length > 0;
|
||||
}
|
||||
|
||||
private void OnRemoveCallback(ReorderableList list)
|
||||
{
|
||||
var stackedConditional = task as StackedConditional;
|
||||
var conditionals = stackedConditional.conditionals;
|
||||
ArrayUtility.RemoveAt(ref conditionals, list.index);
|
||||
reorderableList.list = stackedConditional.conditionals = conditionals;
|
||||
BehaviorDesignerWindow.instance.SaveBehavior();
|
||||
|
||||
reorderableList.index -= 1;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d12c12988e4c954b81ed7f3cdd0a439
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Editor/Object Drawers/StackedConditionalDrawer.cs
|
||||
uploadId: 598781
|
9
BlueWater/Assets/Behavior Designer/Integrations.meta
Normal file
9
BlueWater/Assets/Behavior Designer/Integrations.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 519776d3d02747548a264d7d32320ab1
|
||||
folderAsset: yes
|
||||
timeCreated: 1536092918
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
BlueWater/Assets/Behavior Designer/Integrations/Readme.pdf
Normal file
BIN
BlueWater/Assets/Behavior Designer/Integrations/Readme.pdf
Normal file
Binary file not shown.
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a43abd9ecc0166043973a4ba6da07bf1
|
||||
DefaultImporter:
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Integrations/Readme.pdf
|
||||
uploadId: 598781
|
Binary file not shown.
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f76522f0ea27769479b1c38979bac10a
|
||||
DefaultImporter:
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime Source Code Location.pdf
|
||||
uploadId: 598781
|
2
BlueWater/Assets/Behavior Designer/Runtime.meta
Normal file
2
BlueWater/Assets/Behavior Designer/Runtime.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33b3095a3727f544dbe47311776edb53
|
Binary file not shown.
@ -0,0 +1,40 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da41a8dd3b5ec434a802d9b5a2a0a777
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/BehaviorDesigner.Runtime.dll
|
||||
uploadId: 598781
|
11
BlueWater/Assets/Behavior Designer/Runtime/BehaviorTree.cs
Normal file
11
BlueWater/Assets/Behavior Designer/Runtime/BehaviorTree.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BehaviorDesigner.Runtime
|
||||
{
|
||||
// Wrapper for the Behavior class
|
||||
[AddComponentMenu("Behavior Designer/Behavior Tree")]
|
||||
public class BehaviorTree : Behavior
|
||||
{
|
||||
// intentionally left blank
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d7b55c7ecdb49a4a89fa5e6f9022861
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 5b5f458971c6fd5459c51a7b8079bc3b, type: 3}
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/BehaviorTree.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,8 @@
|
||||
namespace BehaviorDesigner.Runtime
|
||||
{
|
||||
[System.Serializable]
|
||||
public class ExternalBehaviorTree : ExternalBehavior
|
||||
{
|
||||
// intentionally left blank
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b23f08d2ae4cba14087c1ed36193d82b
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 5b5f458971c6fd5459c51a7b8079bc3b, type: 3}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/ExternalBehaviorTree.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29d0d8866b4fa984bbc7dbf5d988ebcc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
@ -0,0 +1,16 @@
|
||||
using BehaviorDesigner.Runtime.Tasks;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.ObjectDrawers
|
||||
{
|
||||
public class FloatSliderAttribute : ObjectDrawerAttribute
|
||||
{
|
||||
public float min;
|
||||
public float max;
|
||||
|
||||
public FloatSliderAttribute(float min, float max)
|
||||
{
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92948bfcff9a1fc48834935ebb0dbdcb
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Object Drawers/FloatSliderAttribute.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,16 @@
|
||||
using BehaviorDesigner.Runtime.Tasks;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.ObjectDrawers
|
||||
{
|
||||
public class IntSliderAttribute : ObjectDrawerAttribute
|
||||
{
|
||||
public int min;
|
||||
public int max;
|
||||
|
||||
public IntSliderAttribute(int min, int max)
|
||||
{
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2373bfe29d0e5bc47b88a46226aa6a61
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Object Drawers/IntSliderAttribute.cs
|
||||
uploadId: 598781
|
8
BlueWater/Assets/Behavior Designer/Runtime/Tasks.meta
Normal file
8
BlueWater/Assets/Behavior Designer/Runtime/Tasks.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2cd36de769e955742bf9b7cf79fb671f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91c6a439cec3003498369e01301ee57a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
// Wrapper class for the Behavior Reference task. The Behavior Tree Reference task allows you to run another behavior tree within the current behavior tree.
|
||||
// One use for this task is if you have an unit that plays a series of tasks to attack. You may want the unit to attack at different points within
|
||||
// the behavior tree, and you want that attack to always be the same. Instead of copying and pasting the same tasks over and over you can just use
|
||||
// an external behavior and then the tasks are always guaranteed to be the same. This example is demonstrated in the RTS sample project located at
|
||||
// https://www.opsive.com/downloads/?pid=803.
|
||||
[TaskDescription("Behavior Tree Reference allows you to run another behavior tree within the current behavior tree.")]
|
||||
[HelpURL("https://www.opsive.com/support/documentation/behavior-designer/external-behavior-trees/")]
|
||||
[TaskIcon("BehaviorTreeReferenceIcon.png")]
|
||||
public class BehaviorTreeReference : BehaviorReference
|
||||
{
|
||||
// intentionally left blank - subclass of BehaviorReference
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af7b6fcbc7258f34aad1bb82b5b3fdc8
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/BehaviorTreeReference.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Returns a TaskStatus of running. Will only stop when interrupted or a conditional abort is triggered.")]
|
||||
[TaskIcon("{SkinColor}IdleIcon.png")]
|
||||
public class Idle : Action
|
||||
{
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
return TaskStatus.Running;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 759252a4ffada80419ef06ce1c625246
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Idle.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Log is a simple task which will output the specified text and return success. It can be used for debugging.")]
|
||||
[TaskIcon("{SkinColor}LogIcon.png")]
|
||||
public class Log : Action
|
||||
{
|
||||
[Tooltip("Text to output to the log")]
|
||||
public SharedString text;
|
||||
[Tooltip("Is this text an error?")]
|
||||
public SharedBool logError;
|
||||
[Tooltip("Should the time be included in the log message?")]
|
||||
public SharedBool logTime;
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
// Log the text and return success
|
||||
if (logError.Value) {
|
||||
Debug.LogError(logTime.Value ? string.Format("{0}: {1}", Time.time, text) : text);
|
||||
} else {
|
||||
Debug.Log(logTime.Value ? string.Format("{0}: {1}",Time.time, text) : text);
|
||||
}
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
|
||||
public override void OnReset()
|
||||
{
|
||||
// Reset the properties back to their original values
|
||||
text = "";
|
||||
logError = false;
|
||||
logTime = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d53794347878c7c479da37533dce2024
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Log.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,28 @@
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Perform the actual interruption. This will immediately stop the specified tasks from running and will return success or failure depending on the value of interrupt success.")]
|
||||
[TaskIcon("{SkinColor}PerformInterruptionIcon.png")]
|
||||
public class PerformInterruption : Action
|
||||
{
|
||||
[Tooltip("The list of tasks to interrupt. Can be any number of tasks")]
|
||||
public Interrupt[] interruptTasks;
|
||||
[Tooltip("When we interrupt the task should we return a task status of success?")]
|
||||
public SharedBool interruptSuccess;
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
// Loop through all of the tasks and fire an interruption. Once complete return success.
|
||||
for (int i = 0; i < interruptTasks.Length; ++i) {
|
||||
interruptTasks[i].DoInterrupt(interruptSuccess.Value ? TaskStatus.Success : TaskStatus.Failure);
|
||||
}
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
|
||||
public override void OnReset()
|
||||
{
|
||||
// Reset the properties back to their original values.
|
||||
interruptTasks = null;
|
||||
interruptSuccess = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72d2d6051b23e86468e2f715f044dad8
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/PerformInterruption.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7bbf15f7023452341aebe68861a3aabc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,57 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Gets the value from the field specified. Returns success if the field was retrieved.")]
|
||||
[TaskCategory("Reflection")]
|
||||
[TaskIcon("{SkinColor}ReflectionIcon.png")]
|
||||
public class GetFieldValue : Action
|
||||
{
|
||||
[Tooltip("The GameObject to get the field on")]
|
||||
public SharedGameObject targetGameObject;
|
||||
[Tooltip("The component to get the field on")]
|
||||
public SharedString componentName;
|
||||
[Tooltip("The name of the field")]
|
||||
public SharedString fieldName;
|
||||
[Tooltip("The value of the field")]
|
||||
[RequiredField]
|
||||
public SharedVariable fieldValue;
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
if (fieldValue == null) {
|
||||
Debug.LogWarning("Unable to get field - field value is null");
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
var type = TaskUtility.GetTypeWithinAssembly(componentName.Value);
|
||||
if (type == null) {
|
||||
Debug.LogWarning("Unable to get field - type is null");
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type);
|
||||
if (component == null) {
|
||||
Debug.LogWarning("Unable to get the field with component " + componentName.Value);
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
// If you are receiving a compiler error on the Windows Store platform see this topic:
|
||||
// https://www.opsive.com/support/documentation/behavior-designer/installation/
|
||||
var field = component.GetType().GetField(fieldName.Value);
|
||||
fieldValue.SetValue(field.GetValue(component));
|
||||
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
|
||||
public override void OnReset()
|
||||
{
|
||||
targetGameObject = null;
|
||||
componentName = null;
|
||||
fieldName = null;
|
||||
fieldValue = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc317dd7feb2085499edb0d0c4604640
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetFieldValue.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,57 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Gets the value from the property specified. Returns success if the property was retrieved.")]
|
||||
[TaskCategory("Reflection")]
|
||||
[TaskIcon("{SkinColor}ReflectionIcon.png")]
|
||||
public class GetPropertyValue : Action
|
||||
{
|
||||
[Tooltip("The GameObject to get the property of")]
|
||||
public SharedGameObject targetGameObject;
|
||||
[Tooltip("The component to get the property of")]
|
||||
public SharedString componentName;
|
||||
[Tooltip("The name of the property")]
|
||||
public SharedString propertyName;
|
||||
[Tooltip("The value of the property")]
|
||||
[RequiredField]
|
||||
public SharedVariable propertyValue;
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
if (propertyValue == null) {
|
||||
Debug.LogWarning("Unable to get property - property value is null");
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
var type = TaskUtility.GetTypeWithinAssembly(componentName.Value);
|
||||
if (type == null) {
|
||||
Debug.LogWarning("Unable to get property - type is null");
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type);
|
||||
if (component == null) {
|
||||
Debug.LogWarning("Unable to get the property with component " + componentName.Value);
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
// If you are receiving a compiler error on the Windows Store platform see this topic:
|
||||
// https://www.opsive.com/support/documentation/behavior-designer/installation/
|
||||
var property = component.GetType().GetProperty(propertyName.Value);
|
||||
propertyValue.SetValue(property.GetValue(component, null));
|
||||
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
|
||||
public override void OnReset()
|
||||
{
|
||||
targetGameObject = null;
|
||||
componentName = null;
|
||||
propertyName = null;
|
||||
propertyValue = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dda9c9b7c6ff2ee4f95a2e208cddae64
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/GetPropertyValue.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,84 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Invokes the specified method with the specified parameters. Can optionally store the return value. Returns success if the method was invoked.")]
|
||||
[TaskCategory("Reflection")]
|
||||
[TaskIcon("{SkinColor}ReflectionIcon.png")]
|
||||
public class InvokeMethod : Action
|
||||
{
|
||||
[Tooltip("The GameObject to invoke the method on")]
|
||||
public SharedGameObject targetGameObject;
|
||||
[Tooltip("The component to invoke the method on")]
|
||||
public SharedString componentName;
|
||||
[Tooltip("The name of the method")]
|
||||
public SharedString methodName;
|
||||
[Tooltip("The first parameter of the method")]
|
||||
public SharedVariable parameter1;
|
||||
[Tooltip("The second parameter of the method")]
|
||||
public SharedVariable parameter2;
|
||||
[Tooltip("The third parameter of the method")]
|
||||
public SharedVariable parameter3;
|
||||
[Tooltip("The fourth parameter of the method")]
|
||||
public SharedVariable parameter4;
|
||||
[Tooltip("Store the result of the invoke call")]
|
||||
public SharedVariable storeResult;
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
var type = TaskUtility.GetTypeWithinAssembly(componentName.Value);
|
||||
if (type == null) {
|
||||
Debug.LogWarning("Unable to invoke - type is null");
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type);
|
||||
if (component == null) {
|
||||
Debug.LogWarning("Unable to invoke method with component " + componentName.Value);
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
var parameterList = new List<object>();
|
||||
var parameterTypeList = new List<Type>();
|
||||
SharedVariable sharedVariable = null;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
var parameterField = GetType().GetField("parameter" + (i + 1));
|
||||
if ((sharedVariable = parameterField.GetValue(this) as SharedVariable) != null) {
|
||||
parameterList.Add(sharedVariable.GetValue());
|
||||
parameterTypeList.Add(sharedVariable.GetType().GetProperty("Value").PropertyType);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If you are receiving a compiler error on the Windows Store platform see this topic:
|
||||
// https://www.opsive.com/support/documentation/behavior-designer/installation/
|
||||
var methodInfo = component.GetType().GetMethod(methodName.Value, parameterTypeList.ToArray());
|
||||
|
||||
if (methodInfo == null) {
|
||||
Debug.LogWarning("Unable to invoke method " + methodName.Value + " on component " + componentName.Value);
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
var result = methodInfo.Invoke(component, parameterList.ToArray());
|
||||
if (storeResult != null) {
|
||||
storeResult.SetValue(result);
|
||||
}
|
||||
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
|
||||
public override void OnReset()
|
||||
{
|
||||
targetGameObject = null;
|
||||
componentName = null;
|
||||
methodName = null;
|
||||
parameter1 = null;
|
||||
parameter2 = null;
|
||||
parameter3 = null;
|
||||
parameter4 = null;
|
||||
storeResult = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 359bd67578f53034ab2eb00e7696d317
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/InvokeMethod.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,56 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Sets the field to the value specified. Returns success if the field was set.")]
|
||||
[TaskCategory("Reflection")]
|
||||
[TaskIcon("{SkinColor}ReflectionIcon.png")]
|
||||
public class SetFieldValue : Action
|
||||
{
|
||||
[Tooltip("The GameObject to set the field on")]
|
||||
public SharedGameObject targetGameObject;
|
||||
[Tooltip("The component to set the field on")]
|
||||
public SharedString componentName;
|
||||
[Tooltip("The name of the field")]
|
||||
public SharedString fieldName;
|
||||
[Tooltip("The value to set")]
|
||||
public SharedVariable fieldValue;
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
if (fieldValue == null) {
|
||||
Debug.LogWarning("Unable to get field - field value is null");
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
var type = TaskUtility.GetTypeWithinAssembly(componentName.Value);
|
||||
if (type == null) {
|
||||
Debug.LogWarning("Unable to set field - type is null");
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type);
|
||||
if (component == null) {
|
||||
Debug.LogWarning("Unable to set the field with component " + componentName.Value);
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
// If you are receiving a compiler error on the Windows Store platform see this topic:
|
||||
// https://www.opsive.com/support/documentation/behavior-designer/installation/
|
||||
var field = component.GetType().GetField(fieldName.Value);
|
||||
field.SetValue(component, fieldValue.GetValue());
|
||||
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
|
||||
public override void OnReset()
|
||||
{
|
||||
targetGameObject = null;
|
||||
componentName = null;
|
||||
fieldName = null;
|
||||
fieldValue = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21e389787213ba24ab1a6817def634ae
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetFieldValue.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,56 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Sets the property to the value specified. Returns success if the property was set.")]
|
||||
[TaskCategory("Reflection")]
|
||||
[TaskIcon("{SkinColor}ReflectionIcon.png")]
|
||||
public class SetPropertyValue : Action
|
||||
{
|
||||
[Tooltip("The GameObject to set the property on")]
|
||||
public SharedGameObject targetGameObject;
|
||||
[Tooltip("The component to set the property on")]
|
||||
public SharedString componentName;
|
||||
[Tooltip("The name of the property")]
|
||||
public SharedString propertyName;
|
||||
[Tooltip("The value to set")]
|
||||
public SharedVariable propertyValue;
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
if (propertyValue == null) {
|
||||
Debug.LogWarning("Unable to get field - field value is null");
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
var type = TaskUtility.GetTypeWithinAssembly(componentName.Value);
|
||||
if (type == null) {
|
||||
Debug.LogWarning("Unable to set property - type is null");
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
var component = GetDefaultGameObject(targetGameObject.Value).GetComponent(type);
|
||||
if (component == null) {
|
||||
Debug.LogWarning("Unable to set the property with component " + componentName.Value);
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
// If you are receiving a compiler error on the Windows Store platform see this topic:
|
||||
// https://www.opsive.com/support/documentation/behavior-designer/installation/
|
||||
var property = component.GetType().GetProperty(propertyName.Value);
|
||||
property.SetValue(component, propertyValue.GetValue(), null);
|
||||
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
|
||||
public override void OnReset()
|
||||
{
|
||||
targetGameObject = null;
|
||||
componentName = null;
|
||||
propertyName = null;
|
||||
propertyValue = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d98b13b7ae4b36b4092b439731466d9b
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Reflection/SetPropertyValue.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,55 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Restarts a behavior tree, returns success after it has been restarted.")]
|
||||
[TaskIcon("{SkinColor}RestartBehaviorTreeIcon.png")]
|
||||
public class RestartBehaviorTree : Action
|
||||
{
|
||||
[Tooltip("The GameObject of the behavior tree that should be restarted. If null use the current behavior")]
|
||||
public SharedGameObject behaviorGameObject;
|
||||
[Tooltip("The group of the behavior tree that should be restarted")]
|
||||
public SharedInt group;
|
||||
|
||||
private Behavior behavior;
|
||||
|
||||
public override void OnAwake()
|
||||
{
|
||||
var behaviorTrees = GetDefaultGameObject(behaviorGameObject.Value).GetComponents<Behavior>();
|
||||
if (behaviorTrees.Length == 1) {
|
||||
behavior = behaviorTrees[0];
|
||||
} else if (behaviorTrees.Length > 1) {
|
||||
for (int i = 0; i < behaviorTrees.Length; ++i) {
|
||||
if (behaviorTrees[i].Group == group.Value) {
|
||||
behavior = behaviorTrees[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If the group can't be found then use the first behavior tree
|
||||
if (behavior == null) {
|
||||
behavior = behaviorTrees[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
if (behavior == null) {
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
// Stop the behavior tree
|
||||
behavior.DisableBehavior();
|
||||
// Start the behavior tree back up
|
||||
behavior.EnableBehavior();
|
||||
// Return success
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
|
||||
public override void OnReset()
|
||||
{
|
||||
// Reset the properties back to their original values.
|
||||
behavior = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2765e7ece98046542880a1249b87e096
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/RestartBehaviorTree.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,73 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Sends an event to the behavior tree, returns success after sending the event.")]
|
||||
[HelpURL("https://www.opsive.com/support/documentation/behavior-designer/events/")]
|
||||
[TaskIcon("{SkinColor}SendEventIcon.png")]
|
||||
public class SendEvent : Action
|
||||
{
|
||||
[Tooltip("The GameObject of the behavior tree that should have the event sent to it. If null use the current behavior")]
|
||||
public SharedGameObject targetGameObject;
|
||||
[Tooltip("The event to send")]
|
||||
public SharedString eventName;
|
||||
[Tooltip("The group of the behavior tree that the event should be sent to")]
|
||||
public SharedInt group;
|
||||
[Tooltip("Optionally specify a first argument to send")]
|
||||
[SharedRequired]
|
||||
public SharedVariable argument1;
|
||||
[Tooltip("Optionally specify a second argument to send")]
|
||||
[SharedRequired]
|
||||
public SharedVariable argument2;
|
||||
[Tooltip("Optionally specify a third argument to send")]
|
||||
[SharedRequired]
|
||||
public SharedVariable argument3;
|
||||
|
||||
private BehaviorTree behaviorTree;
|
||||
|
||||
public override void OnStart()
|
||||
{
|
||||
var behaviorTrees = GetDefaultGameObject(targetGameObject.Value).GetComponents<BehaviorTree>();
|
||||
if (behaviorTrees.Length == 1) {
|
||||
behaviorTree = behaviorTrees[0];
|
||||
} else if (behaviorTrees.Length > 1) {
|
||||
for (int i = 0; i < behaviorTrees.Length; ++i) {
|
||||
if (behaviorTrees[i].Group == group.Value) {
|
||||
behaviorTree = behaviorTrees[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If the group can't be found then use the first behavior tree
|
||||
if (behaviorTree == null) {
|
||||
behaviorTree = behaviorTrees[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
// Send the event and return success
|
||||
if (argument1 == null || argument1.IsNone) {
|
||||
behaviorTree.SendEvent(eventName.Value);
|
||||
} else {
|
||||
if (argument2 == null || argument2.IsNone) {
|
||||
behaviorTree.SendEvent<object>(eventName.Value, argument1.GetValue());
|
||||
} else {
|
||||
if (argument3 == null || argument3.IsNone) {
|
||||
behaviorTree.SendEvent<object, object>(eventName.Value, argument1.GetValue(), argument2.GetValue());
|
||||
} else {
|
||||
behaviorTree.SendEvent<object, object, object>(eventName.Value, argument1.GetValue(), argument2.GetValue(), argument3.GetValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
|
||||
public override void OnReset()
|
||||
{
|
||||
// Reset the properties back to their original values
|
||||
targetGameObject = null;
|
||||
eventName = "";
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53b90428a37913c40b6d415ced4e12f9
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/SendEvent.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,270 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Allows multiple action tasks to be added to a single node.")]
|
||||
[TaskIcon("{SkinColor}StackedActionIcon.png")]
|
||||
public class StackedAction : Action
|
||||
{
|
||||
[InspectTask]
|
||||
public Action[] actions;
|
||||
public enum ComparisonType
|
||||
{
|
||||
Sequence,
|
||||
Selector
|
||||
}
|
||||
[Tooltip("Specifies if the tasks should be traversed with an AND (Sequence) or an OR (Selector).")]
|
||||
public ComparisonType comparisonType;
|
||||
[Tooltip("Should the tasks be labeled within the graph?")]
|
||||
public bool graphLabel;
|
||||
|
||||
public override void OnAwake()
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
actions[i].GameObject = gameObject;
|
||||
actions[i].Transform = transform;
|
||||
actions[i].Owner = Owner;
|
||||
#if UNITY_EDITOR || DLL_RELEASE || DLL_DEBUG
|
||||
actions[i].NodeData = new NodeData();
|
||||
#endif
|
||||
actions[i].OnAwake();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnStart()
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
actions[i].OnStart();
|
||||
}
|
||||
}
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
if (actions == null) {
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
var executionStatus = actions[i].OnUpdate();
|
||||
#if UNITY_EDITOR || DLL_RELEASE || DLL_DEBUG
|
||||
actions[i].NodeData.ExecutionStatus = executionStatus;
|
||||
if (actions[i].NodeData.ExecutionStatus == TaskStatus.Running) {
|
||||
Debug.LogWarning("Warning: The action task returned a status of running when action tasks should only return success or failure.");
|
||||
}
|
||||
#endif
|
||||
if (comparisonType == ComparisonType.Sequence && executionStatus == TaskStatus.Failure) {
|
||||
return TaskStatus.Failure;
|
||||
} else if (comparisonType == ComparisonType.Selector && executionStatus == TaskStatus.Success) {
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
}
|
||||
return comparisonType == ComparisonType.Sequence ? TaskStatus.Success : TaskStatus.Failure;
|
||||
}
|
||||
|
||||
public override void OnFixedUpdate()
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
actions[i].OnFixedUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnLateUpdate()
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
actions[i].OnLateUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnEnd()
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
actions[i].OnEnd();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
actions[i].OnTriggerEnter(other);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
actions[i].OnTriggerEnter2D(other);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
actions[i].OnTriggerExit(other);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
actions[i].OnTriggerExit2D(other);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCollisionEnter(Collision collision)
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
actions[i].OnCollisionEnter(collision);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCollisionEnter2D(Collision2D collision)
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
actions[i].OnCollisionEnter2D(collision);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCollisionExit(Collision collision)
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
actions[i].OnCollisionExit(collision);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCollisionExit2D(Collision2D collision)
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
actions[i].OnCollisionExit2D(collision);
|
||||
}
|
||||
}
|
||||
|
||||
public override string OnDrawNodeText()
|
||||
{
|
||||
if (actions == null || !graphLabel) {
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var text = string.Empty;
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(text)) {
|
||||
text += "\n";
|
||||
}
|
||||
text += actions[i].GetType().Name;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public override void OnReset()
|
||||
{
|
||||
if (actions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.Length; ++i) {
|
||||
if (actions[i] == null) {
|
||||
continue;
|
||||
}
|
||||
actions[i].OnReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60f3f340bd02a8a4c84749a903c731da
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/StackedAction.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,91 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Start a new behavior tree and return success after it has been started.")]
|
||||
[TaskIcon("{SkinColor}StartBehaviorTreeIcon.png")]
|
||||
public class StartBehaviorTree : Action
|
||||
{
|
||||
[Tooltip("The GameObject of the behavior tree that should be started. If null use the current behavior")]
|
||||
public SharedGameObject behaviorGameObject;
|
||||
[Tooltip("The group of the behavior tree that should be started")]
|
||||
public SharedInt group;
|
||||
[Tooltip("Should this task wait for the behavior tree to complete?")]
|
||||
public SharedBool waitForCompletion = false;
|
||||
[Tooltip("Should the variables be synchronized?")]
|
||||
public SharedBool synchronizeVariables;
|
||||
|
||||
private bool behaviorComplete;
|
||||
private Behavior behavior;
|
||||
|
||||
public override void OnStart()
|
||||
{
|
||||
var behaviorTrees = GetDefaultGameObject(behaviorGameObject.Value).GetComponents<Behavior>();
|
||||
if (behaviorTrees.Length == 1) {
|
||||
behavior = behaviorTrees[0];
|
||||
} else if (behaviorTrees.Length > 1) {
|
||||
for (int i = 0; i < behaviorTrees.Length; ++i) {
|
||||
if (behaviorTrees[i].Group == group.Value) {
|
||||
behavior = behaviorTrees[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If the group can't be found then use the first behavior tree
|
||||
if (behavior == null) {
|
||||
behavior = behaviorTrees[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (behavior != null) {
|
||||
var variables = Owner.GetAllVariables();
|
||||
if (variables != null && synchronizeVariables.Value) {
|
||||
for (int i = 0; i < variables.Count; ++i) {
|
||||
behavior.SetVariableValue(variables[i].Name, variables[i]);
|
||||
}
|
||||
}
|
||||
|
||||
behavior.EnableBehavior();
|
||||
|
||||
if (waitForCompletion.Value) {
|
||||
behaviorComplete = false;
|
||||
behavior.OnBehaviorEnd += BehaviorEnded;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
if (behavior == null) {
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
// Return a status of running if we are waiting for the behavior tree to end and it hasn't ended yet
|
||||
if (waitForCompletion.Value && !behaviorComplete) {
|
||||
return TaskStatus.Running;
|
||||
}
|
||||
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
|
||||
private void BehaviorEnded(Behavior behavior)
|
||||
{
|
||||
behaviorComplete = true;
|
||||
}
|
||||
|
||||
public override void OnEnd()
|
||||
{
|
||||
if (behavior != null && waitForCompletion.Value) {
|
||||
behavior.OnBehaviorEnd -= BehaviorEnded;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnReset()
|
||||
{
|
||||
// Reset the properties back to their original values.
|
||||
behaviorGameObject = null;
|
||||
group = 0;
|
||||
waitForCompletion = false;
|
||||
synchronizeVariables = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc3d67c80371297439385b30f4be506c
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/StartBehaviorTree.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,56 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Pause or disable a behavior tree and return success after it has been stopped.")]
|
||||
[TaskIcon("{SkinColor}StopBehaviorTreeIcon.png")]
|
||||
public class StopBehaviorTree : Action
|
||||
{
|
||||
[Tooltip("The GameObject of the behavior tree that should be stopped. If null use the current behavior")]
|
||||
public SharedGameObject behaviorGameObject;
|
||||
[Tooltip("The group of the behavior tree that should be stopped")]
|
||||
public SharedInt group;
|
||||
[Tooltip("Should the behavior be paused or completely disabled")]
|
||||
public SharedBool pauseBehavior = false;
|
||||
|
||||
private Behavior behavior;
|
||||
|
||||
public override void OnStart()
|
||||
{
|
||||
var behaviorTrees = GetDefaultGameObject(behaviorGameObject.Value).GetComponents<Behavior>();
|
||||
if (behaviorTrees.Length == 1) {
|
||||
behavior = behaviorTrees[0];
|
||||
} else if (behaviorTrees.Length > 1) {
|
||||
for (int i = 0; i < behaviorTrees.Length; ++i) {
|
||||
if (behaviorTrees[i].Group == group.Value) {
|
||||
behavior = behaviorTrees[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If the group can't be found then use the first behavior tree
|
||||
if (behavior == null) {
|
||||
behavior = behaviorTrees[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
if (behavior == null) {
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
|
||||
// Start the behavior and return success.
|
||||
behavior.DisableBehavior(pauseBehavior.Value);
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
|
||||
public override void OnReset()
|
||||
{
|
||||
// Reset the properties back to their original values
|
||||
behaviorGameObject = null;
|
||||
group = 0;
|
||||
pauseBehavior = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 130afc7e6aa6e0c4aba29097334aa66b
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/StopBehaviorTree.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,66 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Wait a specified amount of time. The task will return running until the task is done waiting. It will return success after the wait time has elapsed.")]
|
||||
[TaskIcon("{SkinColor}WaitIcon.png")]
|
||||
public class Wait : Action
|
||||
{
|
||||
[Tooltip("The amount of time to wait")]
|
||||
public SharedFloat waitTime = 1;
|
||||
[Tooltip("Should the wait be randomized?")]
|
||||
public SharedBool randomWait = false;
|
||||
[Tooltip("The minimum wait time if random wait is enabled")]
|
||||
public SharedFloat randomWaitMin = 1;
|
||||
[Tooltip("The maximum wait time if random wait is enabled")]
|
||||
public SharedFloat randomWaitMax = 1;
|
||||
|
||||
// The time to wait
|
||||
private float waitDuration;
|
||||
// The time that the task started to wait.
|
||||
private float startTime;
|
||||
// Remember the time that the task is paused so the time paused doesn't contribute to the wait time.
|
||||
private float pauseTime;
|
||||
|
||||
public override void OnStart()
|
||||
{
|
||||
// Remember the start time.
|
||||
startTime = Time.time;
|
||||
if (randomWait.Value) {
|
||||
waitDuration = Random.Range(randomWaitMin.Value, randomWaitMax.Value);
|
||||
} else {
|
||||
waitDuration = waitTime.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
// The task is done waiting if the time waitDuration has elapsed since the task was started.
|
||||
if (startTime + waitDuration < Time.time) {
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
// Otherwise we are still waiting.
|
||||
return TaskStatus.Running;
|
||||
}
|
||||
|
||||
public override void OnPause(bool paused)
|
||||
{
|
||||
if (paused) {
|
||||
// Remember the time that the behavior was paused.
|
||||
pauseTime = Time.time;
|
||||
} else {
|
||||
// Add the difference between Time.time and pauseTime to figure out a new start time.
|
||||
startTime += (Time.time - pauseTime);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnReset()
|
||||
{
|
||||
// Reset the public properties back to their original values
|
||||
waitTime = 1;
|
||||
randomWait = false;
|
||||
randomWaitMin = 1;
|
||||
randomWaitMax = 1;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67824d2e00531d84db9973773e4426e9
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Actions/Wait.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02c91ef526a3f8a41b5df4402d7c783f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,86 @@
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Similar to the sequence task, the parallel task will run each child task until a child task returns failure. " +
|
||||
"The difference is that the parallel task will run all of its children tasks simultaneously versus running each task one at a time. " +
|
||||
"Like the sequence class, the parallel task will return success once all of its children tasks have return success. " +
|
||||
"If one tasks returns failure the parallel task will end all of the child tasks and return failure.")]
|
||||
[TaskIcon("{SkinColor}ParallelIcon.png")]
|
||||
public class Parallel : Composite
|
||||
{
|
||||
// The index of the child that is currently running or is about to run.
|
||||
private int currentChildIndex;
|
||||
// The task status of every child task.
|
||||
private TaskStatus[] executionStatus;
|
||||
|
||||
public override void OnAwake()
|
||||
{
|
||||
// Create a new task status array that will hold the execution status of all of the children tasks.
|
||||
executionStatus = new TaskStatus[children.Count];
|
||||
}
|
||||
|
||||
public override void OnChildStarted(int childIndex)
|
||||
{
|
||||
// One of the children has started to run. Increment the child index and set the current task status of that child to running.
|
||||
currentChildIndex++;
|
||||
executionStatus[childIndex] = TaskStatus.Running;
|
||||
}
|
||||
|
||||
public override bool CanRunParallelChildren()
|
||||
{
|
||||
// This task can run parallel children.
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int CurrentChildIndex()
|
||||
{
|
||||
return currentChildIndex;
|
||||
}
|
||||
|
||||
public override bool CanExecute()
|
||||
{
|
||||
// We can continue executing if we have more children that haven't been started yet.
|
||||
return currentChildIndex < children.Count;
|
||||
}
|
||||
|
||||
public override void OnChildExecuted(int childIndex, TaskStatus childStatus)
|
||||
{
|
||||
// One of the children has finished running. Set the task status.
|
||||
executionStatus[childIndex] = childStatus;
|
||||
}
|
||||
|
||||
public override TaskStatus OverrideStatus(TaskStatus status)
|
||||
{
|
||||
// Assume all of the children have finished executing. Loop through the execution status of every child and check to see if any tasks are currently running
|
||||
// or failed. If a task is still running then all of the children are not done executing and the parallel task should continue to return a task status of running.
|
||||
// If a task failed then return failure. The Behavior Manager will stop all of the children tasks. If no child task is running or has failed then the parallel
|
||||
// task succeeded and it will return success.
|
||||
bool childrenComplete = true;
|
||||
for (int i = 0; i < executionStatus.Length; ++i) {
|
||||
if (executionStatus[i] == TaskStatus.Running) {
|
||||
childrenComplete = false;
|
||||
} else if (executionStatus[i] == TaskStatus.Failure) {
|
||||
return TaskStatus.Failure;
|
||||
}
|
||||
}
|
||||
return (childrenComplete ? TaskStatus.Success : TaskStatus.Running);
|
||||
}
|
||||
|
||||
public override void OnConditionalAbort(int childIndex)
|
||||
{
|
||||
// Start from the beginning on an abort
|
||||
currentChildIndex = 0;
|
||||
for (int i = 0; i < executionStatus.Length; ++i) {
|
||||
executionStatus[i] = TaskStatus.Inactive;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnEnd()
|
||||
{
|
||||
// Reset the execution status and the child index back to their starting values.
|
||||
for (int i = 0; i < executionStatus.Length; ++i) {
|
||||
executionStatus[i] = TaskStatus.Inactive;
|
||||
}
|
||||
currentChildIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a7063721a0dbc04787bec1b0507f9ae
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Composites/Parallel.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,81 @@
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Similar to the parallel selector task, except the parallel complete task will return the child status as soon as the child returns success or failure." +
|
||||
"The child tasks are executed simultaneously.")]
|
||||
[TaskIcon("{SkinColor}ParallelCompleteIcon.png")]
|
||||
public class ParallelComplete : Composite
|
||||
{
|
||||
// The index of the child that is currently running or is about to run.
|
||||
private int currentChildIndex;
|
||||
// The task status of every child task.
|
||||
private TaskStatus[] executionStatus;
|
||||
|
||||
public override void OnAwake()
|
||||
{
|
||||
// Create a new task status array that will hold the execution status of all of the children tasks.
|
||||
executionStatus = new TaskStatus[children.Count];
|
||||
}
|
||||
|
||||
public override void OnChildStarted(int childIndex)
|
||||
{
|
||||
// One of the children has started to run. Increment the child index and set the current task status of that child to running.
|
||||
currentChildIndex++;
|
||||
executionStatus[childIndex] = TaskStatus.Running;
|
||||
}
|
||||
|
||||
public override bool CanRunParallelChildren()
|
||||
{
|
||||
// This task can run parallel children.
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int CurrentChildIndex()
|
||||
{
|
||||
return currentChildIndex;
|
||||
}
|
||||
|
||||
public override bool CanExecute()
|
||||
{
|
||||
// We can continue executing if we have more children that haven't been started yet.
|
||||
return currentChildIndex < children.Count;
|
||||
}
|
||||
|
||||
public override void OnChildExecuted(int childIndex, TaskStatus childStatus)
|
||||
{
|
||||
// One of the children has finished running. Set the task status.
|
||||
executionStatus[childIndex] = childStatus;
|
||||
}
|
||||
|
||||
public override void OnConditionalAbort(int childIndex)
|
||||
{
|
||||
// Start from the beginning on an abort
|
||||
currentChildIndex = 0;
|
||||
for (int i = 0; i < executionStatus.Length; ++i) {
|
||||
executionStatus[i] = TaskStatus.Inactive;
|
||||
}
|
||||
}
|
||||
|
||||
public override TaskStatus OverrideStatus(TaskStatus status)
|
||||
{
|
||||
if (currentChildIndex == 0) {
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
// Return the child task's status as soon as a child task returns success or failure.
|
||||
for (int i = 0; i < currentChildIndex; ++i) {
|
||||
if (executionStatus[i] == TaskStatus.Success || executionStatus[i] == TaskStatus.Failure) {
|
||||
return executionStatus[i];
|
||||
}
|
||||
}
|
||||
return TaskStatus.Running;
|
||||
}
|
||||
|
||||
public override void OnEnd()
|
||||
{
|
||||
// Reset the execution status and the child index back to their starting values.
|
||||
for (int i = 0; i < executionStatus.Length; ++i) {
|
||||
executionStatus[i] = TaskStatus.Inactive;
|
||||
}
|
||||
currentChildIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef4b3eb51f6ede04bba3598677fe8531
|
||||
timeCreated: 1487379311
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 15277
|
||||
packageName: Behavior Designer - Behavior Trees for Everyone
|
||||
packageVersion: 1.7.7p1
|
||||
assetPath: Assets/Behavior Designer/Runtime/Tasks/Composites/ParallelComplete.cs
|
||||
uploadId: 598781
|
@ -0,0 +1,86 @@
|
||||
namespace BehaviorDesigner.Runtime.Tasks
|
||||
{
|
||||
[TaskDescription("Similar to the selector task, the parallel selector task will return success as soon as a child task returns success. " +
|
||||
"The difference is that the parallel task will run all of its children tasks simultaneously versus running each task one at a time. " +
|
||||
"If one tasks returns success the parallel selector task will end all of the child tasks and return success. " +
|
||||
"If every child task returns failure then the parallel selector task will return failure.")]
|
||||
[TaskIcon("{SkinColor}ParallelSelectorIcon.png")]
|
||||
public class ParallelSelector : Composite
|
||||
{
|
||||
// The index of the child that is currently running or is about to run.
|
||||
private int currentChildIndex;
|
||||
// The task status of every child task.
|
||||
private TaskStatus[] executionStatus;
|
||||
|
||||
public override void OnAwake()
|
||||
{
|
||||
// Create a new task status array that will hold the execution status of all of the children tasks.
|
||||
executionStatus = new TaskStatus[children.Count];
|
||||
}
|
||||
|
||||
public override void OnChildStarted(int childIndex)
|
||||
{
|
||||
// One of the children has started to run. Increment the child index and set the current task status of that child to running.
|
||||
currentChildIndex++;
|
||||
executionStatus[childIndex] = TaskStatus.Running;
|
||||
}
|
||||
|
||||
public override bool CanRunParallelChildren()
|
||||
{
|
||||
// This task can run parallel children.
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int CurrentChildIndex()
|
||||
{
|
||||
return currentChildIndex;
|
||||
}
|
||||
|
||||
public override bool CanExecute()
|
||||
{
|
||||
// We can continue executing if we have more children that haven't been started yet.
|
||||
return currentChildIndex < children.Count;
|
||||
}
|
||||
|
||||
public override void OnChildExecuted(int childIndex, TaskStatus childStatus)
|
||||
{
|
||||
// One of the children has finished running. Set the task status.
|
||||
executionStatus[childIndex] = childStatus;
|
||||
}
|
||||
|
||||
public override void OnConditionalAbort(int childIndex)
|
||||
{
|
||||
// Start from the beginning on an abort
|
||||
currentChildIndex = 0;
|
||||
for (int i = 0; i < executionStatus.Length; ++i) {
|
||||
executionStatus[i] = TaskStatus.Inactive;
|
||||
}
|
||||
}
|
||||
|
||||
public override TaskStatus OverrideStatus(TaskStatus status)
|
||||
{
|
||||
// Assume all of the children have finished executing. Loop through the execution status of every child and check to see if any tasks are currently running
|
||||
// or succeeded. If a task is still running then all of the children are not done executing and the parallel selector task should continue to return a task status of running.
|
||||
// If a task succeeded then return success. The Behavior Manager will stop all of the children tasks. If no child task is running or has succeeded then the parallel selector
|
||||
// task failed and it will return failure.
|
||||
bool childrenComplete = true;
|
||||
for (int i = 0; i < executionStatus.Length; ++i) {
|
||||
if (executionStatus[i] == TaskStatus.Running) {
|
||||
childrenComplete = false;
|
||||
} else if (executionStatus[i] == TaskStatus.Success) {
|
||||
return TaskStatus.Success;
|
||||
}
|
||||
}
|
||||
return (childrenComplete ? TaskStatus.Failure : TaskStatus.Running);
|
||||
}
|
||||
|
||||
public override void OnEnd()
|
||||
{
|
||||
// Reset the execution status and the child index back to their starting values.
|
||||
for (int i = 0; i < executionStatus.Length; ++i) {
|
||||
executionStatus[i] = TaskStatus.Inactive;
|
||||
}
|
||||
currentChildIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user