Beispiel #1
0
 public void LogBindErrors()
 {
     StringInputManager.LogBindErors(new string[] {
         pause,
         reset,
         open_ui,
         set_start,
         set_end
     });
 }
        public void Update()
        {
            if (StringInputManager.GetKeyDown(HKTimer.settings.set_start))
            {
                this.start?.Destroy(this);
                switch (this.triggerPlaceType)
                {
                case TriggerPlaceType.Collision:
                    this.start = new CollisionTrigger()
                    {
                        scene = GameManager.instance.sceneName,
                        logic = new JValue("segment_start"),
                        color = "green",
                        start = HeroController.instance.transform.position - new Vector3(0.1f, 0.1f),
                        end   = HeroController.instance.transform.position + new Vector3(0.1f, 0.1f),
                    };
                    break;

                case TriggerPlaceType.Movement:
                    this.start = new MovementTrigger()
                    {
                        scene = GameManager.instance.sceneName,
                        logic = new JValue("segment_start")
                    };
                    if (this.end != null)
                    {
                        this.end.logic = new JArray {
                            this.end.logic,
                            JObject.FromObject(new {
                                type    = "command",
                                command = "enable",
                                trigger = new JValue("start"),
                                data    = new JObject()
                            })
                        }
                    }
                    ;
                    this.ShowAlert("Created movement trigger");
                    break;

                case TriggerPlaceType.Scene:
                    this.start = new SceneTrigger()
                    {
                        scene = GameManager.instance.sceneName,
                        logic = new JValue("segment_start")
                    };
                    this.ShowAlert("Created scene trigger");
                    break;
                }
                this.start.Spawn(this);
                this.pb = TimeSpan.Zero;
                this.pbDisplay.GetComponent <Text>().text = this.PbText();
            }
            if (StringInputManager.GetKeyDown(HKTimer.settings.set_end))
            {
                this.end?.Destroy(this);
                switch (this.triggerPlaceType)
                {
                case TriggerPlaceType.Collision:
                    this.end = new CollisionTrigger()
                    {
                        scene = GameManager.instance.sceneName,
                        logic = new JValue("segment_end"),
                        color = "red",
                        start = HeroController.instance.transform.position - new Vector3(0.1f, 0.1f),
                        end   = HeroController.instance.transform.position + new Vector3(0.1f, 0.1f),
                    };
                    break;

                case TriggerPlaceType.Movement:
                    this.end = null;
                    this.ShowAlert("Cannot create movement trigger as end");
                    return;

                case TriggerPlaceType.Scene:
                    this.end = new SceneTrigger()
                    {
                        scene = GameManager.instance.sceneName,
                        logic = new JValue("segment_end")
                    };
                    this.ShowAlert("Created scene trigger");
                    break;
                }
                ;
                this.end.Spawn(this);
                this.pb = TimeSpan.Zero;
                this.pbDisplay.GetComponent <Text>().text = this.PbText();
            }
        }