Esempio n. 1
0
        public void ClearCancellableObjects()
        {
            foreach (GameObject obj in cancellableObjects)
            {
                MenuSliding menuSliding = obj.GetComponent <MenuSliding>();
                if (menuSliding != null)
                {
                    menuSliding.Close(() => { GameObject.Destroy(obj); });
                }
                else
                {
                    GameObject.Destroy(obj);
                }
            }

            cancellableObjects.Clear();
        }
Esempio n. 2
0
        public void Initialize(IGameInterface gameInterface, MenuItemId menuItemId, FDPosition position, FDPosition showUpPosition, bool enabled, bool selected)
        {
            this.gameInterface = gameInterface;

            this.gameObject.name = string.Format(@"menuitem_{0}", menuItemId.GetHashCode());

            this.gameObject.transform.localPosition = FieldTransform.GetGroundPixelPosition(showUpPosition);
            Vector3     menuLocalPosition = FieldTransform.GetGroundPixelPosition(position);
            MenuSliding sliding           = this.gameObject.AddComponent <MenuSliding>();

            sliding.Initialize(menuLocalPosition);

            this.isEnabled  = enabled;
            this.isSelected = selected;
            this.position   = position;

            this.menuItemId = menuItemId;


            var box = this.gameObject.AddComponent <BoxCollider>();

            box.size   = new Vector3(2.4f, 0.2f, 2.4f);
            box.center = new Vector3(0f, 0.2f, 0f);
        }