Beispiel #1
0
        // PUBLIC METHODS: ------------------------------------------------------------------------

        public static TData Create <THotspot>(Hotspot hotspot, TData data) where THotspot : IHPMonoBehaviour <TData>
        {
            GameObject instance = new GameObject(typeof(THotspot).ToString());

            instance.transform.SetParent(hotspot.transform, false);

            THotspot component = instance.AddComponent <THotspot>();

            component.data = data;
            component.ConfigureData(hotspot, instance);
            component.Initialize();
            return(component.data);
        }
Beispiel #2
0
        // INITIALIZE: -------------------------------------------------------------------------------------------------

        private void OnEnable()
        {
            if (target == null || serializedObject == null)
            {
                return;
            }
            this.hotspot = (Hotspot)target;

            this.spCursor = serializedObject.FindProperty(PROP_CURSOR);
            this.spProxim = serializedObject.FindProperty(PROP_PROXIM);
            this.spHeadTr = serializedObject.FindProperty(PROP_HEADTR);

            this.spCursorEnabled = this.spCursor.FindPropertyRelative(PROP_ENABLED);
            this.spProximEnabled = this.spProxim.FindPropertyRelative(PROP_ENABLED);
            this.spHeadTrEnabled = this.spHeadTr.FindPropertyRelative(PROP_ENABLED);

            this.spProximRadius = this.spProxim.FindPropertyRelative(PROP_PROXIM_RADIUS);
            this.spHeadTrRadius = this.spHeadTr.FindPropertyRelative(PROP_HEADTR_RADIUS);

            this.SetupAnimBool(ref this.cursorState, this.spCursorEnabled.boolValue);
            this.SetupAnimBool(ref this.proximState, this.spProximEnabled.boolValue);
            this.SetupAnimBool(ref this.headTrState, this.spHeadTrEnabled.boolValue);
        }
Beispiel #3
0
 private void ConfigureData(Hotspot hotspot, GameObject instance)
 {
     ((IData)this.data).hotspot  = hotspot;
     ((IData)this.data).instance = instance.GetComponent <IHPMonoBehaviour <TData> >();
 }
Beispiel #4
0
 public void Setup(Hotspot hotspot, GameObject instance)
 {
     this.hotspot  = hotspot;
     this.instance = instance.GetComponent <IHPMonoBehaviour <TData> >();
 }