Beispiel #1
0
        // Use this for initialization
        void Start()
        {
            if (!this._graspable_object)
            {
                this._graspable_object = this.GetComponent <GraspableObject>();
            }

            if (!this._gripper)
            {
                this._gripper = FindObjectOfType <ScriptedGripper>();
            }

            this._grasp            = this._graspable_object.GetOptimalGrasp(this._gripper).First;
            this._rigid_body       = this._grasp.GetComponentInParent <Rigidbody>();
            this._rigid_bodies     = this._graspable_object.GetComponentsInChildren <Rigidbody>();
            this._initial_position = this._rigid_body.transform.position;
            this._initial_rotation = this._rigid_body.transform.rotation;

            NeodroidUtilities.RegisterCollisionTriggerCallbacksOnChildren(
                this,
                this.transform,
                this.OnCollisionEnterChild,
                this.OnTriggerEnterChild,
                this.OnCollisionExitChild,
                this.OnTriggerExitChild,
                this.OnCollisionStayChild,
                this.OnTriggerStayChild,
                this._debugging);
        }
Beispiel #2
0
        protected override void PostSetup()
        {
            if (!this._goal)
            {
                this._goal = FindObjectOfType <EmptyCell>();
            }

            if (!this._actor)
            {
                this._actor = FindObjectOfType <Actor>();
            }

            if (this._goal)
            {
                NeodroidUtilities.RegisterCollisionTriggerCallbacksOnChildren(
                    this,
                    this._goal.transform,
                    null,
                    this.OnTriggerEnterChild,
                    debug: this.Debugging);
            }

            if (this._actor)
            {
                NeodroidUtilities.RegisterCollisionTriggerCallbacksOnChildren(
                    this,
                    this._actor.transform,
                    null,
                    this.OnTriggerEnterChild,
                    debug: this.Debugging);
            }
        }
Beispiel #3
0
 void SetupEnvironment() {
   NeodroidUtilities.RegisterCollisionTriggerCallbacksOnChildren(
       this,
       this.transform,
       this.OnCollisionEnterChild,
       this.OnTriggerEnterChild,
       this.OnCollisionExitChild,
       this.OnTriggerExitChild,
       this.OnCollisionStayChild,
       this.OnTriggerStayChild,
       this._debugging);
 }
Beispiel #4
0
        protected override void PostSetup()
        {
            if (!this._area)
            {
                this._area = FindObjectOfType <Observer>().gameObject.GetComponent <Collider>();
            }

            if (!this._actor)
            {
                this._actor = FindObjectOfType <Actor>();
            }

            if (this._obstructions.Length <= 0)
            {
                this._obstructions = FindObjectsOfType <Obstruction>();
            }

            if (!this._playable_area)
            {
                this._playable_area = FindObjectOfType <BoundingBox>();
            }

            NeodroidUtilities.RegisterCollisionTriggerCallbacksOnChildren(
                this,
                this._area.transform,
                null,
                this.OnTriggerEnterChild,
                null,
                this.OnTriggerExitChild,
                null,
                this.OnTriggerStayChild,
                this.Debugging);

            NeodroidUtilities.RegisterCollisionTriggerCallbacksOnChildren(
                this,
                this._actor.transform,
                null,
                this.OnTriggerEnterChild,
                null,
                this.OnTriggerExitChild,
                null,
                this.OnTriggerStayChild,
                this.Debugging);
            this._wait_for_seconds = new WaitForSeconds(this._resting_time);
        }
Beispiel #5
0
        void Start()
        {
            if (!this._rigidbody)
            {
                this._rigidbody = this.GetComponent <Rigidbody> ();
            }
            this._explosion = this.GetComponent <ParticleSystem> ();

            NeodroidUtilities.RegisterCollisionTriggerCallbacksOnChildren(
                this,
                this._rigidbody.transform,
                this.ChildOnCollisionEnter,
                this.ChildOnTriggerEnter,
                null,
                null,
                null,
                null,
                this.Debugging);
        }
Beispiel #6
0
        protected override void Setup()
        {
            if (!this._Rigidbody)
            {
                this._Rigidbody = this.GetComponent <Rigidbody>();
            }

            //this._explosion_particle_system = this.GetComponent<ParticleSystem>();

            NeodroidUtilities.RegisterCollisionTriggerCallbacksOnChildren(
                this,
                this._Rigidbody.transform,
                this.ChildOnCollisionEnter,
                this.ChildOnTriggerEnter,
                null,
                null,
                null,
                null,
                this.Debugging);
        }
Beispiel #7
0
        void Start()
        {
            if (!this._area)
            {
                this._area = FindObjectOfType <Observer>().gameObject.GetComponent <Collider>();
            }
            if (!this._actor)
            {
                this._actor = FindObjectOfType <Actor>().gameObject.GetComponent <Collider>();
            }
            if (this._obstructions.Length <= 0)
            {
                this._obstructions = FindObjectsOfType <Obstruction>();
            }
            if (!this._playable_area)
            {
                this._playable_area = FindObjectOfType <BoundingBox>();
            }

            NeodroidUtilities.RegisterCollisionTriggerCallbacksOnChildren(
                this,
                this._area.transform,
                this.OnCollisionEnterChild,
                this.OnTriggerEnterChild,
                this.OnCollisionExitChild,
                this.OnTriggerExitChild,
                this.OnCollisionStayChild,
                this.OnTriggerStayChild,
                this.Debugging);

            NeodroidUtilities.RegisterCollisionTriggerCallbacksOnChildren(
                this,
                this._actor.transform,
                this.OnCollisionEnterChild,
                this.OnTriggerEnterChild,
                this.OnCollisionExitChild,
                this.OnTriggerExitChild,
                this.OnCollisionStayChild,
                this.OnTriggerStayChild,
                this.Debugging);
        }