コード例 #1
0
ファイル: CallForBusSchedule.cs プロジェクト: Natorkawl/shima
    protected override AbstractBehaviour InitScript()
    {
        this.BName = "Call for bus";

        AbstractBehaviour[] behaviours = new AbstractBehaviour[2];
        GoToBehaviour       behaviour  = gameObject.AddComponent(typeof(GoToBehaviour)) as GoToBehaviour;

        behaviour.avatarRigidbody = playerRigidbody;
        behaviour.roomToGo        = "Phone";
        behaviour.aStarGameObject = aStar;
//		behaviour.PathInit ();
        behaviour.BName = "Move";
        behaviours [0]  = behaviour;

        UseDeviceBehaviour uDBehaviour = gameObject.AddComponent(typeof(UseDeviceBehaviour)) as UseDeviceBehaviour;

        uDBehaviour.DeviceToUse = phone;
        uDBehaviour.BName       = "Call";
        behaviours [1]          = uDBehaviour;

//		this.Behaviours = behaviours;
        Sequence sequence = gameObject.AddComponent(typeof(Sequence)) as Sequence;

        sequence.Behaviours = behaviours;

        return(sequence);
    }
コード例 #2
0
ファイル: AnswerThePhone.cs プロジェクト: Natorkawl/shima
    protected override AbstractBehaviour InitScript()
    {
//		if (RingPhone != null)
//			AudioSource.PlayClipAtPoint (RingPhone,phone.transform.position);
        PhoneDevice phoneDevice = phone.GetComponent <PhoneDevice>();

        phoneDevice.Ring();

        this.BName = "AnswerThePhone";

        AbstractBehaviour[] behaviours = new AbstractBehaviour[2];
        GoToBehaviour       behaviour  = gameObject.AddComponent(typeof(GoToBehaviour)) as GoToBehaviour;

        behaviour.avatarRigidbody = playerRigidbody;
        behaviour.roomToGo        = "Phone";
        behaviour.aStarGameObject = aStar;
//		behaviour.PathInit ();
        behaviour.BName = "Move";
        behaviours [0]  = behaviour;

        UseDeviceBehaviour uDBehaviour = gameObject.AddComponent(typeof(UseDeviceBehaviour)) as UseDeviceBehaviour;

        uDBehaviour.DeviceToUse = phone;
        uDBehaviour.BName       = "Answer";
        behaviours [1]          = uDBehaviour;

//		this.Behaviours = behaviours;
        Sequence sequence = gameObject.AddComponent(typeof(Sequence)) as Sequence;

        sequence.Behaviours = behaviours;

        return(sequence);
    }
コード例 #3
0
    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);
    }
コード例 #4
0
    private GoToBehaviour CreateGoToBehaviour(string roomToGo)
    {
        GoToBehaviour behaviour = gameObject.AddComponent(typeof(GoToBehaviour)) as GoToBehaviour;

        behaviour.avatarRigidbody = playerRigidbody;
        behaviour.roomToGo        = roomToGo;
        behaviour.aStarGameObject = aStar;
        behaviour.BName           = "Go to " + roomToGo;
        behaviour.smartHomeServer = smartHomeServer;
        return(behaviour);
    }
コード例 #5
0
    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);
    }
コード例 #6
0
ファイル: ScenarioNP1.cs プロジェクト: Natorkawl/shima
    protected override AbstractBehaviour InitScript()
    {
        this.BName = "Scenario1";

        AbstractBehaviour[] behaviours = new AbstractBehaviour[3];
        GoToBehaviour       behaviour  = gameObject.AddComponent(typeof(GoToBehaviour)) as GoToBehaviour;

        behaviour.avatarRigidbody = playerRigidbody;
        behaviour.roomToGo        = roomToGo1;
        behaviour.aStarGameObject = aStar;
//		behaviour.PathInit ();
        behaviour.BName = "Move1";
        behaviours [0]  = behaviour;

        behaviour = gameObject.AddComponent(typeof(GoToBehaviour)) as GoToBehaviour;
        behaviour.avatarRigidbody = playerRigidbody;
        behaviour.roomToGo        = roomToGo2;
        behaviour.aStarGameObject = aStar;
//		behaviour.PathInit ();
        behaviour.BName = "Move2";
        behaviours [1]  = behaviour;

        UseDeviceBehaviour uDBehaviour = gameObject.AddComponent(typeof(UseDeviceBehaviour)) as UseDeviceBehaviour;

        uDBehaviour.DeviceToUse = deviceToUse;
        uDBehaviour.BName       = "Act";
        behaviours [2]          = uDBehaviour;

//		this.Behaviours = behaviours;
        Sequence sequence = gameObject.AddComponent(typeof(Sequence)) as Sequence;

        sequence.Behaviours = behaviours;

        return(sequence);
//		this.Run ();
    }