コード例 #1
0
 void Start()
 {
     if (this.Gazeable == null)
     {
         this.Gazeable = this.gameObject.GetComponent <Gazeable>();
     }
 }
コード例 #2
0
ファイル: Gazeable.cs プロジェクト: markkorput/GazeTools
 /// <summary>
 /// Convenience method which automates some common init operations for objects that interact with a gazeable.
 /// </summary>
 /// <returns>The gazer.</returns>
 /// <param name="gazeable">Gazeable.</param>
 /// <param name="gameObject">Game object.</param>
 public static Gazer GetGazer(Gazeable gazeable, GameObject gameObject)
 {
     if (gazeable == null)
     {
         gazeable = gameObject.GetComponentInChildren <Gazeable>();
     }
     if (gazeable == null)
     {
         return(null);
     }
     return(gazeable.GetGazer());
 }
コード例 #3
0
        void Start()
        {
            // gazeable defaults to the gazeable on our game object
            if (gazeable == null)
            {
                this.gazeable = this.gameObject.GetComponent <Gazeable>();
            }

            // target default to our own tranform
            if (target == null)
            {
                target = transform;
            }
        }
コード例 #4
0
 void Start()
 {
     if (this.Gazeable == null)
     {
         this.Gazeable = this.gameObject.GetComponent <Gazeable>();
     }
     if (this.Collider == null)
     {
         this.Collider = this.GetComponent <Collider>();
     }
     if (this.Collider == null)
     {
         this.Collider = this.Gazeable.GetComponent <Collider>();
     }
     // if (this.GazeCamera == null || this.Gazeable == null || this.Collider == null) this.enabled = false;
 }
コード例 #5
0
        void Start()
        {
            this.gazeable   = this.gameObject.GetComponent <Gazeable>();
            this.chargeable = this.gameObject.GetComponent <Chargeable>();

            if (this.gazeable == null || this.chargeable == null)
            {
                this.enabled = false;
                return;
            }

            this.gazeable.GazeStartEvent.AddListener((Gazeable g) =>
            {
                this.chargeable.AddCharger(g);
            });

            this.gazeable.GazeEndEvent.AddListener((Gazeable g) =>
            {
                this.chargeable.RemoveCharger(g);
            });
        }
コード例 #6
0
ファイル: Gazeable.cs プロジェクト: markkorput/GazeTools
 public Gazer(Gazeable g, System.Action <Gazer> activateFunc, System.Action <Gazer> deactivateFunc)
 {
     this.Gazeable       = g;
     this.activateFunc   = activateFunc;
     this.deactivateFunc = deactivateFunc;
 }