Exemplo n.º 1
0
        public static void Initalize()
        {
            AllStands        = new List <StandBase>();
            CloseRangeStands = new List <StandBase>();
            RangedStands     = new List <StandBase>();
            Assembly myAssembly = Assembly.GetAssembly(typeof(StandBase));

            foreach (Type type in myAssembly.GetTypes()
                     .Where(myType => myType.IsClass &&
                            !myType.IsAbstract &&
                            myType.IsSubclassOf(typeof(StandBase))))
            {
                StandBase stand = (StandBase)Activator.CreateInstance(type);
                AllStands.Add(stand);
                switch (stand.Class)
                {
                case StandClass.Melee:
                    CloseRangeStands.Add(stand);
                    break;

                case StandClass.Ranged:
                    RangedStands.Add(stand);
                    break;

                default:
                    CloseRangeStands.Add(stand);
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public override bool CanUseItem(Player player)
        {
            StandBase stand = Main.rand.Next(StandManager.AllStands);

            TBMPlayer.Get(player).MyStand = (StandBase)Activator.CreateInstance(stand.GetType());
            PlayerDeathReason reason = new PlayerDeathReason();

            reason.SourceCustomReason = player.name + " could not handle the power within.";

            /*if (stand is EmptyStand)
             *  player.KillMe(reason, 0, 0);*/
            return(base.CanUseItem(player));
        }
Exemplo n.º 3
0
        public override void Load(TagCompound tag)
        {
            string standName = tag.GetString("MyStand");

            if (standName != "FistStand")
            {
                MyStand = (StandBase)Activator.CreateInstance((StandManager.AllStands.Find(x => x.GetType().Name == standName).GetType()));
            }
            else
            {
                MyStand = new EmptyStand();
            }
        }
Exemplo n.º 4
0
 public override void ProcessTriggers(TriggersSet triggersSet)
 {
     if (TBMInput.ActivateStand.JustPressed && MyStand != null)
     {
         if (MyStandProjectile == null)
         {
             int projectile = Projectile.NewProjectile(player.Center, Vector2.Zero, mod.ProjectileType(MyStand.GetType().Name), 0, 0, Main.myPlayer);
             MyStandProjectile = Main.projectile[projectile];
         }
         else
         {
             StandBase stand = MyStandProjectile.modProjectile as StandBase;
             if (stand.State == StandState.Idle)
             {
                 stand.State       = StandState.Despawning;
                 MyStandProjectile = null;
             }
         }
     }
 }
Exemplo n.º 5
0
        public MainPage()
        {
            this.InitializeComponent();
            environment           = new DefaultEnvironment(new Map(1, 1)); // Did not load the map yet...
            EnvironmentTickSource = new EnvironmentTickSource(environment, SimulationCycleLengthMs);
            standbase             = new StandBase();
            var robot = new LineAndWallDetectorRobot(environment);

            Brain = new WallsAndLinesDemoBrain(robot, standbase);

            var collector = new LogCollector(Brain, this.LogViewModel);

            this.RobotViewModel = new RobotViewModel(robot);
            RobotImage.Source   = RobotViewModel.Image;

            this.MapViewModel = new MapViewModel();

            //FollowLineCommand = new CommandButtonCommand(Brain, new FollowingLineState(5.0));
            //FollowLeftWallCommand = new CommandButtonCommand(Brain, new FollowingWallOnLeftState());
            //FollowRightWallCommand = new CommandButtonCommand(Brain, new FollowingWallOnRightState());
        }
Exemplo n.º 6
0
 public override void Initialize()
 {
     Stamina    = 0;
     StaminaMax = 100;
     MyStand    = new EmptyStand();
 }
Exemplo n.º 7
0
 public WallsAndLinesDemoBrain(LineAndWallDetectorRobot robot, StandBase stand) : base(robot, stand)
 {
     CurrentState            = new SelfDiagnosticState(this);
     robot.OnLineAppears    += Robot_OnLineAppears;
     robot.OnLineDisappears += Robot_OnLineDisappears;
 }