Inheritance: MonoBehaviour
Exemplo n.º 1
0
 private Deserializer(Itemizer itemizer)
 {
     this.itemizer  = itemizer;
     this.types     = TypeCache.Instance;
     this.arrayBank = new Dictionary <TypeInfo, Stack <KeyValuePair <TypeInfo, IList> > >();
     this.valueBank = new BufferBank <MemberValue>();
 }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     trainSpawn = GameObject.Find ("trainSpawner");
     gunSprite = GameObject.Find ("Gun").GetComponent<SpriteRenderer>();
     money = GameObject.Find ("Main Camera").GetComponent<Itemizer>();
     Invoke("ActivateCollider", .2f); //Delay trigger activation so player doesn't immediately pickup when firing
 }
Exemplo n.º 3
0
 private TextSerializer(Itemizer itemizer, string indent, TextWriter writer)
 {
     this.itemizer      = itemizer;
     this.indent        = indent ?? string.Empty;
     this.currentIndent = string.Empty;
     this.indentBuffer  = new StringBuilder(this.indent.Length != 0 ? Environment.NewLine : string.Empty);
     this.states        = new Stack <State>(Constants.BufferSize);
     this.writer        = writer;
 }
Exemplo n.º 4
0
 // Use this for initialization
 virtual protected void Start()
 {
     health     *= Multiplier.enemyHealth;
     EnemySpeed *= Multiplier.enemySpeed;
     money       = GameObject.Find("Main Camera").GetComponent <Itemizer>();
     Player      = GameObject.Find("character");
     HYPECounter = GameObject.Find("character").GetComponent <ScoreKeeper>();
     Invoke("endDelay", initialDelay);
 }
Exemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     health           *= Multiplier.enemyHealth;
     DinoSpeed        *= Multiplier.enemySpeed;
     dashCastTransform = gameObject.transform.Find("dashCast");
     money             = GameObject.Find("Main Camera").GetComponent <Itemizer>();
     Player            = GameObject.Find("character");
     HYPECounter       = GameObject.Find("character").GetComponent <ScoreKeeper>();
 }
Exemplo n.º 6
0
 protected Parser(JsonContext context, Itemizer itemizer)
 {
     this.context               = context;
     this.itemizer              = itemizer;
     this.keyCache              = new Dictionary <Key, Key>(Constants.BufferSize, KeyComparer.Instance);
     this.parseKeys             = new BufferBank <Key>();
     this.parseValues           = new BufferBank <JsonValue>();
     this.values                = new Dictionary <ValueData, JsonValue>(Constants.BufferSize, ValueDataComparer.Instance);
     this.emptyValuesArray      = new ValueList(Parser.EmptyValues, this.context);
     this.emptyValuesDictionary = new ValueList(Parser.EmptyKeys, Parser.EmptyValues, this.context);
     this.context.InvalidValue  = new JsonValue(new ValueData(default, this.emptyValuesArray));
Exemplo n.º 7
0
        public void CountDuplicatesTest_GiveDuplicatesAndSingleItems_WillPrintThemGrouped()
        {
            Swords testSword = new Swords();

            testSword.Name  = "testSword";
            testSword.Price = 5;
            Shields testShield = new Shields();

            testShield.Name  = "testShield";
            testShield.Price = 10;
            Consumables testConsumable = new Consumables();

            testConsumable.Name  = "testConsumable";
            testConsumable.Price = 15;
            Potions testPotion = new Potions();

            testPotion.Name  = "testPotion";
            testPotion.Price = 20;
            Masks testMask = new Masks();

            testMask.Name  = "testMask";
            testMask.Price = 25;

            List <Product> testCart = new List <Product>();

            for (int i = 0; i < 5; i++)
            {
                testCart.Add(testSword);
            }

            for (int i = 0; i < 132; i++)
            {
                testCart.Add(testShield);
            }

            testCart.Add(testConsumable);

            for (int i = 0; i < 45; i++)
            {
                testCart.Add(testPotion);
            }

            for (int i = 0; i < 98; i++)
            {
                testCart.Add(testMask);
            }

            string expected = "testSword x 5 - - - 25 Rupees\n\ntestShield x 132 - - - 1320 Rupees\n\ntestConsumable" +
                              " x 1 - - - 15 Rupees\n\ntestPotion x 45 - - - 900 Rupees\n\ntestMask x 98 - - - 2450 Rupees\n\n";

            string itemizerTest = Itemizer.CountDuplicates(testCart);

            Assert.AreEqual(expected, itemizerTest);
        }
Exemplo n.º 8
0
        public static object Deserialize(Itemizer itemizer, object instance, Type type)
        {
            Deserializer deserializer = new Deserializer(itemizer);
            Result       result       = new Result(instance);
            FieldInfo    memberInfo   = new FieldInfo(deserializer.types.GetTypeInfo(typeof(Result)), Result.ValueField, type ?? instance?.GetType());

            MemberValue value = deserializer.DeserializeValue(itemizer.NextItem(), result, nameof(Result.value), memberInfo);

            Debug.Assert(itemizer.NextItem().Type == ItemType.End);

            value.SetValue(deserializer, result);
            return(result.value);
        }
Exemplo n.º 9
0
        public void GetTotalTest_GiveRandomPricedProducts_WillPrintTheTotalPrice()
        {
            Swords testSword = new Swords();

            testSword.Name  = "testSword";
            testSword.Price = 5;
            Shields testShield = new Shields();

            testShield.Name  = "testShield";
            testShield.Price = 10;
            Consumables testConsumable = new Consumables();

            testConsumable.Name  = "testConsumable";
            testConsumable.Price = 15;
            Potions testPotion = new Potions();

            testPotion.Name  = "testPotion";
            testPotion.Price = 20;
            Masks testMask = new Masks();

            testMask.Name  = "testMask";
            testMask.Price = 25;

            List <Product> testCart = new List <Product>();

            for (int i = 0; i < 5; i++)
            {
                testCart.Add(testSword);
            }

            for (int i = 0; i < 132; i++)
            {
                testCart.Add(testShield);
            }

            testCart.Add(testConsumable);

            for (int i = 0; i < 45; i++)
            {
                testCart.Add(testPotion);
            }

            for (int i = 0; i < 98; i++)
            {
                testCart.Add(testMask);
            }

            int actual = Itemizer.GetTotal(testCart);

            Assert.AreEqual(4710, actual);
        }
Exemplo n.º 10
0
        public static void Serialize(Itemizer itemizer, string indent, TextWriter writer)
        {
            TextSerializer serializer = new TextSerializer(itemizer, indent, writer);

            serializer.Serialize(itemizer.NextItem());
        }
Exemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     money = GameObject.Find ("Main Camera").GetComponent<Itemizer> ();
 }
Exemplo n.º 12
0
 // Use this for initialization
 void Start()
 {
     money = GameObject.Find("Main Camera").GetComponent <Itemizer>();
 }
Exemplo n.º 13
0
    // Use this for initialization
    void Start()
    {
        health *= Multiplier.enemyHealth;
        DinoSpeed *= Multiplier.enemySpeed;
        money = GameObject.Find ("Main Camera").GetComponent<Itemizer>();
        Player = GameObject.Find("Player");
        HYPECounter = GameObject.Find("Player").GetComponent<ScoreKeeper>();

        transform.localEulerAngles = new Vector3 (0, 180, 0);
        ledgeAnimator.Play ("dinoPlat_idle");
    }
Exemplo n.º 14
0
 // Use this for initialization
 protected override void Start()
 {
     base.Start();
     player = GameObject.Find("Player");
     itemCreator = GameObject.Find("Main Camera").GetComponent<Itemizer>();
     HYPECounter = player.GetComponent<ScoreKeeper>();
     strollDistance += Random.Range(0, 1f);
     visionRayLocation = transform.Find("raycasts/Vision Ray");
     jumpCheckLocation = transform.Find("raycasts/JumpCheck"); //checks to see if you need to jump
     obstacleHeightCheckLocation = transform.Find("raycasts/ObstacleCheck"); //checks to see if you can clear the obstacle
     StrollStartLocation = transform.position;
 }
Exemplo n.º 15
0
 protected ItemParser(Itemizer itemizer)
     : base(new JsonContext(null), itemizer)
 {
     this.textBufferPositions = new Dictionary <Key, int>(ItemParser.TextBufferPositionsSize, KeyComparer.Instance);
     this.textBuffer          = new StringBuilder(ItemParser.TextBufferSize);
 }
Exemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     trainSpawn = GameObject.Find("trainSpawner");
     money      = GameObject.Find("Main Camera").GetComponent <Itemizer>();
 }
Exemplo n.º 17
0
 // Use this for initialization
 protected virtual void Start()
 {
     health *= Multiplier.enemyHealth;
     EnemySpeed *= Multiplier.enemySpeed;
     money = GameObject.Find ("Main Camera").GetComponent<Itemizer>();
     Player = GameObject.Find("Player");
     HYPECounter = GameObject.Find("Player").GetComponent<ScoreKeeper>();
     initialDelay = Random.Range (.1f, .5f);
     Invoke ("endDelay", initialDelay);
 }