Ejemplo n.º 1
0
 public void Ensure_that_you_cannot_eat_ice_cream_with_a_knife()
 {
     Avatar avatar = new Avatar();
     IceCream iceCream = new IceCream();
     Knife knife = new Knife();
     avatar.PickUp(knife);
     avatar.Eat(iceCream).With(knife);
 }
Ejemplo n.º 2
0
 public void Eating_raw_bacon_is_bad_for_you()
 {
     Avatar avatar = new Avatar();
     BaconSlab bacon = new BaconSlab();
     Fork fork = new Fork();
     Knife knife = new Knife();
     avatar.PickUp(fork);
     avatar.PickUp(knife);
     avatar.Eat(bacon).With(fork, knife);
 }
Ejemplo n.º 3
0
    public void DragEnd()
    {
        if (scroll.horizontal && snapInH)
        {
            targetH = points[FindNearest(scroll.horizontalNormalizedPosition, points)];
            LerpH   = true;
        }
        if (scroll.vertical && snapInV)
        {
            targetH = points[FindNearest(scroll.verticalNormalizedPosition, points)];
            LerpH   = true;
        }

        nameText.text = Knife.getKnifeName(currentIndex);
    }
Ejemplo n.º 4
0
        private static void Main()
        {
            IWeapon weapon1 = new Knife(new PoisoningEffect());

            weapon1.Stab();

            IWeapon weapon2 = new Knife(new ParalysisEffect());

            weapon2.Stab();


            IWeapon weapon3 = new Dagger(new PoisoningEffect());

            weapon3.Stab();
        }
Ejemplo n.º 5
0
    public void KnifeHit(Knife knife)
    {
        knife.myRigidbody2D.isKinematic = true;
        knife.myRigidbody2D.velocity    = Vector2.zero;
        knife.transform.SetParent(transform);
        knife.Hit = true;

        Knifes.Add(knife);

        if (Knifes.Count >= availableKnifes)
        {
            LevelManager.Instance.NexеtLevel();
        }
        GameManager.Instance.Score++;
    }
Ejemplo n.º 6
0
        // Prepare for next shooter
        private void PrepareNextShoot()
        {
            GameObject      go    = Instantiate(knifePrefab, spawnShooter.position, spawnShooter.rotation);
            ConstantForce2D mover = go.AddComponent <ConstantForce2D>();

            mover.force = Vector2.zero;
            Knife knife = go.GetComponent <Knife>();

            knife.isPlayer = true;
            knife.onCollisionWood.AddListener(delegate { onKnifeHitOnWood.Invoke(); });
            knife.onCollisionKnife.AddListener(delegate { onKnifeHitOnKnife.Invoke(); });
            knife.onCollisionFruit.AddListener(delegate { onFruitSlice.Invoke(); });
            objectsInWood.Add(go);
            shooter.mover   = mover;
            shooter.enabled = true;
        }
Ejemplo n.º 7
0
    void ShootKnife()
    {
        if (isCanShoot && CurrKnife != null && leftShoots > 0)
        {
            Knife knife = CurrKnife.GetComponent <Knife>();
            knife.Shoot();

            if (--leftShoots == 0)
            {
                knife.IsLastKnife = true;
            }

            CurrKnife = null;
            GameManager.Instance.EventManager.CallOnKnifeShoot();
        }
    }
Ejemplo n.º 8
0
        public override GameObject GetGameObject()
        {
            GameObject gameObject = Object.Instantiate(Resources.Load <GameObject>("WorldEntities/Tools/Knife"));

            ObsidianKnife component = gameObject.GetComponent <ObsidianKnife>();

            Knife knife = Resources.Load <GameObject>("WorldEntities/Tools/Knife").GetComponent <Knife>();

            component.socket           = PlayerTool.Socket.RightHand;
            component.ikAimRightArm    = true;
            component.swingSound       = Object.Instantiate(knife.attackSound, gameObject.transform);
            component.missSoundWater   = Object.Instantiate(knife.underwaterMissSound, gameObject.transform);
            component.missSoundNoWater = Object.Instantiate(knife.surfaceMissSound, gameObject.transform);

            return(gameObject);
        }
Ejemplo n.º 9
0
    // May or may not need gun to control which side gets shot


    void Start()
    {
        knifeScript  = knife.GetComponent <Knife>(); // not sure what to use this for
        bullets      = GameObject.FindWithTag("bulletHolder");
        player       = transform.parent.parent.gameObject;
        sphere       = transform.parent.gameObject;
        playerScript = player.GetComponent <PlayerMovement>();

        if (player.name == "Player2")
        {
            gunRight  = "MouseXP2";
            gunDown   = "MouseYP2";
            fireAxis  = "Fire1P2";
            knifeAxis = "Fire2P2";
        }
    }
Ejemplo n.º 10
0
        /// <summary>
        /// Adds a new KnifeStore to it's list and calls the database operation to syncronhize them.
        /// </summary>
        /// <param name="list">The entity list where the entity should be added.</param>
        public void AddKnife(IList <Knife> list, string selectedKnifeStoreId, string token)
        {
            if (selectedKnifeStoreId == null)
            {
                this.messengerService.Send("HOZZÁADÁS SIKERTELEN", "LogicResult");
            }
            Knife newKnife = new Knife();

            if ((selectedKnifeStoreId != null && selectedKnifeStoreId != string.Empty) && this.editorService.EditKnife(newKnife) == true)
            {
                Kes kb = new Kes()
                {
                    Gyartasi_Cikkszam = string.Empty,
                    Raktar_Id         = selectedKnifeStoreId,
                    Gyarto            = newKnife.Maker == null ? string.Empty : newKnife.Maker,
                    Bevont_Penge      = newKnife.Coated,
                    Acel        = newKnife.Steel == null ? string.Empty : newKnife.Steel,
                    Penge_Hossz = newKnife.BladeLength,
                    Ar          = newKnife.Price,
                    Markolat    = newKnife.Handle == null ? string.Empty : newKnife.Handle,
                    Modell_nev  = newKnife.Model == null ? string.Empty : newKnife.Model,
                };
                string    api  = hostSettings.Address() + $"Knife";
                WebClient wc   = new WebClient();
                var       json = JsonConvert.SerializeObject(kb);
                wc.Headers[HttpRequestHeader.ContentType]   = "application/json";
                wc.Headers[HttpRequestHeader.Authorization] = $"Bearer {token}";
                try
                {
                    wc.UploadString(api, "POST", json);
                }
                catch (Exception ex)
                {
                    if (ex.Message.ToString().Contains("403"))
                    {
                        this.messengerService.Send("TÖRLÉS SIKERTELEN\nNINCS ENGEDÉLYE EHHEZ", "LogicResult");
                        return;
                    }
                    this.messengerService.Send("HOZZÁADÁS SIKERTELEN", "LogicResult");
                    return;
                }
                this.messengerService.Send("HOZZÁADÁS SIKERES", "LogicResult");
                return;
            }

            this.messengerService.Send("HOZZÁADÁS MEGSZAKÍTVA", "LogicResult");
        }
Ejemplo n.º 11
0
        public async Task <IActionResult> CreateKnife(Knife knife)
        {
            Knife newKnife = new Knife
            {
                Model       = knife.Model,
                Image       = knife.Image,
                Description = knife.Description,
                Style       = knife.Style,
                Price       = knife.Price
            };

            await _context.Knives.AddAsync(knife);

            await _context.SaveChangesAsync();

            return(RedirectToAction("GetKnives", "Admin"));
        }
    public void ThrowNextKnife()
    {
        if (_preparedKnife == null)
        {
            Debug.LogWarning("Should call 'PrepareNextKnife(Knife knifePrefab)' first");
            return;
        }

        // Throw
        _preparedKnife.ActivateCollider();
        _preparedKnife.ActivatePhysics();
        _preparedKnife.Throw(ThrowDirection);

        // Prepare new knife
        _preparedKnife = null;
        StartCoroutine(WaitAndSpawnNextKnife(_preparedKnife, MinTimeToThrow));
    }
Ejemplo n.º 13
0
 public Spy()
 {
     _weapon1    = new Tranquiliser();
     _weapon2    = new SuperShotgun();
     _weapon3    = new NailGun();
     _weapon4    = new Knife();
     _gren1      = Ammunition.FragGrenade;
     _gren2      = Ammunition.GasGrenade;
     _health     = 90;
     _armour     = 50;
     _maxShells  = 50;
     _maxNails   = 100;
     _maxRockets = 50;
     _maxCells   = 50;
     _maxGren1   = 4;
     _maxGren2   = 4;
 }
Ejemplo n.º 14
0
        public void Ensure_that_properly_eating_bacon_causes_it_to_disappear_into_limbo()
        {
            Avatar avatar = new Avatar();
            BaconSlab bacon = new BaconSlab();
            avatar.PickUp(bacon);
            Assert.AreSame(avatar, bacon.ParentContainerObject);
            Assert.IsTrue(avatar.Contents.Any(x => x.ObjectId == bacon.ObjectId));

            Fork fork = new Fork();
            Knife knife = new Knife();
            avatar.PickUp(fork);
            avatar.PickUp(knife);
            bacon.Cook();
            avatar.Eat(bacon).With(fork, knife);
            Assert.IsNull(bacon.ParentContainerObject);
            Assert.IsFalse(avatar.Contents.Any(x => x.ObjectId == bacon.ObjectId));
        }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            #region singletone
            //SingleTone instance1 = SingleTone.GetInstance();

            //SingleTone instance2 = SingleTone.GetInstance();

            //Console.WriteLine(instance1.GetHashCode());
            //Console.WriteLine(instance2.GetHashCode());
            //Console.ReadLine();
            #endregion


            #region
            Knife knife = Knife.OrederKnife("Meat");
            Console.ReadLine();
            #endregion
        }
Ejemplo n.º 16
0
        private static void AddNumberOnSpecificSteel(string nameSteel, Knife knife, int number)
        {
            switch (nameSteel)
            {
            case "D2": knife.D2 += number; break;

            case "CPM154": knife.CPM154 += number; break;

            case "CPMS90V": knife.CPMS90V += number; break;

            case "12C27": knife._12C27 += number; break;

            case "14C28N": knife._14C28 += number; break;

            default:
                break;
            }
        }
        public Resteraunt(int numberOfForkAndKnifePairs)
        {
            Customers = new BufferBlock <Customer>();
            ReadyToGo = new JoinBlock <Fork, Knife, Food>(new GroupingDataflowBlockOptions()
            {
                Greedy = false
            });

            Forks.LinkTo(ReadyToGo.Target1);
            Knife.LinkTo(ReadyToGo.Target2);
            Food.LinkTo(ReadyToGo.Target3);

            for (int i = 0; i < numberOfForkAndKnifePairs; i++)
            {
                forks.Post(new Fork());
                knives.Post(new Knife());
            }
        }
Ejemplo n.º 18
0
    public override void update(Knife k)
    {
        if (k.state != Knife.States.AntiGrav)
        {
            k.removeAbility();
        }

        //interpolate translation
        Vector2 currnt_velocity = k.rb.velocity;

        k.rb.position = Vector2.Lerp(k.rb.position, toFollow.position, Time.deltaTime * translateSpeed);

        //interpolate rotation
        Vector2    vectorFromTarget = k.transform.position - toFollow.position;
        Quaternion rotateTo         = Quaternion.LookRotation(forward: Vector3.forward, upwards: vectorFromTarget);

        k.transform.rotation = Quaternion.Lerp(rotateTo, transform.rotation, Time.deltaTime * rotateSpeed);
    }
Ejemplo n.º 19
0
        public void MakeBreakfast()
        {
            // делаем кофе
            BoiledWater boiledWater = new BoiledWater();   // набираем воду
            CoffeeBeans coffeeBeans = new CoffeeBeans();   // берем зерна

            coffee = new Coffee(coffeeBeans, boiledWater); // варим кофе

            // делаем бутерброд
            Bread        bread        = new Bread();           // покупаем хлеб
            Sausage      sausage      = new Sausage();         // покупаем колбасу
            PieceBread   pieceBread   = Knife.Cut(bread);      // режем хлеб
            SausageField sausageField = Knife.Cut(sausage);    // режем колбасу

            sandwich = new Sandwich(pieceBread, sausageField); // складываем все вместе

            Console.WriteLine("Завтрак готов");
        }
Ejemplo n.º 20
0
    // Use this for initialization
    void Start()
    {
        scroll         = gameObject.GetComponent <ScrollRect>();
        scroll.inertia = false;

        if (screens > 0)
        {
            points = new float[screens];
            //stepSize = 1 / (float)(screens - 1);

            for (int i = 0; i < screens; i++)
            {
                points[i] = i * stepSize;
            }
        }
        else
        {
            points[0] = 0;
        }
        currentIndex = Util.wm.knifeID;
        targetH      = points[currentIndex];
        scroll.horizontalNormalizedPosition = targetH;
        nameText.text = Knife.getKnifeName(currentIndex);
        if (Util.wm.knifeCollectionPurchased || Util.godmode)
        {
            continueButtonText.text = "Use This Knife!";
        }

        switch (Util.wm.saberColor)
        {
        case SaberColor.blue: saberCount = 40000; break;

        case SaberColor.red: saberCount = 40001; break;

        case SaberColor.green: saberCount = 40002; break;

        case SaberColor.purple: saberCount = 40003; break;
        }
        Util.wm.flowerColor = Util.wm.flowerColor % 4 + 40000;
        Util.wm.shoeColor   = Util.wm.shoeColor % 4 + 40000;
        setSaberColor();
        setFlowerColor();
        setShoeColor();
    }
Ejemplo n.º 21
0
    IEnumerator KnifeToss(int number)
    {
        Vector3 targetVector = playerTransform.position - transform.position;

        targetVector.Normalize();
        Vector3 perpendicularVector = new Vector3(-targetVector.y, targetVector.x, 0f);

        Vector3[]    knifePos = new Vector3[number];
        GameObject[] knives   = new GameObject[number];
        // Create a number of knives that fan out.
        for (int i = 0; i < number; i++)
        {
            float adjustedIndex = i - ((number - 1) / 2f);
            knifePos[i] = adjustedIndex * perpendicularVector + targetVector + transform.position;
            GameObject knife = knifePooler.GetDanmaku(knifeIndex);
            knife.SetActive(true);
            if (knife != null)
            {
                Knife knifeScript = knife.GetComponent <Knife>();
                knife.transform.position = gameObject.transform.position;
                knifeScript.SetOwner(gameObject);
                knifeScript.SetTarget(playerTransform);
                knifeScript.StartSpinningAnimation(2f);
                knifeScript.StartAimingAnimation(1f);
                knives[i] = knife;
            }
        }
        // Lerp to be in front of the user
        for (int j = 0; j < 60; j++)
        {
            for (int i = 0; i < number; i++)
            {
                GameObject knife = knives[i];
                knife.transform.position = Vector3.LerpUnclamped(knife.transform.position, knifePos[i], 0.05f);
            }
            yield return(new WaitForSeconds(0.016f));
        }
        for (int i = 0; i < number; i++)
        {
            GameObject knife = knives[i];
            knife.transform.position = knifePos[i];
        }
    }
Ejemplo n.º 22
0
    private void Awake()
    {
        if (Instance != null)
        {
            Destroy(gameObject);
        }
        Instance = this;

        // Load Data
        if (PlayerPrefs.HasKey(CURRENT_KNIFE_INDEX_SAVE_KEY))
        {
            var index = PlayerPrefs.GetInt(CURRENT_KNIFE_INDEX_SAVE_KEY);
            CurrentKnifePrefab = AllKnives[index];
        }
        else
        {
            SetCurrentKnife(0);
        }
    }
Ejemplo n.º 23
0
        public void TestIfWeaponIsBroken()
        {
            Knife knife = new Knife();

            knife.Durability = 0;

            bool IsBroken;

            if (knife.IsBroken)
            {
                IsBroken = true;
            }
            else
            {
                IsBroken = false;
            }

            Assert.AreEqual(true, IsBroken, "Knife isn't broken when its durability its 0.");
        }
        public ActionResult RemoveKnife(int?id)
        {
            using (var db = new GunStoreContext())
            {
                if (id != null)
                {
                    Knife knife = db.Knives.Include(b => b.BasketKnives).Where(b => b.Id == id).Single <Knife>();
                    foreach (var item in knife.BasketKnives)
                    {
                        db.BasketKnives.Remove(item);
                    }
                    db.Knives.Remove(knife);
                    db.SaveChanges();
                }

                List <Knife> knives = db.Knives.ToList();
                return(View(knives));
            }
        }
Ejemplo n.º 25
0
        public async Task Stab(IGuildUser userToStab, [Own][Remainder] Knife knife)
        {
            if (userToStab.Id == Context.User.Id)
            {
                ReplyError("Hey, look at that retard! He's trying to stab himself lmfao.");
            }

            var dbUser = await _userRepo.GetUserAsync(userToStab);

            if (CryptoRandom.Roll() < knife.Accuracy)
            {
                var invData = _gameService.InventoryData(dbUser);
                var damage  = invData.Any(x => x is Armour) ? (int)(knife.Damage * 0.8) : knife.Damage;
                //TODO: Rework armour.

                await _userRepo.ModifyAsync(dbUser, x => x.Health -= damage);

                if (dbUser.Health <= 0)
                {
                    foreach (var item in dbUser.Inventory.Elements)
                    {
                        await _gameService.ModifyInventoryAsync(Context.DbUser, item.Name, item.Value.AsInt32);
                    }

                    await _userRepo.DeleteAsync(dbUser);

                    await userToStab.TryDMAsync($"Unfortunately, you were killed by {Context.User.Boldify()}. All your data has been reset.");

                    await _userRepo.EditCashAsync(Context, dbUser.Bounty);
                    await ReplyAsync($"Woah, you just killed {userToStab.Boldify()}. You just earned {dbUser.Bounty.USD()} **AND** their inventory, congrats.");
                }
                else
                {
                    await userToStab.TryDMAsync($"{Context.User} tried to kill you, but n***a *AH, HA, HA, HA, STAYIN' ALIVE*. -{damage} health. Current Health: {dbUser.Health}");
                    await ReplyAsync($"Just stabbed that n***a in the heart, you just dealt {damage} damage to {userToStab.Boldify()}.");
                }
            }
            else
            {
                await ReplyAsync($"This n***a actually did some acrobatics shit and bounced out of the way before you stabbed him.");
            }
            _cooldownService.TryAdd(new CommandCooldown(Context.User.Id, Context.Guild.Id, "Stab", Config.StabCooldown));
        }
Ejemplo n.º 26
0
    public override void Die()
    {
        // hp = 1;
        Debug.Log("I died");
        // pistolBody.position  = new Vector3(0f,0f,0f);
        // pistolBody.velocity  = new Vector3(0f,0f,0f);
        // pistolBody.rotation  = Quaternion.identity;
        GameObject[] enemys = GameObject.FindGameObjectsWithTag("Enemys");

        foreach (GameObject enemyT in enemys)
        {
            EnemyScript e = enemyT.GetComponent <EnemyScript>();
            if (e != null)
            {
                e.DieEnd();
            }
            Knife e1 = enemyT.GetComponent <Knife>();
            if (e1 != null)
            {
                e1.DieEnd();
            }
        }

        GameObject[] collects = GameObject.FindGameObjectsWithTag("Collect");
        foreach (GameObject collectT in collects)
        {
            ChangeAmmo e = collectT.GetComponent <ChangeAmmo>();
            if (e != null)
            {
                e.DieEnd();
            }
        }


        if (score > highScore)
        {
            highScore = score;
            PlayerPrefs.SetInt("Score", highScore);
        }
        // hp = 1;
        score = 0;
    }
Ejemplo n.º 27
0
    public void useAbility(int abilityIdx, bool hold)
    {
        float test = range.getRange();

        if (abilityIdx >= 0 && abilityIdx < abilities.Length)
        {
            Ability ability = abilities[abilityIdx];
            if (!hold)
            {
                Knife.getKnives(Camera.main.ScreenToWorldPoint(Input.mousePosition), range.getRange()).ForEach
                (
                    k => k.applyAbility(ability)
                );
            }
            else
            {
                Knife.setHoldAbility(ability);
            }
        }
    }
        public IWeapon Create(string rarity, string type, string name)
        {
            IWeapon weapon = null;

            switch (type)
            {
            case "Axe":
                weapon = new Axe(name, Enum.Parse <WeaponClarity>(rarity));
                break;

            case "Knife":
                weapon = new Knife(name, Enum.Parse <WeaponClarity>(rarity));
                break;

            case "Sword":
                weapon = new Sword(name, Enum.Parse <WeaponClarity>(rarity));
                break;
            }
            return(weapon);
        }
Ejemplo n.º 29
0
        public void Eat(Fork Fork, Knife Knife)
        {
            lock (locker)
            {
                if (Fork.State == true && Knife.State == true)
                {
                    Fork.IsUsed();
                    Knife.IsUsed();

                    Console.WriteLine($"{Name} omnomonomonom");

                    Fork.Freed();
                    Knife.Freed();
                }
                else
                {
                    Console.WriteLine($"{Name} Can't Eating Cutlery State is false(((");
                }
            }
        }
Ejemplo n.º 30
0
 IEnumerator JackTheRipper(Vector3 centerPoint, float radius, int number)
 {
     for (int i = 0; i < number; i++)
     {
         float      angle = (-i / (float)number) * 2 * Mathf.PI + Mathf.PI / 2;
         float      xPos  = centerPoint.x + radius * Mathf.Cos(angle);
         float      yPos  = centerPoint.y + radius * Mathf.Sin(angle);
         GameObject knife = knifePooler.GetDanmaku(1);
         if (knife != null)
         {
             Knife knifeScript = knife.GetComponent <Knife>();
             knife.transform.position = new Vector3(xPos, yPos, 0f);
             knife.SetActive(true);
             knifeScript.SetTarget(playerTransform);
             knifeScript.StartSpinningAnimation(3f);
             knifeScript.StartAimingAnimation(3f);
         }
         yield return(new WaitForSeconds(2f / number));
     }
 }
Ejemplo n.º 31
0
        public IList <Knife> GetAllKnivesForStore(string knifeStoreId, string token)
        {
            ObservableCollection <Knife> knifeStores = new ObservableCollection <Knife>();

            try
            {
                string    api = hostSettings.Address() + $"Knife/AllKnifesForKnifeStore/{knifeStoreId}";
                WebClient wc  = new WebClient();
                wc.Headers[HttpRequestHeader.Authorization] = $"Bearer {token}";
                string           jsonContent = wc.DownloadString(api);
                IQueryable <Kes> ks          = JsonConvert.DeserializeObject <List <Kes> >(jsonContent).AsQueryable();

                //IQueryable<Kes_Bolt> kbs = this.knifeStoreLogic.GetAllKes_Bolt();
                if (ks == null)
                {
                    return(knifeStores);
                }

                foreach (var item in ks)
                {
                    Knife k = new Knife()
                    {
                        StorageId    = item.Raktar_Id,
                        Maker        = item.Gyarto,
                        Steel        = item.Acel,
                        BladeLength  = item.Penge_Hossz,
                        SerialNumber = item.Gyartasi_Cikkszam,
                        Coated       = item.Bevont_Penge,
                        Handle       = item.Markolat,
                        Model        = item.Modell_nev,
                        Price        = item.Ar
                    };
                    knifeStores.Add(k);
                }
            }
            catch
            {
                this.messengerService.Send("A SZERVER NEM ELÉRHETŐ", "LogicResult");
            }
            return(knifeStores);
        }
Ejemplo n.º 32
0
    public override void updateHold(Knife k)
    {
        if (k.state != Knife.States.AntiGrav)
        {
            k.removeAbility();
        }

        Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);


        //interpolate translation
        Vector3 offset;

        if (!offsets.TryGetValue(k, out offset))
        {
            offset = Vector2.zero;
        }
        Vector2 currnt_velocity = k.rb.velocity;

        k.rb.position = Vector2.Lerp(k.rb.position, mousePos + offset, Time.deltaTime * translateSpeed);

        // interpolate rotation
        if ((lastMousePos - mousePos).magnitude < .1f)
        {
            Vector2 vectorToTarget = mousePos - k.transform.position;
            if (vectorToTarget.magnitude > .1f)
            {
                Quaternion rotateTo = Quaternion.LookRotation(forward: Vector3.forward, upwards: vectorToTarget);
                k.transform.rotation = Quaternion.Lerp(rotateTo, transform.rotation, Time.deltaTime * rotateSpeed);
            }
        }
        else
        {
            print("fast enough");
            if (deltaMouseVector.magnitude > 0.01f)
            {
                Quaternion rotateTo = Quaternion.LookRotation(forward: Vector3.forward, upwards: deltaMouseVector);
                k.transform.rotation = Quaternion.Lerp(rotateTo, transform.rotation, Time.deltaTime * rotateSpeed / 5000);
            }
        }
    }
Ejemplo n.º 33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EditorViewModel"/> class.
 /// Constructor which sets up a new entity fills it in designer mode.
 /// </summary>
 public EditorViewModel()
 {
     this.knifeStore = new KnifeStore();
     this.knife      = new Knife();
     this.review     = new Review();
     if (this.IsInDesignMode)
     {
         // KnifeStore sample
         // knifeStore.StorageId = Guid.NewGuid(); //this is not needed for preview
         this.knifeStore.Name    = "BladeHQ";
         this.knifeStore.Address = "Random strt 8.";
         this.KnifeStore.Website = "www.bladehq.com";
         // Knife sample
         this.knife.Steel       = "S30V";
         this.knife.Model       = "Paramilitary 2";
         this.knife.Maker       = "Spyderco";
         this.knife.Coated      = false;
         this.Knife.Price       = 65000;
         this.knife.BladeLength = 90;
         this.knife.Handle      = "G10";
     }
 }
Ejemplo n.º 34
0
 public void AddKnife(Vector2 Position, Knife.KnifeDirection Dir)
 {
     //Debug.Print("Knife " + Position);
     knives.Add(new Knife(Position, this.Texture, Dir));
 }
Ejemplo n.º 35
0
 public Knife(Vector2 Position, Texture2D Texture, Knife.KnifeDirection Direction)
 {
     this.Position = Position;
     this.Texture = Texture;
     this.dir = Direction;
 }
Ejemplo n.º 36
0
        public void Ensure_that_you_can_eat_bacon_with_a_knife_and_fork_and_doing_so_makes_them_dirty()
        {
            Avatar avatar = new Avatar();
            BaconSlab bacon = new BaconSlab();
            avatar.PickUp(bacon);
            Assert.AreSame(avatar, bacon.ParentContainerObject);
            Assert.IsTrue(avatar.Contents.Any(x => x.ObjectId == bacon.ObjectId));

            Fork fork = new Fork();
            Knife knife = new Knife();
            avatar.PickUp(fork);
            avatar.PickUp(knife);

            Assert.AreEqual(DirtRating.SqueakyClean, fork.DirtRating);
            Assert.AreEqual(100m, fork.PercentClean);
            Assert.AreEqual(DirtRating.SqueakyClean, knife.DirtRating);
            Assert.AreEqual(100m, knife.PercentClean);

            bacon.Cook();
            avatar.Eat(bacon).With(fork, knife);

            Assert.AreEqual(DirtRating.Smudged, fork.DirtRating);
            Assert.AreEqual(80m, fork.PercentClean);
            Assert.AreEqual(DirtRating.Smudged, knife.DirtRating);
            Assert.AreEqual(80m, knife.PercentClean);
        }
Ejemplo n.º 37
0
    void Chop(Knife.ChopMode chop)
    {
        if (ChopsToKill[chopCount] == chop)
        {
            chopCount++;

            if (ChopsToKill.Count == chopCount)
            {
                // done chopping, kill

                // run mesh-divider
                // update game class kill count
                OnDeath(true);
                // after interval, remove pieces, put stuff on plate  
                Debug.Log("Success! Awarded pts : " + scoreValue.ToString());
            }
        }
        else
        {
            // chopped wrongly, kill but no rewards

            // run mesh divider
            // update game class fail count
            OnDeath(false);
            // leave chopped bits where they are
            Debug.Log("Fail!");
        }
    }    
Ejemplo n.º 38
0
    public void Chop(Knife.ChopMode chop)
    {
        if (state < MonState.Derpy) return;
        
        if (chopCount >= ChopsToKill.Count) return;

        // we chopped at the right angle
        if (ChopsToKill[chopCount] == chop)
        {
            chopCount++;

            if (ChopsToKill.Count == chopCount)
            {
                // done chopping, kill

                // run mesh-divider
                // update game class kill count
                Debug.Log("KILLED", this);
                state = MonState.Dead;
                if (OnDeath != null)
                    OnDeath(true, this);

                // after interval, remove pieces, put stuff on plate  
                Debug.Log("Success! Awarded pts : " + scoreValue.ToString());
            }

            if (OnChop != null)
                OnChop(true, this);

        }
        // we chopped at the wrong angle
        else
        {
            state = MonState.Dead;

            if (OnDeath != null)
                OnDeath(false, this);

            // chopped wrongly, kill but no rewards
            if (OnChop != null)
                OnChop(false, this);

            // run mesh divider
            // update game class fail count
            
            

            // leave chopped bits where they are
            Debug.Log("Fail!");
        }
    }