Example #1
0
        public Controller()
        {
            this.gunFactory    = new GunFactory();
            this.playerFactory = new PlayerFactory();
            this.mainPlayer    = new MainPlayer();

            this.gunRepository     = new GunRepository();
            this.gangNeighbourhood = new GangNeighbourhood();
            this.players           = new List <IPlayer>();
        }
Example #2
0
        //----------- Constructors ------------
        //GunRepository<IGun> gunRepository, GunFactory gunFactory, INeighbourhood neighbourhood
        public Controller()
        {
            this.gunRepository = new GunRepository <IGun>();
            this.gunFactory    = new GunFactory();
            this.neighbourhood = new GangNeighbourhood();

            this.mainPlayer = new MainPlayer();
            this.players    = new Dictionary <string, IPlayer>();

            this.gunQueue = new Queue <IGun>();
        }
Example #3
0
        public Engine()
        {
            this.reader = new Reader();
            this.writer = new Writer();

            this.gunRepository = new GunRepository <IGun>();
            this.gunFactory    = new GunFactory();
            this.neighbourhood = new GangNeighbourhood();

            //gunRepository, gunFactory, neighbourhood
            this.controller = new Controller();
        }
    public void CreateObjectOnPress()
    {
        requirements = require.GetComponent <GunRequirements>();

        GunRequirements requiring = requirements;

        //Debug.Log(requiring);

        GunFactory factory = new GunFactory(requiring);

        createFactory(factory);
    }
Example #5
0
    // Start is called before the first frame update
    void Start()
    {
        GunRequirements requirements = new GunRequirements
        {
            Magazine = Mathf.Max(Magazine, 1),
            Size     = Size,
            Accuracy = Mathf.Max(Accuracy)
        };

        GunFactory factory = new GunFactory(requirements);

        createFactory(factory);
    }
Example #6
0
 public void SetGun(GameObject gun, bool val)
 {
     isAkimbo = true;
     bTextHolder.SetActive(val);
     if (gun.GetComponentInChildren <KimboRight>())
     {
         gunObject = gun.GetComponentInChildren <KimboRight>();
     }
     if (gun.GetComponentInChildren <KimboLeft>())
     {
         gunObject2 = gun.GetComponentInChildren <KimboLeft>();
     }
 }
    public void createFactory(GunFactory factory)
    {
        GunRequirements textRequire = newText.GetComponent <GunRequirements>();

        //Debug.Log(factory);
        IGun c = factory.Create();

        //Debug.Log(c);
        g_spawn.GetGun(c.ToString());
        //Debug.Log(c);

        textRequire.objectText.text = c.ToString();
    }
Example #8
0
        public static void Main()
        {
            IReader reader = new Reader();
            IWriter writer = new Writer();

            IPlayer        mainPlayer        = new MainPlayer();
            INeighbourhood gangNeighbourhood = new GangNeighbourhood();
            IGunFactory    gunFactory        = new GunFactory();

            IController controller = new Controller(
                mainPlayer,
                gangNeighbourhood,
                gunFactory);

            IEngine engine = new Engine(
                reader,
                writer,
                controller);

            engine.Run();
        }
Example #9
0
        public static void Main()
        {
            var consoleReader = new Reader();
            var consoleWriter = new Writer();

            var mainPlayer         = new MainPlayer();
            var gangNeighbourhood  = new GangNeighbourhood();
            var gunFactory         = new GunFactory();
            var civilPlayerFactory = new CivilPlayerFactory();

            var controller = new Controller(
                mainPlayer,
                gangNeighbourhood,
                gunFactory,
                civilPlayerFactory);

            var engine = new Engine(
                consoleReader,
                consoleWriter,
                controller);

            engine.Run();
        }
Example #10
0
 void Awake()
 {
     Instance = this;
 }
Example #11
0
 protected override void OneTimeSetup()
 {
     factory     = new GunFactory();
     always3     = new Rng(3);
     combatStats = new CombatStats(new Modifier(3), new Modifier(2), 20);
 }
 private void Awake()
 {
     _instance = this;
 }
Example #13
0
        static void Main(string[] args)
        {
            /*
             * UnitTestSuite testSuite = new UnitTestSuite();
             * testSuite.Run();
             */

            GunFactory gunFactory = new GunFactory();
            //IGun mh = gunFactory.Get(GunType.Pistol);
            IGun        mh          = gunFactory.Get(GunType.Pepperbox);
            IGun        artificerMh = gunFactory.Get(GunType.Pistol, WeaponTier.ArtificerReloadProperty);
            List <IGun> ohs         = new List <IGun>()
            {
                gunFactory.Get(GunType.PalmPistol),
                gunFactory.Get(GunType.PalmPistol)
            };
            List <IGun> artificerOhs = new List <IGun>()
            {
                gunFactory.Get(GunType.PalmPistol, WeaponTier.ArtificerReloadProperty)
            };
            //List<Feat> feats = new List<Feat>() { Feat.None };
            List <Feat> feats = new List <Feat>()
            {
                Feat.Sharpshooter
            };
            List <MagicInitiateSpell> buffs = new List <MagicInitiateSpell>()
            {
                MagicInitiateSpell.None
            };
            //List<MagicInitiateSpell> buffs = new List<MagicInitiateSpell>() { MagicInitiateSpell.Bless };
            //List<MagicInitiateSpell> buffs = new List<MagicInitiateSpell>() { MagicInitiateSpell.Hex };

            Rng rng = new Rng();
            //buffs = new List<MagicInitiateSpell>() { MagicInitiateSpell.Bless };
            //buffs = new List<MagicInitiateSpell>() { MagicInitiateSpell.Hex };
            Player player = new Player(rng, 8, 8, FightingStyle.Archery, mh, ohs, feats, buffs);
            //Player player = new Player(rng, 6, 8, FightingStyle.Archery, artificerMh, artificerOhs, feats, buffs);

            int   numTurns = 7;
            Enemy enemy    = new Enemy(17);

            int numSims = 100000;
            //int numSimsPerThread = numSims / 4;
            int numSimsPerThread             = numSims;
            BulkGunSlingerSimulation sim     = new BulkGunSlingerSimulation(rng, numTurns, numSims, numSimsPerThread);
            SimulationSummary        summary = sim.BulkSimulate(player, enemy);
            int totalTurns = numSims * numTurns;

            double dmgPerTurn        = (double)summary.DamageDone / totalTurns;
            double shotsPerTurn      = (double)summary.Shots / totalTurns;
            double hitsPerTurn       = (double)summary.Hits / totalTurns;
            double critsPerTurn      = (double)summary.Crits / totalTurns;
            double costPerSim        = ((double)summary.Cost / numSims) / 100;
            double brokenGunsPerTurn = (double)summary.NumberOfBrokenGuns / totalTurns;

            Console.WriteLine("------ Summary ------");
            Console.WriteLine($"Enemy AC: {enemy.ArmorClass}.");
            Console.WriteLine($"Number of Turns per sim: {numTurns}.");
            Console.WriteLine($"Number of total Turns: {totalTurns}.\n");
            Console.WriteLine($"Damage per turn: " + string.Format("{0:0.000}", dmgPerTurn));
            Console.WriteLine($"Shots per turn: " + string.Format("{0:0.000}", shotsPerTurn));
            Console.WriteLine($"Hits per turn: " + string.Format("{0:0.000}", hitsPerTurn));
            Console.WriteLine($"Crits per turn: " + string.Format("{0:0.000}", critsPerTurn));
            Console.WriteLine($"Cost per combat encounter: " + string.Format("{0:0.000}", costPerSim) + "g");
            Console.WriteLine($"Broken Guns per turn: " + string.Format("{0:0.000}", brokenGunsPerTurn));
            //Misfires?
            Console.WriteLine("---------------------");
        }