Esempio n. 1
0
    void Awake()
    {
        Instance = this;

        for (int i = 0; i < states.Length; i++)
        {
            states[i].gameObject.SetActive(false);
        }
    }
		public TiledImageButtonControl(ImageSource Source, int Width, int Height, StateSelector StateSelector)
		{
			this.Container = new Canvas
			{
				Width = Width,
				Height = Height,

				Clip = new RectangleGeometry
				{
					Rect = new Rect { X = 0, Y = 0, Width = Width, Height = Height }
				}

			};

			this.Tiles = new Image
			{
				Stretch = Stretch.Fill,
				Source = Source,

			}.AttachTo(this.Container);

			var s = new ImageTileSelector(this.Tiles, Width, Height);

			this.Overlay = new Rectangle
			{
				Fill = Brushes.White,
				Width = Width,
				Height = Height,
				Opacity = 0
			}.AttachTo(this.Container);

			this.States = new ImageButtonStates(this.Overlay,
				StateSelector.AsDisabled(s),
				StateSelector.AsEnabled(s),
				StateSelector.AsHot(s),
				StateSelector.AsPressed(s)
			);
		}
Esempio n. 3
0
        public TiledImageButtonControl(ImageSource Source, int Width, int Height, StateSelector StateSelector)
        {
            this.Container = new Canvas
            {
                Width  = Width,
                Height = Height,

                Clip = new RectangleGeometry
                {
                    Rect = new Rect {
                        X = 0, Y = 0, Width = Width, Height = Height
                    }
                }
            };

            this.Tiles = new Image
            {
                Stretch = Stretch.Fill,
                Source  = Source,
            }.AttachTo(this.Container);

            var s = new ImageTileSelector(this.Tiles, Width, Height);

            this.Overlay = new Rectangle
            {
                Fill    = Brushes.White,
                Width   = Width,
                Height  = Height,
                Opacity = 0
            }.AttachTo(this.Container);

            this.States = new ImageButtonStates(this.Overlay,
                                                StateSelector.AsDisabled(s),
                                                StateSelector.AsEnabled(s),
                                                StateSelector.AsHot(s),
                                                StateSelector.AsPressed(s)
                                                );
        }
Esempio n. 4
0
    public override void Awake()
    {
        base.Awake();

        switch (methodology)
        {
        case Methodology.Standard: stateSelector = new StateSelector()
        {
                Idle    = () => ChangeState <CatNoopState>(),
                Passive = () => ChangeState <CatWanderState>(),
                Chase   = () => ChangeState <CatChaseState>(),
                Attack  = () => ChangeState <CatAttackState>(),
        }; break;

        case Methodology.Hunter: stateSelector = new StateSelector()
        {
                Idle    = () => ChangeState <CatNoopState>(),
                Passive = () => ChangeState <CatHuntingState>(),
                Chase   = () => ChangeState <CatChaseState>(),
                Attack  = () => ChangeState <CatAttackState>(),
        }; break;
        }
    }