void Start() { if (this.Gazeable == null) { this.Gazeable = this.gameObject.GetComponent <Gazeable>(); } }
/// <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()); }
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; } }
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; }
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); }); }
public Gazer(Gazeable g, System.Action <Gazer> activateFunc, System.Action <Gazer> deactivateFunc) { this.Gazeable = g; this.activateFunc = activateFunc; this.deactivateFunc = deactivateFunc; }