private AtomicActivityBehaviour CreateAtomicActivityBehaviour(string action, float duration) { AtomicActivityBehaviour aABehaviour = gameObject.AddComponent(typeof(AtomicActivityBehaviour)) as AtomicActivityBehaviour; aABehaviour.duration = duration; aABehaviour.BName = action; aABehaviour.smartHomeServer = smartHomeServer; return(aABehaviour); }
protected override AbstractBehaviour InitScript() { this.BName = "Clean bathroom"; if (smartHomeServer != null) { SensorsGUI gui = smartHomeServer.GetComponent <SensorsGUI> (); gui.SetDebugText(9, BName); gui.BehaviourTreeToShow = this; } AbstractBehaviour[] behaviours = new AbstractBehaviour[5]; GoToBehaviour behaviour = gameObject.AddComponent(typeof(GoToBehaviour)) as GoToBehaviour; behaviour.avatarRigidbody = playerRigidbody; behaviour.roomToGo = "Bathroom"; behaviour.aStarGameObject = aStar; // behaviour.PathInit (); behaviour.BName = "Move"; behaviours [0] = behaviour; behaviour = gameObject.AddComponent(typeof(GoToBehaviour)) as GoToBehaviour; behaviour.avatarRigidbody = playerRigidbody; behaviour.roomToGo = "WC"; behaviour.aStarGameObject = aStar; // behaviour.PathInit (); behaviour.BName = "Moveto WC"; behaviours [1] = behaviour; UseDeviceBehaviour uDBehaviour = gameObject.AddComponent(typeof(UseDeviceBehaviour)) as UseDeviceBehaviour; uDBehaviour.DeviceToUse = toilet; uDBehaviour.BName = "WC use"; behaviours [2] = uDBehaviour; behaviour = gameObject.AddComponent(typeof(GoToBehaviour)) as GoToBehaviour; behaviour.avatarRigidbody = playerRigidbody; behaviour.roomToGo = "Washbasin"; behaviour.aStarGameObject = aStar; // behaviour.PathInit (); behaviour.BName = "Moveto ashbasin"; behaviours [3] = behaviour; AtomicActivityBehaviour aABehaviour = gameObject.AddComponent(typeof(AtomicActivityBehaviour)) as AtomicActivityBehaviour; aABehaviour.duration = duration; aABehaviour.BName = "Clean"; behaviours [4] = aABehaviour; // this.Behaviours = behaviours; Sequence sequence = gameObject.AddComponent(typeof(Sequence)) as Sequence; sequence.Behaviours = behaviours; return(sequence); }
protected override AbstractBehaviour InitScript() { this.BName = "Put Stuff Into Ward Robe"; AbstractBehaviour[] behaviours = new AbstractBehaviour[4]; GoToBehaviour behaviour = gameObject.AddComponent(typeof(GoToBehaviour)) as GoToBehaviour; behaviour.avatarRigidbody = playerRigidbody; behaviour.roomToGo = "Entrance"; behaviour.aStarGameObject = aStar; // behaviour.PathInit (); behaviour.BName = "Move"; behaviours [0] = behaviour; behaviour = gameObject.AddComponent(typeof(GoToBehaviour)) as GoToBehaviour; behaviour.avatarRigidbody = playerRigidbody; behaviour.roomToGo = "Wardrobe"; behaviour.aStarGameObject = aStar; // behaviour.PathInit (); behaviour.BName = "Move"; behaviours [1] = behaviour; AtomicActivityBehaviour aABehaviour = gameObject.AddComponent(typeof(AtomicActivityBehaviour)) as AtomicActivityBehaviour; aABehaviour.duration = duration; aABehaviour.BName = "Clean"; behaviours [2] = aABehaviour; behaviour = gameObject.AddComponent(typeof(GoToBehaviour)) as GoToBehaviour; behaviour.avatarRigidbody = playerRigidbody; behaviour.roomToGo = "Livingroom"; behaviour.aStarGameObject = aStar; // behaviour.PathInit (); behaviour.BName = "Move"; behaviours [3] = behaviour; // this.Behaviours = behaviours; Sequence sequence = gameObject.AddComponent(typeof(Sequence)) as Sequence; sequence.Behaviours = behaviours; return(sequence); }