Ejemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            SensorResponseRouter my = (SensorResponseRouter)target;

            if (my.anyOfTheseChains.Count == 0)
            {
                SensorChain sc = my.GetComponent <SensorChain>();

                if (sc != null)
                {
                    my.anyOfTheseChains.Add(sc);
                }
            }

            if (my.responses.Count == 0)
            {
                ResponseChain r = my.GetComponent <ResponseChain>();

                if (r != null)
                {
                    my.responses.Add(r);
                }
            }

            //EditorGUIUtility.LookLikeControls();
            DrawDefaultInspector();
        }
Ejemplo n.º 2
0
        public override void Fire(SensorResponseRouter r)
        {
            SetAll(enableThese, true);
            SetAll(disableThese, false);

            foreach (UnityEngine.Object o in toggleThese)
            {
                System.Type t = o.GetType();

                FieldInfo f = t.GetField("enable");

                if (f != null)
                {
                    f.SetValue(o, !(bool)f.GetValue(o));
                    break;
                }

                PropertyInfo p = t.GetProperty("enable");

                if (p != null)
                {
                    p.SetValue(o, !(bool)p.GetValue(o, null), null);
                }
            }
        }
Ejemplo n.º 3
0
 public void Fire(SensorResponseRouter r)
 {
     counter          = 0;
     isRunning        = true;
     responseIndex    = 0;
     lastFiringRouter = r;
 }
Ejemplo n.º 4
0
        public override void Fire(SensorResponseRouter r)
        {
            if (!target || !dataSource)
            {
                return;
            }

            if (local)
            {
                if (position)
                {
                    target.localPosition = dataSource.localPosition;
                }
                if (rotation)
                {
                    target.localRotation = dataSource.localRotation;
                }
            }
            else
            {
                if (position)
                {
                    target.position = dataSource.position;
                }
                if (rotation)
                {
                    target.rotation = dataSource.rotation;
                }
            }

            //scale is special in unity :S

            if (scale)
            {
                target.localScale = dataSource.localScale;
            }
        }
Ejemplo n.º 5
0
        public float hold  = 0; //time until we let the next reponse in the chain take over after we fire

        public abstract void Fire(SensorResponseRouter r);
Ejemplo n.º 6
0
 public override void Fire(SensorResponseRouter r)
 {
     Debug.Log(printThis);
 }
Ejemplo n.º 7
0
 public override void Fire(SensorResponseRouter r)
 {
     gameObject.ActivateAll(enableThese);
     gameObject.DeactivateAll(disableThese);
     gameObject.ToggleActive(toggleThese);
 }
Ejemplo n.º 8
0
 public override void Fire(SensorResponseRouter r)
 {
     gameObject.SendMessageToAll(sendMsgTo, msg, SendMessageOptions.DontRequireReceiver);
 }