Beispiel #1
0
        void CreateButton(Button template, LocationInfo location, GoalTypeInfo info, string text)
        {
            var btn_go = Instantiate(template.gameObject, template.transform.parent);

            btn_go.SetActive(true);
            btn_go.transform.Find("Text").GetComponent <Text>().text = text + info.name;

            HandleClick(btn_go.GetComponent <Button>(), location, info);
        }
Beispiel #2
0
        void HandleClick(Button btn, LocationInfo location, GoalTypeInfo info)
        {
            btn.onClick.AddListener(() => {
                var event_entity = World.Active.EntityManager.CreateEntity(typeof(GameEvent));

                World.Active.EntityManager.SetComponentData(
                    event_entity,
                    new GameEvent()
                {
                    LocationID = location.ID,
                    TypeID     = info.ID
                });
            });
        }