diff --git a/Assets/Behavior_Danceoff.cs b/Assets/Behavior_Danceoff.cs new file mode 100644 index 00000000..85fd070d --- /dev/null +++ b/Assets/Behavior_Danceoff.cs @@ -0,0 +1,391 @@ +using UnityEngine; +using System; +using System.Collections; +using TreeSharpPlus; + +public class Behavior_Danceoff : MonoBehaviour { + //public Transform wander1; + //public Transform wander2; + //public Transform wander3; + public GameObject drink; + public GameObject door; + public Transform doorOpenPoint; + + public Transform wander1; + public Transform wander2; + + public GameObject Darrell; + public GameObject Damien; + + // public Animation a; + public GameObject participant; + public GameObject participant1; + public GameObject participant2; + public GameObject participant3; + public GameObject participant4; + public GameObject participant5; + public GameObject participant6; + public GameObject participant7; + + private bool idleMode; + + private BehaviorAgent mainBehaviorAgent; + private BehaviorAgent behaviorAgent; + private BehaviorAgent behaviorAgent1; + private BehaviorAgent behaviorAgent2; + private BehaviorAgent behaviorAgent3; + // Use this for initialization + void Start() { + /* + behaviorAgent = new BehaviorAgent(this.Talking()); + behaviorAgent1 = new BehaviorAgent(this.Texting()); + behaviorAgent2 = new BehaviorAgent(this.Dance()); + behaviorAgent3 = new BehaviorAgent(this.DanceForever()); + BehaviorManager.Instance.Register(behaviorAgent); + BehaviorManager.Instance.Register(behaviorAgent1); + BehaviorManager.Instance.Register(behaviorAgent2); + BehaviorManager.Instance.Register(behaviorAgent3); + behaviorAgent.StartBehavior(); + behaviorAgent1.StartBehavior(); + behaviorAgent2.StartBehavior(); + behaviorAgent3.StartBehavior(); + */ + idleMode = true; + behaviorAgent = new BehaviorAgent(this.BuildTreeRoot()); + BehaviorManager.Instance.Register(behaviorAgent); + behaviorAgent.StartBehavior(); + } + + // Update is called once per frame + void Update() { + } + + protected Node Face(string s) { + Val name = Val.V(() => s); + return new Sequence(participant.GetComponent().ST_PlayFaceGesture(name, 4000)); + } + + protected Node ST_ApproachAndWait(Transform target) { + Val position = Val.V(() => target.position); + return new Sequence(participant.GetComponent().Node_GoTo(position), new LeafWait(5000)); + } + + protected Node ST_ApproachAndWait(GameObject participant, Transform target) { + Vector3 a = (target.position - participant.transform.position).normalized; + Val position = Val.V(() => (target.position - a)); + return new Sequence(participant.GetComponent().Node_GoTo(position), new LeafWait(1000)); + } + + protected Node ST_ApproachAndWait(GameObject participant, GameObject participant2) { + Vector3 a = (participant2.transform.position - participant.transform.position).normalized * 1; + Vector3 b = new Vector3(a.x, participant2.transform.position.y, a.z); + + + Val position = Val.V(() => (participant2.transform.position - b)); + return new Sequence(participant.GetComponent().Node_GoTo(position)); + } + + protected Node ST_ApproachAndWait4(Transform target) { + Val position = Val.V(() => target.position); + return new Sequence(participant4.GetComponent().Node_GoTo(position), new LeafWait(1000)); + } + + protected Node ST_Approach(Transform target) { + Val position = Val.V(() => target.position); + return new Sequence(Darrell.GetComponent().Node_GoTo(position)); + } + + protected Node ST_Approach(GameObject p, Vector3 t) { + Val position = Val.V(() => t); + return new Sequence(Darrell.GetComponent().Node_GoTo(position)); + } + + protected Node ST_WaitRandom(long min, long max) { + return new Sequence(new LeafWait((long)(((max - min) * UnityEngine.Random.value) + min))); + } + + protected Node ST_Wait(long t) { + return new Sequence(new LeafWait(t)); + } + + protected Node ST_PickupObject(GameObject target) { + return null; + } + + protected Node ST_Sit() { + return new Sequence(new LeafInvoke(() => Damien.GetComponent().Character.SitDown())); + } + + protected Node ST_Stand() { + return new Sequence(new LeafInvoke(() => Damien.GetComponent().Character.StandUp())); + } + + protected Node ST_Drink() { + Val name = Val.V(() => "DRINK"); + return new Sequence(Damien.GetComponent().ST_PlayFaceGesture(name, 3000)); + } + + protected Node ST_OpenDoor() { + Val name = Val.V(() => "POINTING"); + if (door.GetComponent().isOpen()) { + return new Sequence(); + } + else { + return new Sequence(Darrell.GetComponent().ST_PlayHandGesture(name, 500), new LeafInvoke(() => door.GetComponent().openDoor())); + } + } + + //Made these different nodes for each of the different participants + protected Node CrowdGather(string s) { + Val name = Val.V(() => s); + return new Sequence(participant.GetComponent().ST_PlayHandGesture(name, 4000)); + } + protected Node CrowdGather4(string s) { + Val name = Val.V(() => s); + return new Sequence(participant4.GetComponent().ST_PlayFaceGesture(name, 4000)); + } + protected Node CrowdGather5(string s) { + Val name = Val.V(() => s); + return new Sequence(participant5.GetComponent().ST_PlayHandGesture(name, 4000)); + } + protected Node CrowdGather6(string s) { + Val name = Val.V(() => s); + return new Sequence(participant6.GetComponent().ST_PlayHandGesture(name, 4000)); + } + protected Node CrowdGather1(string s) { + Val name = Val.V(() => s); + return new Sequence(participant1.GetComponent().ST_PlayHandGesture(name, 4000)); + } + protected Node CrowdGather7(string s) { + Val name = Val.V(() => s); + return new Sequence(participant7.GetComponent().ST_PlayHandGesture(name, 4000)); + } + + protected Node ST_TurnToFace(GameObject g, Vector3 target) { + Val position = Val.V(() => target); + return new Sequence(g.GetComponent().ST_TurnToFace(target)); + } + + + //Test to see if it was working + protected Node Tester() { + return new DecoratorLoop( + new Randomm( + CrowdGather("CHEER"), + CrowdGather("CLAP"))); + } + + protected Node EndLoop() { + return new DecoratorLoop(new Sequence(participant1.GetComponent().ST_PlayHandGesture("SATNIGHTFEVER", 1000))); + } + + protected Node Talking() { + return new DecoratorLoop( + new Sequence( + ST_ApproachAndWait(wander2), + ST_ApproachAndWait4(wander1), + ST_TurnToFace(participant, participant4.transform.position), + ST_TurnToFace(participant4, participant.transform.position), + + new SequenceParallel( + CrowdGather("BEINGCOCKY"), + CrowdGather4("HEADSHAKE") + ))); + } + + //Behavior for Daniels 5&6 + protected Node Texting() { + return new DecoratorLoop( + new SequenceParallel( + CrowdGather5("TEXTING"), + CrowdGather6("TEXTING"))); + } + + //For Daniel 1, who dances until the danceoff + protected Node Dance() { + return new DecoratorLoop( + new Sequence(CrowdGather1("SATNIGHTFEVER"))); + } + + //For Daniel 7, he dances forever + protected Node DanceForever() { + return new DecoratorLoop( + new Sequence(CrowdGather7("SATNIGHTFEVER"))); + } + + protected Node ST_GetCloseTo(GameObject participant, GameObject participant2) { + Vector3 a = (participant2.transform.position - participant.transform.position).normalized * 3; + Vector3 b = new Vector3(a.x, participant2.transform.position.y, a.z); + + + Val position = Val.V(() => (participant2.transform.position - b)); + return new Sequence(participant.GetComponent().Node_GoTo(position)); + } + + protected Node ST_Dance(GameObject participan) { + Val be = Val.V(() => "BREAKDANCE"); + return new Sequence(participan.GetComponent().ST_PlayBodyGesture(be, 5000), new LeafWait(1000)); + } + protected Node ST_StepBack(GameObject participant) { + Val be = Val.V(() => "STEPBACK"); + return new Sequence(participant.GetComponent().ST_PlayBodyGesture(be, 2000), new LeafWait(500)); + } + protected Node ST_CallOver(GameObject participant) { + print("x"); + Val be = Val.V(() => "CALLOVER"); + return new Sequence(participant.GetComponent().ST_PlayHandGesture(be, 1500), new LeafWait(500)); + } + protected Node ST_Drink(GameObject participant) { + Val be = Val.V(() => "DRINK"); + return new Sequence(participant.GetComponent().ST_PlayFaceGesture(be, 5000), new LeafWait(500)); + } + protected Node ST_ShakeHead(GameObject participant) { + Val be = Val.V(() => "HEADSHAKETHINK"); + return new Sequence(participant.GetComponent().ST_PlayFaceGesture(be, 3000), new LeafWait(500)); + } + protected Node ST_Yawn(GameObject participant) { + Val be = Val.V(() => "YAWN"); + return new Sequence(participant.GetComponent().ST_PlayHandGesture(be, 7000), new LeafWait(2000)); + } + protected Node ST_Clap(GameObject participant) { + Val be = Val.V(() => "CLAP"); + return new Sequence(participant.GetComponent().ST_PlayHandGesture(be, 2000), new LeafWait(2000)); + } + protected Node ST_BeingCocky(GameObject participant) { + Val be = Val.V(() => "BEINGCOCKY"); + return new Sequence(participant.GetComponent().ST_PlayHandGesture(be, 2000), new LeafWait(2000)); + } + + protected Node ST_LookStand(GameObject participant, GameObject participant2) { + Vector3 a = new Vector3(0, 1.8f, 0); + Val position = Val.V(() => (participant2.transform.position + a)); + return new Sequence(participant.GetComponent().Node_HeadLookTurnFirst(position), new LeafWait(500)); + } + protected Node ST_LookDance(GameObject participant, GameObject participant2) { + Vector3 a = new Vector3(0, 0.8f, 0); + Val position = Val.V(() => (participant2.transform.position + a)); + return new Sequence(participant.GetComponent().Node_HeadLookTurnFirst(position), new LeafWait(500)); + } + protected Node WalkTowards(GameObject participant, GameObject participant2) { + return new Sequence(this.ST_LookStand(participant, participant2), this.ST_ApproachAndWait(participant, participant2)); + } + + protected Node AbInteraction() { + + Node roaming = + new Sequence( + this.ST_Stand(), + //this.ST_Drink(main1), + //this.ST_LookStand(main2, main1), + this.ST_LookStand(Darrell, Damien), + this.ST_GetCloseTo(Darrell, Damien), + this.ST_CallOver(Darrell), + this.WalkTowards(Damien, Darrell), + this.ST_ShakeHead(Damien), + this.ST_StepBack(Damien), + new SequenceParallel(this.DanceOfff(), + this.ST_LookDance(Darrell, Damien)) + + ); + return roaming; + } + protected Node RandonSuccess() { + Node result = new TreeSharpPlus.RandomS(); + return result; + + } + protected Node DanceReact(GameObject participant) { + Node result = new Randomm(this.ST_Yawn(participant), this.ST_BeingCocky(participant), this.ST_Clap(participant)); + return result; + + } + protected Node DanceOfff() { + //float c = 5; + Node dance = + new Sequence( + + this.ST_Dance(Damien), this.DanceReact(Darrell), + new DecoratorInvert(new DecoratorLoop(new Sequence( + this.ST_StepBack(Darrell), this.ST_Dance(Darrell), this.DanceReact(Damien), RandonSuccess(), this.ST_StepBack(Damien), this.ST_Dance(Damien), this.DanceReact(Darrell)))), + this.ST_CallOver(Darrell) + + ); + //new DecoratorLoop(new Sequence(this.RandonSuccess())); + return dance; + } + + protected Node GeneralCrowd() { + return new Sequence( + new DecoratorLoop( + new SequenceParallel( + Talking(), + Texting(), + Dance(), + DanceForever() + ))); + } + + protected Node PersonAEnter() { + return new Sequence( + ST_Approach(doorOpenPoint), + ST_OpenDoor() + ); + } + + protected Node PersonBIdle() { + return new Sequence(ST_Sit(), + new DecoratorLoop( + new Sequence( + ST_WaitRandom(2000, 6000), + ST_Drink()))); + } + + protected Node Kick() { + + Val name = Val.V(() => "PICKUPLEFT"); + return Darrell.GetComponent().ST_PlayBodyGesture(name, 3000); + } + + protected Node FallDown() { + Val name = Val.V(() => "PICKUPRIGHT"); + return participant2.GetComponent().ST_PlayBodyGesture(name, 3000); + } + protected Node PersonKickInteraction() { + return new Sequence(this.PersonAEnter(), new LeafWait(2000), ST_Approach(Darrell, new Vector3(-6.6f, 0.1f, 10.2f)), + new SequenceParallel( + this.Kick(), + this.FallDown(), + new LeafInvoke(() => setMode(false)) + + )); + } + + void setMode(bool val) { + idleMode = val; + } + + bool assertMode2() { + return idleMode; + } + + protected Node assertMode() { + return new LeafAssert(assertMode2); + } + + protected Node BuildTreeRoot() { + Node roaming = + new Selector( + new SequenceParallel( + this.GeneralCrowd(), + this.PersonKickInteraction(), + this.PersonBIdle(), + new DecoratorLoop( + this.assertMode()) + ), + new SequenceParallel( + this.AbInteraction() + //cup grab + )); + return roaming; + } +} \ No newline at end of file diff --git a/Assets/Behavior_Danceoff.cs.meta b/Assets/Behavior_Danceoff.cs.meta new file mode 100644 index 00000000..efea58fb --- /dev/null +++ b/Assets/Behavior_Danceoff.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a15ccab32c2d6ed4295d5321e9c0e93d +timeCreated: 1477873613 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Behavior_Drink.cs b/Assets/Behavior_Drink.cs new file mode 100644 index 00000000..abc21d32 --- /dev/null +++ b/Assets/Behavior_Drink.cs @@ -0,0 +1,87 @@ +using UnityEngine; +using System; +using System.Collections; +using TreeSharpPlus; + +public class Behavior_Drink : MonoBehaviour { + //public Transform wander1; + //public Transform wander2; + //public Transform wander3; + public GameObject participant; + public GameObject drink; + public GameObject door; + public Transform doorOpenPoint; + + private BehaviorAgent behaviorAgent; + // Use this for initialization + void Start() { + behaviorAgent = new BehaviorAgent(this.BuildTreeRoot()); + BehaviorManager.Instance.Register(behaviorAgent); + behaviorAgent.StartBehavior(); + } + + // Update is called once per frame + void Update() { + } + + protected Node ST_ApproachAndWait(Transform target) { + Val position = Val.V(() => target.position); + return new Sequence(participant.GetComponent().Node_GoTo(position), new LeafWait(5000)); + } + + protected Node ST_Approach(Transform target) { + Val position = Val.V(() => target.position); + return new Sequence(participant.GetComponent().Node_GoTo(position)); + } + + protected Node ST_WaitRandom(long min, long max) { + return new Sequence(new LeafWait((long)(((max - min) * UnityEngine.Random.value) + min))); + } + + protected Node ST_Wait(long t) { + return new Sequence(new LeafWait(t)); + } + + protected Node ST_PickupObject(GameObject target) { + return null; + } + + protected Node ST_Sit() { + return new Sequence(new LeafInvoke(() => participant.GetComponent().Character.SitDown())); + } + + protected Node ST_Stand() { + return new Sequence(new LeafInvoke(() => participant.GetComponent().Character.StandUp())); + } + + protected Node ST_Drink() { + Val name = Val.V(() => "DRINK"); + return new Sequence(participant.GetComponent().ST_PlayFaceGesture(name, 3000)); + } + + protected Node ST_OpenDoor() { + Val name = Val.V(() => "POINTING"); + if (door.GetComponent().isOpen()) { + return new Sequence(); + } + else { + return new Sequence(participant.GetComponent().ST_PlayHandGesture(name, 500), new LeafInvoke(() => door.GetComponent().openDoor())); + } + } + + protected Node BuildTreeRoot() { + Node roaming = + new Sequence( + //ST_PickupObject(drink), + //ST_Sit(), + ST_Approach(doorOpenPoint), + //new DecoratorLoop( + //new Sequence( + //ST_WaitRandom(2000, 6000), + //ST_Drink(); + //)), + ST_OpenDoor()); + //ST_Stand() + return roaming; + } +} \ No newline at end of file diff --git a/Assets/Behavior_Drink.cs.meta b/Assets/Behavior_Drink.cs.meta new file mode 100644 index 00000000..cac6677e --- /dev/null +++ b/Assets/Behavior_Drink.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a50e5e65e343a0642a93325ae43d0b1e +timeCreated: 1477794714 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/CameraController.cs b/Assets/CameraController.cs new file mode 100644 index 00000000..2e254c5c --- /dev/null +++ b/Assets/CameraController.cs @@ -0,0 +1,32 @@ +using UnityEngine; +using System.Collections; + +public class CameraController : MonoBehaviour { + + public int speed; + public int rotSpeed; + public GameObject door; + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + } + + void FixedUpdate() { + if (Input.GetButtonDown("Jump")) { + door.GetComponent().openDoor(); + } + if (Input.GetButton("Fire3")) { + transform.Rotate(0.0f, Input.GetAxis("Mouse X") * rotSpeed, 0.0f, Space.World); + transform.Rotate(-Input.GetAxis("Mouse Y") * rotSpeed, 0.0f, 0.0f); + } + Vector3 pan = new Vector3(Input.GetAxis("Horizontal") * 0.01f * speed, 0.0f, Input.GetAxis("Vertical") * 0.01f * speed); + Vector3 zoom = new Vector3(0.0f, Input.GetAxis("Mouse ScrollWheel") * 0.05f * speed, 0.0f); + transform.Translate(pan); + transform.Translate(zoom); + } +} diff --git a/Assets/CameraController.cs.meta b/Assets/CameraController.cs.meta new file mode 100644 index 00000000..7e367785 --- /dev/null +++ b/Assets/CameraController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: be22765cc574fa14c9f938ab5a1de484 +timeCreated: 1477864532 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Core/Animations/MotionAvatar/Locomotion/Dive.fbm.meta b/Assets/Core/Animations/MotionAvatar/Locomotion/Dive.fbm.meta index 5f2cc9b1..ebc91de4 100644 --- a/Assets/Core/Animations/MotionAvatar/Locomotion/Dive.fbm.meta +++ b/Assets/Core/Animations/MotionAvatar/Locomotion/Dive.fbm.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 0f0453710ef178f439b008b6a5a80e87 +guid: b14cb360ef55d6446bf5f110b17d0f79 folderAsset: yes -timeCreated: 1476732703 +timeCreated: 1477516217 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Core/Animations/MotionAvatar/Locomotion/JumpUpHigh.fbm.meta b/Assets/Core/Animations/MotionAvatar/Locomotion/JumpUpHigh.fbm.meta index 4c3305b2..38d2e734 100644 --- a/Assets/Core/Animations/MotionAvatar/Locomotion/JumpUpHigh.fbm.meta +++ b/Assets/Core/Animations/MotionAvatar/Locomotion/JumpUpHigh.fbm.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 0817f4af49a61c040b0ba742eb1a4463 +guid: b2a00cb9bd0617d41b23b06324aa8d06 folderAsset: yes -timeCreated: 1476732703 +timeCreated: 1477516217 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Core/Controllers/CharacterController.controller b/Assets/Core/Controllers/CharacterController.controller index aa7d0a6d..7586b399 100644 Binary files a/Assets/Core/Controllers/CharacterController.controller and b/Assets/Core/Controllers/CharacterController.controller differ diff --git a/Assets/Core/Libraries/RootMotion/FinalIK/_DEMOS/Assets/Interaction Animations/Button/Red.mat b/Assets/Core/Libraries/RootMotion/FinalIK/_DEMOS/Assets/Interaction Animations/Button/Red.mat index a85fa993..7353a82b 100644 Binary files a/Assets/Core/Libraries/RootMotion/FinalIK/_DEMOS/Assets/Interaction Animations/Button/Red.mat and b/Assets/Core/Libraries/RootMotion/FinalIK/_DEMOS/Assets/Interaction Animations/Button/Red.mat differ diff --git a/Assets/Core/Materials/beer color.mat b/Assets/Core/Materials/beer color.mat new file mode 100644 index 00000000..43010fa2 Binary files /dev/null and b/Assets/Core/Materials/beer color.mat differ diff --git a/Assets/Core/Materials/beer color.mat.meta b/Assets/Core/Materials/beer color.mat.meta new file mode 100644 index 00000000..ca364193 --- /dev/null +++ b/Assets/Core/Materials/beer color.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a5cb54feada62ed44960c502f45c05e1 +timeCreated: 1477791275 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Core/Scripts/Behavior/BehaviorUpdater.cs b/Assets/Core/Scripts/Behavior/BehaviorUpdater.cs index 8ba1040a..a3bbb573 100644 --- a/Assets/Core/Scripts/Behavior/BehaviorUpdater.cs +++ b/Assets/Core/Scripts/Behavior/BehaviorUpdater.cs @@ -2,7 +2,8 @@ using System; using System.Collections; - +/*Object responsible for ticking all the trees, the overall clock generator. + * Runs the updater for behavior manager*/ public class BehaviorUpdater : MonoBehaviour { public float updateTime = 0.05f; diff --git a/Assets/Core/Scripts/Behavior/TreeSharpPlus/RandomS.cs b/Assets/Core/Scripts/Behavior/TreeSharpPlus/RandomS.cs new file mode 100644 index 00000000..00327847 --- /dev/null +++ b/Assets/Core/Scripts/Behavior/TreeSharpPlus/RandomS.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text; +using System.Reflection; +using System.Reflection.Emit; +using UnityEngine; +using System.Collections; + +namespace TreeSharpPlus { + /// + /// Evaluates a lambda function. Returns RunStatus.Success if the lambda + /// evaluates to true. Returns RunStatus.Failure if it evaluates to false. + /// + public class RandomS : Node { + protected Func func_assert = null; + + public RandomS() { + + } + + public override IEnumerable Execute() { + int x = UnityEngine.Random.Range(0, 10); + Debug.Log(x); + Func a = () => (x > 3); + this.func_assert = a; + if (this.func_assert != null) { + bool result = this.func_assert.Invoke(); + //Debug.Log(result); + if (result == true) + yield return RunStatus.Success; + else + yield return RunStatus.Failure; + yield break; + } + else { + throw new ApplicationException(this + ": No method given"); + } + } + } +} \ No newline at end of file diff --git a/Assets/Core/Scripts/Behavior/TreeSharpPlus/RandomS.cs.meta b/Assets/Core/Scripts/Behavior/TreeSharpPlus/RandomS.cs.meta new file mode 100644 index 00000000..5d30ca7a --- /dev/null +++ b/Assets/Core/Scripts/Behavior/TreeSharpPlus/RandomS.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 640e1c0d9fc277c4c9b39f2c1eae5034 +timeCreated: 1477880480 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Core/Scripts/Behavior/TreeSharpPlus/Randomm.cs b/Assets/Core/Scripts/Behavior/TreeSharpPlus/Randomm.cs new file mode 100644 index 00000000..e821899b --- /dev/null +++ b/Assets/Core/Scripts/Behavior/TreeSharpPlus/Randomm.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace TreeSharpPlus { + public class Randomm : NodeGroupWeighted { + public Randomm(params NodeWeight[] weightedchildren) + : base(weightedchildren) { + } + + public Randomm(params Node[] children) + : base(children) { + } + + public override void Start() { + this.Shuffle(); + base.Start(); + + } + + public override IEnumerable Execute() { + // Proceed as we do with the original sequence + Node node = this.Children.First(); + + // Move to the next node + this.Selection = node; + node.Start(); + + // If the current node is still running, report that. Don't 'break' the enumerator + RunStatus result; + while ((result = this.TickNode(node)) == RunStatus.Running) + yield return RunStatus.Running; + + // Call Stop to allow the node to clean anything up. + node.Stop(); + + // Clear the selection + this.Selection.ClearLastStatus(); + this.Selection = null; + + if (result == RunStatus.Failure) { + yield return RunStatus.Failure; + yield break; + } + + yield return RunStatus.Running; + + yield return RunStatus.Success; + yield break; + } + } +} \ No newline at end of file diff --git a/Assets/Core/Scripts/Behavior/TreeSharpPlus/Randomm.cs.meta b/Assets/Core/Scripts/Behavior/TreeSharpPlus/Randomm.cs.meta new file mode 100644 index 00000000..cc151dc9 --- /dev/null +++ b/Assets/Core/Scripts/Behavior/TreeSharpPlus/Randomm.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 71a4130d06a661442bf6954ca9294b4f +timeCreated: 1477880429 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/DoorScript.cs b/Assets/DoorScript.cs new file mode 100644 index 00000000..7c246129 --- /dev/null +++ b/Assets/DoorScript.cs @@ -0,0 +1,39 @@ +using UnityEngine; +using System.Collections; + +public class DoorScript : MonoBehaviour { + + public Quaternion closedRot; + public Quaternion openRot; + + private bool open; + + // Use this for initialization + void Start () { + closedRot = transform.rotation; + openRot = Quaternion.Euler(0.0f, 90.0f, 0.0f); + open = false; + } + + public bool isOpen() { + return open; + } + + public void openDoor() { + open = true; + } + + public void closeDoor() { + open = false; + } + + // Update is called once per frame + void Update () { + if(open) { + transform.rotation = Quaternion.Slerp(transform.rotation, openRot, 0.1f); + } + else { + transform.rotation = Quaternion.Slerp(transform.rotation, closedRot, 0.1f); + } + } +} diff --git a/Assets/DoorScript.cs.meta b/Assets/DoorScript.cs.meta new file mode 100644 index 00000000..55adcc36 --- /dev/null +++ b/Assets/DoorScript.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b26977b46636f5b4784237a5ed068502 +timeCreated: 1477851319 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GeneralCrowd.cs b/Assets/GeneralCrowd.cs new file mode 100644 index 00000000..15582360 --- /dev/null +++ b/Assets/GeneralCrowd.cs @@ -0,0 +1,178 @@ +using UnityEngine; +using System; +using System.Collections; +using TreeSharpPlus; + +public class GeneralCrowd : MonoBehaviour +{ + public Transform wander1; + public Transform wander2; + + // public Animation a; + public GameObject participant; + public GameObject participant1; + public GameObject participant2; + public GameObject participant3; + public GameObject participant4; + public GameObject participant5; + public GameObject participant6; + public GameObject participant7; + + private BehaviorAgent mainBehaviorAgent; + private BehaviorAgent behaviorAgent; + private BehaviorAgent behaviorAgent1; + private BehaviorAgent behaviorAgent2; + private BehaviorAgent behaviorAgent3; + + // Use this for initialization + void Start() + { + behaviorAgent = new BehaviorAgent(this.Talking()); + behaviorAgent1 = new BehaviorAgent(this.Texting()); + behaviorAgent2 = new BehaviorAgent(this.Dance()); + behaviorAgent3 = new BehaviorAgent(this.DanceForever()); + BehaviorManager.Instance.Register(behaviorAgent); + BehaviorManager.Instance.Register(behaviorAgent1); + BehaviorManager.Instance.Register(behaviorAgent2); + BehaviorManager.Instance.Register(behaviorAgent3); + behaviorAgent.StartBehavior(); + behaviorAgent1.StartBehavior(); + behaviorAgent2.StartBehavior(); + behaviorAgent3.StartBehavior(); + } + + // Update is called once per frame + void Update() + { + + } + + protected Node Face(string s) + { + Val name = Val.V(() => s); + return new Sequence(participant.GetComponent().ST_PlayFaceGesture(name, 4000)); + } + + + + + //Used for participant and participant4 so they walk to a certain location before talking + protected Node ST_ApproachAndWait(Transform target) + { + Val position = Val.V(() => target.position); + return new Sequence(participant.GetComponent().Node_GoTo(position), new LeafWait(1000)); + } + protected Node ST_ApproachAndWait4(Transform target) + { + Val position = Val.V(() => target.position); + return new Sequence(participant4.GetComponent().Node_GoTo(position), new LeafWait(1000)); + } + + + + //Made these different nodes for each of the different participants + protected Node CrowdGather(string s) + { + Val name = Val.V(() => s); + return new Sequence(participant.GetComponent().ST_PlayHandGesture(name, 4000)); + } + protected Node CrowdGather4(string s) + { + Val name = Val.V(() => s); + return new Sequence(participant4.GetComponent().ST_PlayFaceGesture(name, 4000)); + } + protected Node CrowdGather5(string s) + { + Val name = Val.V(() => s); + return new Sequence(participant5.GetComponent().ST_PlayHandGesture(name, 4000)); + } + protected Node CrowdGather6(string s) + { + Val name = Val.V(() => s); + return new Sequence(participant6.GetComponent().ST_PlayHandGesture(name, 4000)); + } + protected Node CrowdGather1(string s) + { + Val name = Val.V(() => s); + return new Sequence(participant1.GetComponent().ST_PlayHandGesture(name, 4000)); + } + protected Node CrowdGather7(string s) + { + Val name = Val.V(() => s); + return new Sequence(participant7.GetComponent().ST_PlayHandGesture(name, 4000)); + } + + //Make participants face each other + protected Node ST_TurnToFace(GameObject g, Vector3 target) + { + Val position = Val.V(() => target); + return new Sequence(g.GetComponent().ST_TurnToFace(target)); + } + + + //Test to see if it was working + protected Node Tester() + { + return new DecoratorLoop( + new Randomm( + CrowdGather("CHEER"), + CrowdGather("CLAP"))); + } + + protected Node EndLoop() + { + return new DecoratorLoop(new Sequence(participant1.GetComponent().ST_PlayHandGesture("SATNIGHTFEVER", 1000))); + } + + //This is where the main part should happen currently it just makes a person cheer and clap at random then ends the loop + // by making a random person in the back perform a constant action. + protected Node BuildTreeRoot() + { + Node roaming = new SequenceParallel( + + new Sequence(this.ST_ApproachAndWait(wander1), + Tester()), + EndLoop()); + + return roaming; + } + + //Behavior Between Daniel and Daniel4 + protected Node Talking() + { + return new DecoratorLoop( + new Sequence( + ST_ApproachAndWait(wander2), + ST_ApproachAndWait4(wander1), + ST_TurnToFace(participant, participant4.transform.position), + ST_TurnToFace(participant4, participant.transform.position), + + new SequenceParallel( + CrowdGather("BEINGCOCKY"), + CrowdGather4("HEADSHAKE") + ))); + } + + //Behavior for Daniels 5&6 + protected Node Texting() + { + return new DecoratorLoop( + new SequenceParallel( + CrowdGather5("TEXTING"), + CrowdGather6("TEXTING"))); + } + + //For Daniel 1, who dances until the danceoff + protected Node Dance() + { + return new DecoratorLoop( + new Sequence(CrowdGather1("SATNIGHTFEVER"))); + } + + //For Daniel 7, he dances forever + protected Node DanceForever() + { + return new DecoratorLoop( + new Sequence(CrowdGather7("SATNIGHTFEVER"))); + } +} diff --git a/Assets/GeneralCrowd.cs.meta b/Assets/GeneralCrowd.cs.meta new file mode 100644 index 00000000..880dc4ca --- /dev/null +++ b/Assets/GeneralCrowd.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3b621e4b1065f4f4bbbe5216d2a3d1f1 +timeCreated: 1477877821 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/154.mat b/Assets/Materials/154.mat new file mode 100644 index 00000000..069d7860 Binary files /dev/null and b/Assets/Materials/154.mat differ diff --git a/Assets/Materials/154.mat.meta b/Assets/Materials/154.mat.meta new file mode 100644 index 00000000..62c2e4f9 --- /dev/null +++ b/Assets/Materials/154.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 43e748dbbafc8e740ac3700fb5d21b27 +timeCreated: 1477688704 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/164.mat b/Assets/Materials/164.mat new file mode 100644 index 00000000..a03ffd51 Binary files /dev/null and b/Assets/Materials/164.mat differ diff --git a/Assets/Materials/164.mat.meta b/Assets/Materials/164.mat.meta new file mode 100644 index 00000000..9ed6ceac --- /dev/null +++ b/Assets/Materials/164.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3dad0713201c956459153bbb62064027 +timeCreated: 1477772183 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/176.mat b/Assets/Materials/176.mat new file mode 100644 index 00000000..3c57a75c Binary files /dev/null and b/Assets/Materials/176.mat differ diff --git a/Assets/Materials/176.mat.meta b/Assets/Materials/176.mat.meta new file mode 100644 index 00000000..bf35fa1e --- /dev/null +++ b/Assets/Materials/176.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9c9d1cc350f089f46bc9f16a8e01925a +timeCreated: 1477770418 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/178.mat b/Assets/Materials/178.mat new file mode 100644 index 00000000..9dea3a41 Binary files /dev/null and b/Assets/Materials/178.mat differ diff --git a/Assets/Materials/178.mat.meta b/Assets/Materials/178.mat.meta new file mode 100644 index 00000000..3250a5d8 --- /dev/null +++ b/Assets/Materials/178.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f840711bba03da54a93626e30238e141 +timeCreated: 1477688593 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/180.mat b/Assets/Materials/180.mat new file mode 100644 index 00000000..c431119c Binary files /dev/null and b/Assets/Materials/180.mat differ diff --git a/Assets/Materials/180.mat.meta b/Assets/Materials/180.mat.meta new file mode 100644 index 00000000..f0551a9f --- /dev/null +++ b/Assets/Materials/180.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 669c935c6412f7b4cb0c6d9e7be9c984 +timeCreated: 1477688574 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/Beer.mat b/Assets/Materials/Beer.mat new file mode 100644 index 00000000..20dc1d37 Binary files /dev/null and b/Assets/Materials/Beer.mat differ diff --git a/Assets/Materials/Beer.mat.meta b/Assets/Materials/Beer.mat.meta new file mode 100644 index 00000000..dfe1ae70 --- /dev/null +++ b/Assets/Materials/Beer.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4c6bb3c9db6b8bd47897dd95d694cb01 +timeCreated: 1477847204 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/Ketchup.mat b/Assets/Materials/Ketchup.mat new file mode 100644 index 00000000..dc795357 Binary files /dev/null and b/Assets/Materials/Ketchup.mat differ diff --git a/Assets/Materials/Ketchup.mat.meta b/Assets/Materials/Ketchup.mat.meta new file mode 100644 index 00000000..31dc64bb --- /dev/null +++ b/Assets/Materials/Ketchup.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a7a0b13f0a4fa404b9c999c853ca06f2 +timeCreated: 1477778046 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/Metal Stool.mat b/Assets/Materials/Metal Stool.mat new file mode 100644 index 00000000..4215ba8d Binary files /dev/null and b/Assets/Materials/Metal Stool.mat differ diff --git a/Assets/Materials/Metal Stool.mat.meta b/Assets/Materials/Metal Stool.mat.meta new file mode 100644 index 00000000..3f79aa1d --- /dev/null +++ b/Assets/Materials/Metal Stool.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a7614b368afd2f847a0ab4fd86296751 +timeCreated: 1477772367 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/Mustard.mat b/Assets/Materials/Mustard.mat new file mode 100644 index 00000000..2de3dd34 Binary files /dev/null and b/Assets/Materials/Mustard.mat differ diff --git a/Assets/Materials/Mustard.mat.meta b/Assets/Materials/Mustard.mat.meta new file mode 100644 index 00000000..ed7d777b --- /dev/null +++ b/Assets/Materials/Mustard.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bc669900816fc8c41b8c6a098c1bb7d9 +timeCreated: 1477778119 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/Speaker Base.mat b/Assets/Materials/Speaker Base.mat new file mode 100644 index 00000000..847d0bf2 Binary files /dev/null and b/Assets/Materials/Speaker Base.mat differ diff --git a/Assets/Materials/Speaker Base.mat.meta b/Assets/Materials/Speaker Base.mat.meta new file mode 100644 index 00000000..ff2decd5 --- /dev/null +++ b/Assets/Materials/Speaker Base.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 456ad32645f489149bb8ff471f16e74c +timeCreated: 1477778945 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/grass_texture_four.mat b/Assets/Materials/grass_texture_four.mat new file mode 100644 index 00000000..961f0871 Binary files /dev/null and b/Assets/Materials/grass_texture_four.mat differ diff --git a/Assets/Materials/grass_texture_four.mat.meta b/Assets/Materials/grass_texture_four.mat.meta new file mode 100644 index 00000000..9d4fd545 --- /dev/null +++ b/Assets/Materials/grass_texture_four.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 894111598c1d3c64ebc45417ad8f768f +timeCreated: 1477769691 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MyBehaviorTree.cs b/Assets/MyBehaviorTree1.cs similarity index 95% rename from Assets/MyBehaviorTree.cs rename to Assets/MyBehaviorTree1.cs index 7bf54c69..b54ddd39 100644 --- a/Assets/MyBehaviorTree.cs +++ b/Assets/MyBehaviorTree1.cs @@ -3,7 +3,7 @@ using System.Collections; using TreeSharpPlus; -public class MyBehaviorTree : MonoBehaviour +public class MyBehaviorTree1 : MonoBehaviour { public Transform wander1; public Transform wander2; diff --git a/Assets/MyBehaviorTree.cs.meta b/Assets/MyBehaviorTree1.cs.meta similarity index 85% rename from Assets/MyBehaviorTree.cs.meta rename to Assets/MyBehaviorTree1.cs.meta index 52bc57a4..f20aec5f 100644 --- a/Assets/MyBehaviorTree.cs.meta +++ b/Assets/MyBehaviorTree1.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7c73841389b69fe4496193cc003cbc31 +guid: 242303c2548ddb648a17b647e65bb28f timeCreated: 1446935954 licenseType: Free MonoImporter: diff --git a/Assets/MyBehaviorTree3.cs b/Assets/MyBehaviorTree3.cs new file mode 100644 index 00000000..84ec61f6 --- /dev/null +++ b/Assets/MyBehaviorTree3.cs @@ -0,0 +1,50 @@ +using UnityEngine; +using System; +using System.Collections; +using TreeSharpPlus; + +public class MyBehaviorTree3 : MonoBehaviour { + public Transform wander1; + public Transform wander2; + public Transform wander3; + public GameObject participant; + + private BehaviorAgent behaviorAgent; + // Use this for initialization + void Start() { + behaviorAgent = new BehaviorAgent(this.BuildTreeRoot()); + BehaviorManager.Instance.Register(behaviorAgent); + behaviorAgent.StartBehavior(); + } + + // Update is called once per frame + void Update() { + + } + + protected Node ST_ApproachAndWait(Transform target) { + Val position = Val.V(() => target.position); + return new Sequence(participant.GetComponent().Node_GoTo(position), new LeafWait(1000)); + } + + protected Node ST_OpenDoor(Transform target) { + return null; + } + + protected Node ST_Jump() { + Val name = Val.V(() => "DUCK"); + return new Sequence(participant.GetComponent().ST_PlayBodyGesture(name, 2000)); + } + + protected Node BuildTreeRoot() { + Node roaming = new DecoratorLoop( + new Sequence( + this.ST_ApproachAndWait(this.wander1), + this.ST_Jump(), + this.ST_ApproachAndWait(this.wander2), + this.ST_Jump(), + this.ST_ApproachAndWait(this.wander3), + this.ST_Jump())); + return roaming; + } +} diff --git a/Assets/MyBehaviorTree3.cs.meta b/Assets/MyBehaviorTree3.cs.meta new file mode 100644 index 00000000..a95ec668 --- /dev/null +++ b/Assets/MyBehaviorTree3.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 449b156d5c7b3404cb0c3799894bd401 +timeCreated: 1477594534 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MyBehaviorTree4.cs b/Assets/MyBehaviorTree4.cs new file mode 100644 index 00000000..736b4b13 --- /dev/null +++ b/Assets/MyBehaviorTree4.cs @@ -0,0 +1,159 @@ +using UnityEngine; +using System; +using System.Collections; +using TreeSharpPlus; + +using RootMotion.FinalIK; +public class MyBehaviorTree4 : MonoBehaviour +{ + + // public Animation a; + public GameObject guyWhoDrinks; + + public GameObject drink; + + public GameObject table; + public GameObject participant2; + + private BehaviorAgent behaviorAgent; + private BehaviorAgent behaviorAgent2; + + + private Vector3 originalPositionOfGuy; + // Use this for initialization + void Start() + { + originalPositionOfGuy = guyWhoDrinks.transform.position; + + //kick + behaviorAgent = new BehaviorAgent(this.barDrinkGuySequence(guyWhoDrinks, "DRINK",500)); + BehaviorManager.Instance.Register(behaviorAgent); + + + + + + behaviorAgent.StartBehavior(); + + + /* + //die + behaviorAgent2 = new BehaviorAgent(this.BuildTreeRoot3(participant2, "STEPBACK", 4000)); + BehaviorManager.Instance.Register(behaviorAgent2); + behaviorAgent2.StartBehavior(); + */ + + } + + protected Node ST_ApproachAndWait(GameObject p,Transform target) + { + Vector3 targetP = new Vector3(target.position.x + 0.8f, p.transform.position.y, target.position.z ); + Val position = Val.V(() => targetP); + return new Sequence(p.GetComponent().Node_GoTo(position), new LeafWait(1000)); + } + + // Update is called once per frame + void Update() + { + Debug.Log("guy : " + guyWhoDrinks.transform.position+" , table: "+table.transform.position+ ",table t: " + table.GetComponent().bounds.size + " drink: " + drink.transform.position); + + } + + protected Node BodyShit(GameObject p,string s,long milSeconds) + { + Val name = Val.V(() => s); + return new Sequence(p.GetComponent().ST_PlayBodyGesture(name, milSeconds)); + } + protected Node BodyShit2(GameObject p, string s, long milSeconds) + { + Val name = Val.V(() => s); + return new Sequence(new LeafWait(400),p.GetComponent().ST_PlayBodyGesture(name, milSeconds)); + } + protected Node HandShit(GameObject p,string s, long milSeconds) + { + Val name = Val.V(() => s); + return new Sequence(p.GetComponent().ST_PlayHandGesture(name, milSeconds)); + } + protected Node FaceShit(GameObject p,string s, long milSeconds) + { + Val name = Val.V(() => s); + return new Sequence(p.GetComponent().ST_PlayFaceGesture(name, milSeconds)); + } + protected Node Interaction(GameObject p,FullBodyBipedEffector effector, InteractionObject obj) + { + Val n = Val.V(() => effector); + + Val n1 = Val.V(() => obj); + + + return new Sequence(p.GetComponent().Node_StartInteraction(n, n1)); + } + protected Node BuildTreeRoot(GameObject p,String s, long milSeconds) + { + // Animator f = participant.GetComponent(); + + // FullBodyBipedEffector g= f.GetComponent(); + + Node roaming = new DecoratorLoop( + new SequenceShuffle( + + HandShit(p,s, milSeconds) + )); + + // this.Interaction(participant.GetComponent(), + // participant2.GetComponent() + return roaming; + } + protected Node BuildTreeRoot2(GameObject p, String s, long milSeconds) + { + Node roaming = new DecoratorLoop( + + + BodyShit(p, s, milSeconds) + ); + + // this.Interaction(participant.GetComponent(), + // participant2.GetComponent() + return roaming; + } + protected Node BuildTreeRoot3(GameObject p, String s, long milSeconds) + { + Node roaming = new DecoratorLoop( + + + BodyShit2(p, s, milSeconds) + ); + + // this.Interaction(participant.GetComponent(), + // participant2.GetComponent() + return roaming; + } + + protected Node BuildTreeRoot4(GameObject p, String s, long milSeconds) + { + Node roaming = new DecoratorLoop( + + + new Sequence (ST_ApproachAndWait(p,drink.transform), FaceShit(p, s, milSeconds)) + ); + + // this.Interaction(participant.GetComponent(), + // participant2.GetComponent() + return roaming; + } + protected Node barDrinkGuySequence(GameObject p, String s, long milSeconds) + { + + + + // Val position = Val.V(() => targetP); + //Val name = Val.V(() => s); + + Node roaming = new DecoratorLoop( + + + new Sequence(ST_ApproachAndWait(p, drink.transform), FaceShit(p, s, milSeconds)) + ); + return roaming; + } +} diff --git a/Assets/MyBehaviorTree4.cs.meta b/Assets/MyBehaviorTree4.cs.meta new file mode 100644 index 00000000..12c155a9 --- /dev/null +++ b/Assets/MyBehaviorTree4.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 782df234349fb7b4792040779bd7c7cc +timeCreated: 1446935954 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MyBehaviorTreeX.cs b/Assets/MyBehaviorTreeX.cs new file mode 100644 index 00000000..07aa52ef --- /dev/null +++ b/Assets/MyBehaviorTreeX.cs @@ -0,0 +1,140 @@ +using UnityEngine; +using System; +using System.Collections; +using TreeSharpPlus; + +public class MyBehaviorTreex : MonoBehaviour { + public Transform wander1; + public Transform wander2; + public Transform wander3; + public GameObject main1; + public GameObject main2; + public GameObject cup; + + private BehaviorAgent behaviorAgent; + // Use this for initialization + void Start() { + behaviorAgent = new BehaviorAgent(this.AbInteraction()); + BehaviorManager.Instance.Register(behaviorAgent); + behaviorAgent.StartBehavior(); + } + + // Update is called once per frame + void Update() { + + } + + protected Node ST_ApproachAndWait(GameObject participant, Transform target) { + Vector3 a = (target.position - participant.transform.position).normalized; + Val position = Val.V(() => (target.position - a)); + return new Sequence(participant.GetComponent().Node_GoTo(position), new LeafWait(1000)); + } + + protected Node ST_ApproachAndWait(GameObject participant, GameObject participant2) { + Vector3 a = (participant2.transform.position - participant.transform.position).normalized * 1; + Vector3 b = new Vector3(a.x, participant2.transform.position.y, a.z); + + + Val position = Val.V(() => (participant2.transform.position - b)); + return new Sequence(participant.GetComponent().Node_GoTo(position)); + } + protected Node ST_GetCloseTo(GameObject participant, GameObject participant2) { + Vector3 a = (participant2.transform.position - participant.transform.position).normalized * 3; + Vector3 b = new Vector3(a.x, participant2.transform.position.y, a.z); + + + Val position = Val.V(() => (participant2.transform.position - b)); + return new Sequence(participant.GetComponent().Node_GoTo(position)); + } + + protected Node ST_Dance(GameObject participan) { + Val be = Val.V(() => "BREAKDANCE"); + return new Sequence(participan.GetComponent().ST_PlayBodyGesture(be, 5000), new LeafWait(1000)); + } + protected Node ST_StepBack(GameObject participant) { + Val be = Val.V(() => "STEPBACK"); + return new Sequence(participant.GetComponent().ST_PlayBodyGesture(be, 2000), new LeafWait(500)); + } + protected Node ST_CallOver(GameObject participant) { + print("x"); + Val be = Val.V(() => "CALLOVER"); + return new Sequence(participant.GetComponent().ST_PlayHandGesture(be, 1500), new LeafWait(500)); + } + protected Node ST_Drink(GameObject participant) { + Val be = Val.V(() => "DRINK"); + return new Sequence(participant.GetComponent().ST_PlayFaceGesture(be, 5000), new LeafWait(500)); + } + protected Node ST_ShakeHead(GameObject participant) { + Val be = Val.V(() => "HEADSHAKETHINK"); + return new Sequence(participant.GetComponent().ST_PlayFaceGesture(be, 3000), new LeafWait(500)); + } + protected Node ST_Yawn(GameObject participant) { + Val be = Val.V(() => "YAWN"); + return new Sequence(participant.GetComponent().ST_PlayHandGesture(be, 7000), new LeafWait(2000)); + } + protected Node ST_Clap(GameObject participant) { + Val be = Val.V(() => "CLAP"); + return new Sequence(participant.GetComponent().ST_PlayHandGesture(be, 2000), new LeafWait(2000)); + } + protected Node ST_BeingCocky(GameObject participant) { + Val be = Val.V(() => "BEINGCOCKY"); + return new Sequence(participant.GetComponent().ST_PlayHandGesture(be, 2000), new LeafWait(2000)); + } + + protected Node ST_LookStand(GameObject participant, GameObject participant2) { + Vector3 a = new Vector3(0, 1.8f, 0); + Val position = Val.V(() => (participant2.transform.position + a)); + return new Sequence(participant.GetComponent().Node_HeadLookTurnFirst(position), new LeafWait(500)); + } + protected Node ST_LookDance(GameObject participant, GameObject participant2) { + Vector3 a = new Vector3(0, 0.8f, 0); + Val position = Val.V(() => (participant2.transform.position + a)); + return new Sequence(participant.GetComponent().Node_HeadLookTurnFirst(position), new LeafWait(500)); + } + protected Node WalkTowards(GameObject participant, GameObject participant2) { + return new Sequence(this.ST_LookStand(participant, participant2), this.ST_ApproachAndWait(participant, participant2)); + } + + protected Node AbInteraction() { + + Node roaming = + new Sequence( + //this.ST_Drink(main1), + //this.ST_LookStand(main2, main1), + this.ST_LookStand(main1, main2), + this.ST_GetCloseTo(main1, main2), + this.ST_CallOver(main1), + this.WalkTowards(main2, main1), + this.ST_ShakeHead(main2), + this.ST_StepBack(main2), + new SequenceParallel(this.DanceOfff(), + this.ST_LookDance(main1, main2)) + + ); + return roaming; + } + protected Node RandonSuccess() { + Node result = new TreeSharpPlus.RandomS(); + return result; + + } + protected Node DanceReact(GameObject participant) { + Node result = new Randomm(this.ST_Yawn(participant), this.ST_BeingCocky(participant), this.ST_Clap(participant)); + return result; + + } + protected Node DanceOfff() { + //float c = 5; + Node dance = + new Sequence( + + this.ST_Dance(main2), this.DanceReact(main1), + new DecoratorInvert(new DecoratorLoop(new Sequence( + this.ST_StepBack(main1), this.ST_Dance(main1), this.DanceReact(main2), RandonSuccess(), this.ST_StepBack(main2), this.ST_Dance(main2), this.DanceReact(main1)))), + this.ST_CallOver(main1) + + ); + //new DecoratorLoop(new Sequence(this.RandonSuccess())); + return dance; + } +} \ No newline at end of file diff --git a/Assets/MyBehaviorTreeX.cs.meta b/Assets/MyBehaviorTreeX.cs.meta new file mode 100644 index 00000000..37bcb5fb --- /dev/null +++ b/Assets/MyBehaviorTreeX.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7f901fa2fd447c74c99382372dba7a93 +timeCreated: 1477880513 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Barstool.prefab b/Assets/Prefabs/Barstool.prefab new file mode 100644 index 00000000..84bd0d48 Binary files /dev/null and b/Assets/Prefabs/Barstool.prefab differ diff --git a/Assets/Prefabs/Barstool.prefab.meta b/Assets/Prefabs/Barstool.prefab.meta new file mode 100644 index 00000000..523356e9 --- /dev/null +++ b/Assets/Prefabs/Barstool.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 28df6919d9a188d4489a62885a69c78a +timeCreated: 1477772165 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Beer Bottle.prefab b/Assets/Prefabs/Beer Bottle.prefab new file mode 100644 index 00000000..73155e3d Binary files /dev/null and b/Assets/Prefabs/Beer Bottle.prefab differ diff --git a/Assets/Prefabs/Beer Bottle.prefab.meta b/Assets/Prefabs/Beer Bottle.prefab.meta new file mode 100644 index 00000000..71a94fd8 --- /dev/null +++ b/Assets/Prefabs/Beer Bottle.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4b881295a6bd87c4b8256ee1c1be44b4 +timeCreated: 1477847253 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Brick Wall.prefab b/Assets/Prefabs/Brick Wall.prefab new file mode 100644 index 00000000..65db1bef Binary files /dev/null and b/Assets/Prefabs/Brick Wall.prefab differ diff --git a/Assets/Prefabs/Brick Wall.prefab.meta b/Assets/Prefabs/Brick Wall.prefab.meta new file mode 100644 index 00000000..08c7f670 --- /dev/null +++ b/Assets/Prefabs/Brick Wall.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 42a5a505262c16543befe576ff01f00e +timeCreated: 1477688785 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Chair.prefab b/Assets/Prefabs/Chair.prefab new file mode 100644 index 00000000..986977cf Binary files /dev/null and b/Assets/Prefabs/Chair.prefab differ diff --git a/Assets/Prefabs/Chair.prefab.meta b/Assets/Prefabs/Chair.prefab.meta new file mode 100644 index 00000000..11050940 --- /dev/null +++ b/Assets/Prefabs/Chair.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1219e8a220c1fc645849a969b1b8f4f9 +timeCreated: 1477777803 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Ketchup Bottle.prefab b/Assets/Prefabs/Ketchup Bottle.prefab new file mode 100644 index 00000000..7cfcd162 Binary files /dev/null and b/Assets/Prefabs/Ketchup Bottle.prefab differ diff --git a/Assets/Prefabs/Ketchup Bottle.prefab.meta b/Assets/Prefabs/Ketchup Bottle.prefab.meta new file mode 100644 index 00000000..d702a399 --- /dev/null +++ b/Assets/Prefabs/Ketchup Bottle.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 602239d6ae32b9d42ad337930291687e +timeCreated: 1477778192 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Mustard Bottle.prefab b/Assets/Prefabs/Mustard Bottle.prefab new file mode 100644 index 00000000..e479b416 Binary files /dev/null and b/Assets/Prefabs/Mustard Bottle.prefab differ diff --git a/Assets/Prefabs/Mustard Bottle.prefab.meta b/Assets/Prefabs/Mustard Bottle.prefab.meta new file mode 100644 index 00000000..4e196033 --- /dev/null +++ b/Assets/Prefabs/Mustard Bottle.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b34c08e37ace3984dbf35f8ea59f8da8 +timeCreated: 1477778193 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Speaker.prefab b/Assets/Prefabs/Speaker.prefab new file mode 100644 index 00000000..c25a58d5 Binary files /dev/null and b/Assets/Prefabs/Speaker.prefab differ diff --git a/Assets/Prefabs/Speaker.prefab.meta b/Assets/Prefabs/Speaker.prefab.meta new file mode 100644 index 00000000..3c822d6b --- /dev/null +++ b/Assets/Prefabs/Speaker.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 621a9bbcf657cae41b666d3dbea7885a +timeCreated: 1477779055 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Table Setup.prefab b/Assets/Prefabs/Table Setup.prefab new file mode 100644 index 00000000..52cf9575 Binary files /dev/null and b/Assets/Prefabs/Table Setup.prefab differ diff --git a/Assets/Prefabs/Table Setup.prefab.meta b/Assets/Prefabs/Table Setup.prefab.meta new file mode 100644 index 00000000..6bd0dc2e --- /dev/null +++ b/Assets/Prefabs/Table Setup.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a7ed76a49902b2e4db25566cad732c02 +timeCreated: 1477778407 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Table.prefab b/Assets/Prefabs/Table.prefab new file mode 100644 index 00000000..f792bd70 Binary files /dev/null and b/Assets/Prefabs/Table.prefab differ diff --git a/Assets/Prefabs/Table.prefab.meta b/Assets/Prefabs/Table.prefab.meta new file mode 100644 index 00000000..cbbf93d3 --- /dev/null +++ b/Assets/Prefabs/Table.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1fdd463fe477a2e42a44a4e5ee5b0407 +timeCreated: 1477777369 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Textures/grass_texture_four.png b/Assets/Textures/grass_texture_four.png new file mode 100644 index 00000000..3043c4c2 Binary files /dev/null and b/Assets/Textures/grass_texture_four.png differ diff --git a/Assets/Textures/grass_texture_four.png.meta b/Assets/Textures/grass_texture_four.png.meta new file mode 100644 index 00000000..0037addd --- /dev/null +++ b/Assets/Textures/grass_texture_four.png.meta @@ -0,0 +1,59 @@ +fileFormatVersion: 2 +guid: 09b1f03246a16c144a99d77417b22042 +timeCreated: 1477769689 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scenes/Bar 1.unity b/Assets/_Scenes/Bar 1.unity new file mode 100644 index 00000000..a3023e9e Binary files /dev/null and b/Assets/_Scenes/Bar 1.unity differ diff --git a/Assets/_Scenes/Bar 1.unity.meta b/Assets/_Scenes/Bar 1.unity.meta new file mode 100644 index 00000000..c7e27c4d --- /dev/null +++ b/Assets/_Scenes/Bar 1.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6e88a04ea5a40fa499b8179f9769bbd5 +timeCreated: 1477790761 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scenes/Bar.meta b/Assets/_Scenes/Bar.meta new file mode 100644 index 00000000..aa164e4a --- /dev/null +++ b/Assets/_Scenes/Bar.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 64a1cc5eee934924eb8d85ac9fe56492 +folderAsset: yes +timeCreated: 1477689116 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scenes/Bar.unity b/Assets/_Scenes/Bar.unity new file mode 100644 index 00000000..15342856 Binary files /dev/null and b/Assets/_Scenes/Bar.unity differ diff --git a/Assets/_Scenes/Bar.unity.meta b/Assets/_Scenes/Bar.unity.meta new file mode 100644 index 00000000..b5bd1464 --- /dev/null +++ b/Assets/_Scenes/Bar.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 035ab95f76f361d4ea8302ee8d9c4d0a +timeCreated: 1477688450 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scenes/Bar/LightingData.asset b/Assets/_Scenes/Bar/LightingData.asset new file mode 100644 index 00000000..a4043d03 Binary files /dev/null and b/Assets/_Scenes/Bar/LightingData.asset differ diff --git a/Assets/_Scenes/Bar/LightingData.asset.meta b/Assets/_Scenes/Bar/LightingData.asset.meta new file mode 100644 index 00000000..525de868 --- /dev/null +++ b/Assets/_Scenes/Bar/LightingData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b921c032aaaae6d4882be7d77b106987 +timeCreated: 1477769084 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scenes/Bar/NavMesh.asset b/Assets/_Scenes/Bar/NavMesh.asset new file mode 100644 index 00000000..ac95a60e Binary files /dev/null and b/Assets/_Scenes/Bar/NavMesh.asset differ diff --git a/Assets/_Scenes/Bar/NavMesh.asset.meta b/Assets/_Scenes/Bar/NavMesh.asset.meta new file mode 100644 index 00000000..e6f81c0e --- /dev/null +++ b/Assets/_Scenes/Bar/NavMesh.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aec77aa679480bf4b921b27d2f97e945 +timeCreated: 1477847824 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scenes/Bar/ReflectionProbe-0.exr b/Assets/_Scenes/Bar/ReflectionProbe-0.exr new file mode 100644 index 00000000..e4be0051 Binary files /dev/null and b/Assets/_Scenes/Bar/ReflectionProbe-0.exr differ diff --git a/Assets/_Scenes/Bar/ReflectionProbe-0.exr.meta b/Assets/_Scenes/Bar/ReflectionProbe-0.exr.meta new file mode 100644 index 00000000..c7db1303 --- /dev/null +++ b/Assets/_Scenes/Bar/ReflectionProbe-0.exr.meta @@ -0,0 +1,60 @@ +fileFormatVersion: 2 +guid: 0128d1846a0c95c40859f1efb52d4741 +timeCreated: 1477769084 +licenseType: Free +TextureImporter: + fileIDToRecycleName: + 8900000: generatedCubemap + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 1 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 1 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: 2 + aniso: 0 + mipBias: 0 + wrapMode: 1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 100 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 3 + buildTargetSettings: [] + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scenes/Scene1.unity b/Assets/_Scenes/Scene1.unity index a410c360..01ff22bc 100644 Binary files a/Assets/_Scenes/Scene1.unity and b/Assets/_Scenes/Scene1.unity differ diff --git a/Assets/_Scenes/Scene3.unity b/Assets/_Scenes/Scene3.unity new file mode 100644 index 00000000..01773ac2 Binary files /dev/null and b/Assets/_Scenes/Scene3.unity differ diff --git a/Assets/_Scenes/Scene3.unity.meta b/Assets/_Scenes/Scene3.unity.meta new file mode 100644 index 00000000..f0596a4b --- /dev/null +++ b/Assets/_Scenes/Scene3.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8ff43d9ccc3ab0842baddd550f033e4a +timeCreated: 1477791672 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/QualitySettings.asset b/ProjectSettings/QualitySettings.asset index bd64e2d0..19e11aad 100644 Binary files a/ProjectSettings/QualitySettings.asset and b/ProjectSettings/QualitySettings.asset differ