Ejemplo n.º 1
0
        public XmasGift(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasGift, playerPositionDelegate)
        {
            // Spriter
            SpriterFilename = "Graphics/Sprites/Bosses/XmasGift/xmas-gift";

            // BulletML
            BulletPatternFiles.Add("XmasGift/pattern1");

            // Behaviours
            Behaviours.Add(new XmasGiftBehaviour1(this));
            Behaviours.Add(new XmasGiftBehaviour2(this));
            Behaviours.Add(new XmasGiftBehaviour3(this));
        }
Ejemplo n.º 2
0
        public ShelfViewModel()
        {
            Transition         = new SwipeTransition();
            IsRotating         = true;
            Pointing.IsEnabled = true;

            var tapBehaviour = new TapBehaviour();

            tapBehaviour.Tap += OnTap;
            Behaviours.Add(tapBehaviour);
            Behaviours.Add(new ShelfSwipeBehaviour());

            HBS.Search.SearchStarting += OnSearchStarting;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Parse behaviour string
 /// </summary>
 private void ParseBehaviours()
 {
     foreach (string behaviourData in Data.Behaviour.Split(','))
     {
         try
         {
             ItemBehaviour behaviour = (ItemBehaviour)Enum.Parse(typeof(ItemBehaviour), behaviourData.ToUpper());
             Behaviours.Add(behaviour);
         }
         catch
         {
         }
     }
 }
Ejemplo n.º 4
0
        protected override void Awake()
        {
            base.Awake();

            name_string = "Treasure Car";

            //if (projectile != null) {
            //beh_shooter = new BehaviourShooter (this, projectile, damage, range, frequency, target_tag);
            //Behaviours.Add (beh_shooter);
            Behaviours.Add(new BehaviourPlayerHealthPoints(this));

            //Behaviours.Add (new BehaviourUpgradable(this, upgrade, upgrade_cost));
            //}
        }
        protected override void Awake()
        {
            base.Awake();

            //name_string = "Manual Shooter Cart";

            if (projectile_prefab != null)
            {
                //beh_shooter = new BehaviourShooter (this, projectile, damage, range, frequency, target_tag);
                shooter_behaviour = new BehaviourManualShooter(this, projectile_prefab, power, damage);
                Behaviours.Add(shooter_behaviour);

                Behaviours.Add(new BehaviourHealthPoints(this, health));
            }
        }
        protected override void Awake()
        {
            base.Awake();

            name_string = "Shooter Cart";

            if (projectile != null)
            {
                beh_shooter = new BehaviourShooter(this, projectile, damage, range, frequency, target_tag);
                Behaviours.Add(beh_shooter);
                Behaviours.Add(new BehaviourHealthPoints(this, health));

                //Behaviours.Add (new BehaviourUpgradable(this, upgrade, upgrade_cost));
            }
        }
Ejemplo n.º 7
0
        public bool AddBehaviour(IBehaviour behaviour)
        {
            lock (Behaviours)
            {
                if (!Behaviours.ContainsKey(behaviour.AbbreviatedName))
                {
                    behaviour.Initialize(this);
                    Behaviours.Add(behaviour.AbbreviatedName, behaviour);

                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 8
0
        public XmasCandy(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasCandy, playerPositionDelegate)
        {
            InitialLife = 500f;

            // BulletML
            BulletPatternFiles.Add("XmasCandy/pattern1");
            BulletPatternFiles.Add("XmasCandy/pattern2");

            // Behaviours
            Behaviours.Add(new XmasCandyBehaviour1(this));
            Behaviours.Add(new XmasCandyBehaviour2(this));
            Behaviours.Add(new XmasCandyBehaviour3(this));

            SpriterFilename = "Graphics/Sprites/Bosses/XmasCandy/xmas-candy";
        }
Ejemplo n.º 9
0
        public XmasBall(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasBall, playerPositionDelegate)
        {
            // BulletML
            BulletPatternFiles.Add("XmasBall/pattern1");
            BulletPatternFiles.Add("XmasBall/pattern2");
            BulletPatternFiles.Add("XmasBall/pattern3");
            BulletPatternFiles.Add("XmasBall/pattern4");

            // Behaviours
            Behaviours.Add(new XmasBallBehaviour1(this));
            Behaviours.Add(new XmasBallBehaviour2(this));
            Behaviours.Add(new XmasBallBehaviour3(this));
            Behaviours.Add(new XmasBallBehaviour4(this));

            SpriterFilename = "Graphics/Sprites/Bosses/XmasBall/xmas-ball";
        }
Ejemplo n.º 10
0
        public XmasLog(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasLog, playerPositionDelegate)
        {
            // BulletML
            BulletPatternFiles.Add("XmasLog/pattern1");

            // Spriter
            SpriterFilename = "Graphics/Sprites/Bosses/XmasLog/xmas-log";

            // Behaviours
            Behaviours.Add(new XmasLogBehaviour1(this));
            Behaviours.Add(new XmasLogBehaviour2(this));
            Behaviours.Add(new XmasLogBehaviour3(this));
            Behaviours.Add(new XmasLogBehaviour4(this));

            InitialPosition = new Vector2(GameConfig.VirtualResolution.X / 2f, GameConfig.VirtualResolution.Y * 0.15f);
        }
Ejemplo n.º 11
0
        public BigMoneyAI()
        {
            Behaviours.Add(new CommentOnGameEndBehaviour("The game is over? But I was about to buy a Province!"));

            Behaviours.Add(new DefaultDiscardOrRedrawCardsBehaviour());
            Behaviours.Add(new DefaultMakeChoiceBehaviour());
            Behaviours.Add(new DefaultSelectFixedNumberOfCardsToPassOrTrashBehaviour());
            Behaviours.Add(new DefaultSelectFromRevealedBehaviour());
            Behaviours.Add(new DefaultSelectFixedNumberOfCardsForPlayBehaviour());
            Behaviours.Add(new DefaultSelectUpToNumberOfCardsToTrashBehaviour());

            Behaviours.Add(new SkipActionsBehaviour());

            Behaviours.Add(new BuyPointsBehaviour(6));
            Behaviours.Add(new BigMoneyBuyBehaviour());
            Behaviours.Add(new SkipBuyBehaviour());
        }
Ejemplo n.º 12
0
        protected override void Awake()
        {
            base.Awake();

            name_string = "Basic Enemy";

            //GameObject target = FindObjectOfType<GE_Treasure_Cart> ().gameObject;

            mover_behaviour = new BehaviourTrajectoryToTarget(this, null, null, speed);
            Behaviours.Add(mover_behaviour);

            damage_target_behaviour = new BehaviourDoDamageTarget(this, null, damage);
            Behaviours.Add(damage_target_behaviour);

            Behaviours.Add(new BehaviourHealthPoints(this, health));
            Behaviours.Add(new BehaviourBounty(this, bounty_score, bounty_resource));
        }
Ejemplo n.º 13
0
        public XmasSnowman(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasSnowman, playerPositionDelegate)
        {
            // BulletML
            BulletPatternFiles.Add("XmasSnowman/pattern1");
            BulletPatternFiles.Add("XmasSnowman/pattern3_1");
            BulletPatternFiles.Add("XmasSnowman/pattern3_2");

            // Behaviours
            Behaviours.Add(new XmasSnowmanBehaviour1(this));
            Behaviours.Add(new XmasSnowmanBehaviour2(this));
            Behaviours.Add(new XmasSnowmanBehaviour3(this));
            Behaviours.Add(new XmasSnowmanBehaviour4(this));

            SpriterFilename = "Graphics/Sprites/Bosses/XmasSnowman/xmas-snowman";

            InitialPosition = new Vector2(GameConfig.VirtualResolution.X / 2f, GameConfig.VirtualResolution.Y * 0.25f);
        }
Ejemplo n.º 14
0
        public XmasSnowflake(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasSnowflake, playerPositionDelegate)
        {
            // BulletML
            BulletPatternFiles.Add("XmasSnowflake/pattern1");
            BulletPatternFiles.Add("XmasSnowflake/pattern2");
            BulletPatternFiles.Add("XmasSnowflake/pattern3");
            BulletPatternFiles.Add("XmasSnowflake/pattern4");

            // Behaviours
            Behaviours.Add(new XmasSnowflakeBehaviour1(this));
            Behaviours.Add(new XmasSnowflakeBehaviour2(this));
            Behaviours.Add(new XmasSnowflakeBehaviour3(this));
            Behaviours.Add(new XmasSnowflakeBehaviour4(this));

            SpriterFilename = "Graphics/Sprites/Bosses/XmasSnowflake/xmas-snowflake";

            InitializeDestroyedParticleEffect();
        }
Ejemplo n.º 15
0
        public ProbabilityAI(ProbabilityDistribution buyDistribution)
        {
            var buyBehaviour = new ProbabilisticBuyBehaviour(buyDistribution);

            Behaviours.Add(new ProbabilisticBuyBehaviour.LearnFromGameResultBehaviour(buyDistribution));

            Behaviours.Add(new DefaultDiscardOrRedrawCardsBehaviour());
            Behaviours.Add(new DefaultMakeChoiceBehaviour());
            Behaviours.Add(new DefaultSelectFixedNumberOfCardsToPassOrTrashBehaviour());
            Behaviours.Add(new DefaultSelectFromRevealedBehaviour());
            Behaviours.Add(new DefaultSelectFixedNumberOfCardsForPlayBehaviour());
            Behaviours.Add(new DefaultSelectUpToNumberOfCardsToTrashBehaviour());

            Behaviours.Add(new PlaySimpleActionsBehaviour());
            Behaviours.Add(new SkipActionsBehaviour());

            Behaviours.Add(new BuyPointsBehaviour(6));
            Behaviours.Add(buyBehaviour);
            Behaviours.Add(new SkipBuyBehaviour());
        }
Ejemplo n.º 16
0
        public async Task AddBehaviourAsync(IVectorBehaviourPlus behaviour)
        {
            if (!Behaviours.Any(b => b.UniqueReference == behaviour.UniqueReference))
            {
                Behaviours.Add(behaviour);
                UpdateFrameProcessors();

                if (Connection == ConnectedState.Connected)
                {
                    await ActOnAnyBehaviourPermanentRequirements();
                    await RegisterBehavioursAsync(new[] { behaviour });
                }

                if (behaviour.ActionOnAdded != null)
                {
                    EnqueueAction(behaviour.ActionOnAdded);
                }

                OnBehaviourEvent?.Invoke(Behaviours, BehaviourEvent.Add);
            }
        }
Ejemplo n.º 17
0
        public XmasBell(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasBell, playerPositionDelegate)
        {
            // Spriter
            SpriterFilename = "Graphics/Sprites/Bosses/XmasBell/xmas-bell";

            // BulletML
            BulletPatternFiles.Add("XmasBell/pattern1");
            BulletPatternFiles.Add("XmasBell/pattern2");
            BulletPatternFiles.Add("XmasBell/pattern4");
            BulletPatternFiles.Add("XmasBell/pattern5");

            // Behaviours
            Behaviours.Add(new XmasBellBehaviour1(this));
            Behaviours.Add(new XmasBellBehaviour2(this));
            //Behaviours.Add(new XmasBellBehaviour3(this));
            Behaviours.Add(new XmasBellBehaviour4(this));
            Behaviours.Add(new XmasBellBehaviour5(this));

            InitializeDestroyedParticleEffect();
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Parse behaviour string
        /// </summary>
        private void ParseBehaviours()
        {
            bool recreateBehaviour = false;

            foreach (string behaviourData in Data.Behaviour.Split(',', StringSplitOptions.RemoveEmptyEntries))
            {
                try
                {
                    ItemBehaviour behaviour = (ItemBehaviour)Enum.Parse(typeof(ItemBehaviour), behaviourData.ToUpper());
                    Behaviours.Add(behaviour);
                }
                catch
                {
                    //recreateBehaviour = true;
                    Console.WriteLine("Could not parse behaviour: " + Data.Id + " / " + behaviourData);
                }
            }

            if (recreateBehaviour)
            {
                List <string> behaviourList = new List <string>();

                foreach (ItemBehaviour behaviour in Enum.GetValues(typeof(ItemBehaviour)))
                {
                    if (HasBehaviour(behaviour))
                    {
                        behaviourList.Add(Enum.GetName(typeof(ItemBehaviour), behaviour).ToLower());
                    }
                }

                //behaviourList.Add("is_walkable");
                string behaviours = string.Join(",", behaviourList);

                this.Data.Behaviour = behaviours;
                //this.Data.Interactor = "one_way_gate";
                ItemDao.SaveDefinition(this.Data);
            }
        }
Ejemplo n.º 19
0
        public void InitProperties()
        {
            AddValidatedProperty("Gradient", false);
            AddValidatedProperty("Flat", false);
            AddValidatedProperty("CornerRadius", 0);
            AddValidatedProperty("Text", "");
            AddValidatedProperty("TextColor", Color.Navy);
            AddValidatedProperty("MouseIsDown", false);
            AddValidatedProperty("ControlKeyPressed", false);
            Property["Switch", false]
            .Changed += () =>
            {
                if (Switch)
                {
                    Behaviours.Add(Core.Behaviours.Checked(), "checked");
                }
                else
                {
                    Behaviours.Remove("checked");
                }
                Invalidate();
            };
            Value["Down"] = new Func <object>(() => { return(MouseIsDown || Checked || Value["ControlKeyPressed"].AsBoolean()); });

            AddValidatedProperty("Font", new Font("Arial", 8));
            TextAlignment      = StringAlignment.Center;
            DrawFocus          = true;
            Value["FlatIsNow"] = new Func <object>(() => { return(Flat && !MouseIsOver && !Down); });
            Property["Checked", false].Changed += () =>
            {
                Invalidate();
                if (CheckedChanged != null)
                {
                    CheckedChanged(this, new EventArgs());
                }
            };
        }
Ejemplo n.º 20
0
 public void AddBehaviour(IBehaviour behaviour)
 {
     Behaviours.Add(behaviour);
 }
Ejemplo n.º 21
0
 public void AddBehaviour(BaseBehaviour behaviour) => Behaviours.Add(behaviour);
Ejemplo n.º 22
0
        protected override void InitializeControl()
        {
            base.InitializeControl();
            progressBehaviour = new BehaviourProgress();
            Behaviours.Add(progressBehaviour, "progress");

            button1                = new DrawButton();
            button1.Size           = Size;
            button1.CornerRadius   = 1;
            button1.BorderSize     = 1;
            button1.Alignment      = RectAlignment.Top;
            button1.Transparent    = true;
            button1.Flat           = true;
            button1.TabStop        = false;
            button1.Value["Color"] = Property["Color"];
            button1.Value["MouseOverColor", (c) => { return(c.AsColor().DarkColor(20)); }] = Property["Color"];
            button1.UseMouseOverColor  = true;
            button1.Gradient           = true;
            button1.Value["Direction"] = Property["Direction"];
            this.Add(button1);

            scrollButton                   = new DrawButton();
            scrollButton.Pos               = new Point(0, button1.Height);
            scrollButton.Size              = Size;
            scrollButton.CornerRadius      = 1;
            scrollButton.BorderSize        = 1;
            scrollButton.Alignment         = RectAlignment.Absolute;
            scrollButton.Transparent       = true;
            scrollButton.CaptureMouseClick = true;
            scrollButton.Value["Color"]    = Property["Color"];
            scrollButton.Value["MouseOverColor", (c) => { return(c.AsColor().DarkColor(20)); }] = Property["Color"];
            scrollButton.UseMouseOverColor = true;
            scrollButton.TabStop           = false;
            scrollButtonDragBehaviour      = new BehaviourMouseDrag();
            scrollButton.Behaviours.Add(scrollButtonDragBehaviour, "drag");
            scrollButton.Gradient           = true;
            scrollButton.Value["Direction"] = Property["Direction"];
            this.Add(scrollButton);

            button2                = new DrawButton();
            button2.Size           = Size;
            button2.CornerRadius   = 1;
            button2.BorderSize     = 1;
            button2.Alignment      = RectAlignment.Bottom;
            button2.Transparent    = true;
            button2.Flat           = true;
            button2.TabStop        = false;
            button2.Value["Color"] = Property["Color"];
            button2.Value["MouseOverColor", (c) => { return(c.AsColor().DarkColor(20)); }] = Property["Color"];
            button2.UseMouseOverColor  = true;
            button2.Gradient           = true;
            button2.Value["Direction"] = Property["Direction"];
            this.Add(button2);

            InitProperties();
            InitializePeinters();

            this.Resize         += DrawScroll_Resize;
            this.PostMouseWheel += DrawScroll_MouseWheel;
            this.MouseDown      += DrawScroll_MouseDown;
            this.MouseUp        += DrawScroll_MouseUp;
            this.MouseEnter     += (s, e) => { button1.Flat = false; button2.Flat = false; };
            this.MouseLeave     += (s, e) => { button1.Flat = true; button2.Flat = true; };

            button1.MouseDown += (s, e) =>
            {
                Position -= SmallChange;
                button1.AnimeQueue("pos").Wait(250).Custom(100, MaxPosition, (d) => { Position -= SmallChange; });
            };
            button1.MouseUp   += (s, e) => { button1.AnimeCancel("pos"); };
            button2.MouseDown += (s, e) =>
            {
                Position += SmallChange;
                button2.AnimeQueue("pos").Wait(250).Custom(100, MaxPosition, (d) => { Position += SmallChange; });
            };
            button2.MouseUp += (s, e) => { button2.AnimeCancel("pos"); };
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Adds a behaviour to this manager.
 /// </summary>
 /// <param name="behaviour">The behaviour the manager should begin to manage.</param>
 public virtual void Add(T behaviour)
 {
     Behaviours.Add(behaviour);
 }
Ejemplo n.º 24
0
        // Adds a specific Steering if it's not already contained
        public void AddSteering(SteeringType Type)
        {
            if (!Behaviours.ContainsKey(Type))
            {
                switch (Type)
                {
                case SteeringType.Align:
                    Behaviours.Add(Type, new Align());
                    break;

                case SteeringType.AntiAlign:
                    Behaviours.Add(Type, new AntiAlign());
                    break;

                case SteeringType.Arrive:
                    Behaviours.Add(Type, new Arrive());
                    break;

                case SteeringType.Flee:
                    Behaviours.Add(Type, new Flee());
                    break;

                case SteeringType.Seek:
                    Behaviours.Add(Type, new Seek());
                    break;

                case SteeringType.VelocityMatching:
                    Behaviours.Add(Type, new VelocityMatching());
                    break;

                case SteeringType.Evade:
                    Behaviours.Add(Type, new Evade());
                    break;

                case SteeringType.Face:
                    Behaviours.Add(Type, new Face());
                    break;

                case SteeringType.LookWhereYouGoing:
                    Behaviours.Add(Type, new LookWhereYouGoing());
                    break;

                case SteeringType.ObstacleAvoidance:
                    ObstacleAvoidance O = new ObstacleAvoidance();
                    O.World = Collider.World;
                    Behaviours.Add(Type, O);
                    break;

                case SteeringType.PathFollowing:
                    Behaviours.Add(Type, new PathFollowing());
                    break;

                case SteeringType.Pursue:
                    Behaviours.Add(Type, new Pursue());
                    break;

                case SteeringType.Wander:
                    Behaviours.Add(Type, new Wander());
                    break;

                case SteeringType.Alignment:
                    Behaviours.Add(Type, new Alignment());
                    break;

                case SteeringType.Cohesion:
                    Behaviours.Add(Type, new Cohesion());
                    break;

                case SteeringType.Separation:
                    Behaviours.Add(Type, new Separation());
                    break;

                default:
                    break;
                }
            }
        }