Пример #1
1
        public Fruit(World world, Vector2 position, FruitType fruitType)
            : base(world, position)
        {
            this._fruitType = fruitType;
            switch (fruitType)
                {
                case FruitType.Apple:
                    this.Energy = 6;
                    break;
                case FruitType.Watermelon:
                    this.Energy = 8;
                    break;
                case FruitType.Pineapple:
                    this.Energy = 10;
                    break;
                case FruitType.Strawberry:
                    this.Energy = 12;
                    break;
                case FruitType.Cherries:
                    this.Energy = 14;
                    break;
                case FruitType.Acorn:
                    this.Energy = 16;
                    break;
                default:
                    throw new InvalidOperationException();
                }

            string textureName = string.Format("Sprites/Fruit/{0:G}", _fruitType);
            var a = Animation.StaticAnimation(World, textureName);
            this.Ap.PlayAnimation(a);
        }
Пример #2
0
        public Fruit AddFruit(Vector2 position, FruitType fruitType, int energy)
        {
            var result = new Fruit(position, fruitType, energy);

            this._gameObjectCollection.Add(result);
            return(result);
        }
Пример #3
0
        void AddFruit(IAsyncResult ar)
        {
            // Harvest the results
            FruitType fruitType = (FruitType)ar.AsyncState;
            string    fruitXaml = client.EndGetFruit(ar);

            // Parse the XAML data
            FrameworkElement graphic = null;

            using (StringReader sreader = new StringReader(fruitXaml))
                using (XmlTextReader xreader = new XmlTextReader(sreader))
                {
                    graphic = (FrameworkElement)XamlReader.Load(xreader);
                    graphic.LayoutTransform = new ScaleTransform(0.25, 0.25);
                }

            // Compose some text and the graphic
            TextBlock text = new TextBlock();

            text.Text = fruitType.ToString() + ": ";

            StackPanel fruitPanel = new StackPanel();

            fruitPanel.Orientation = Orientation.Horizontal;
            fruitPanel.Children.Add(text);
            fruitPanel.Children.Add(graphic);

            // Show the text and the graphic

            _stackPanel.Children.Add(fruitPanel);
        }
Пример #4
0
 public Fruit(FruitType type, double sugar, double calories, string name, double price, double weight)
     : base(name, price, weight)
 {
     this._type = type;
     this.Sugar = sugar;
     this.Calories = calories;
 }
Пример #5
0
 private void Spawn()
 {
     isInNewRound = false;
     fruitType    = Game.GetNextFruitType();
     UpdateFruitSprite();
     gameObject.SetActive(true);
 }
Пример #6
0
    private void InitFruit()
    {
        // select randomly from the FruitTypes available and init fruit logic
        Array fruitTypes = Enum.GetValues(typeof(FruitType));

        this.fruitType = (FruitType)fruitTypes.GetValue(Random.Range(0, fruitTypes.Length));
        switch (this.fruitType)
        {
        case FruitType.Apple:
            this.fruitImage.sprite = this.apple;
            break;

        case FruitType.Lemon:
            this.fruitImage.sprite = this.lemon;
            break;

        case FruitType.Lime:
            this.fruitImage.sprite = this.lime;
            break;

        case FruitType.Orange:
            this.fruitImage.sprite = this.orange;
            break;

        case FruitType.Grape:
            this.fruitImage.sprite = this.grape;
            break;

        case FruitType.Cherry:
            this.fruitImage.sprite = this.cherry;
            break;
        }
    }
Пример #7
0
        //设置押注点数
        public bool SetFruitSlotPoint(FruitType fruitType, int addPoint)
        {
            var gdata  = App.GameData;
            var player = gdata.GetPlayer();

            //如果现在不允许押注,则直接退出:不让押注状态,或者没钱,不让押注
            if (_slotEnable == false || player.Coin < addPoint)
            {
                return(false);
            }


            int fruitCout = _fruitSlotList[fruitType];

            if (fruitCout < 99)
            {
                _fruitSlotList[fruitType] += addPoint;
                // UserMoneyCount -= addPoint;//点击押注点,扣钱
            }
            else
            {
                _fruitSlotList[fruitType] = 0;
            }
            return(true);
        }
Пример #8
0
    public void UpdateScore(FruitType objType)
    {
        switch (objType)
        {
        case FruitType.Apple:
            score += 10;
            break;

        case FruitType.Lemon:
            score += 15;
            break;

        case FruitType.WaterMelon:
            score += 20;
            break;

        case FruitType.Bomb:
            score -= 50;
            break;

        default:
            break;
        }
        scoreUI.text = "Score : " + score;
        if (score < 0)
        {
            GameOver();
        }
    }
Пример #9
0
 public Fruit(FruitType fruitType, Point location, int score)
 {
     Location    = location;
     Size        = FruitSize;
     Score       = score;
     MyFruitType = fruitType;
 }
Пример #10
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            Type = (FruitType)reader.ReadByte();
        }
Пример #11
0
        private string GetName(FruitType type)
        {
            string name = "";

            switch (type)
            {
            case FruitType.Apples: name = "a tub of apples"; break;

            case FruitType.Bananas: name = "a tub of bananas"; break;

            case FruitType.Bread: name = "a tub of bread loaves"; break;

            case FruitType.Gourds: name = "a tub of gourds"; break;

            case FruitType.Grapes: name = "a tub of grapes"; break;

            case FruitType.Lemons: name = "a tub of lemons"; break;

            case FruitType.Tomatoes: name = "a tub of tomatoes"; break;

            case FruitType.Vegetables1: name = "a tub of vegetables"; break;

            case FruitType.Vegetables2: name = "a tub of vegetables"; break;

            case FruitType.Vegetables3: name = "a tub of vegetables"; break;
            }

            return(name);
        }
Пример #12
0
        private void SetType(FruitType type)
        {
            int itemId = 0;

            switch (type)
            {
            case FruitType.Apples: itemId = 0x2D7A; break;

            case FruitType.Bananas: itemId = 0x2D7B; break;

            case FruitType.Bread: itemId = 0x2D76; break;

            case FruitType.Gourds: itemId = 0x2D7E; break;

            case FruitType.Grapes: itemId = 0x2D7D; break;

            case FruitType.Lemons: itemId = 0x2D7C; break;

            case FruitType.Tomatoes: itemId = 0x2D75; break;

            case FruitType.Vegetables1: itemId = 0x2D77; break;

            case FruitType.Vegetables2: itemId = 0x2D78; break;

            case FruitType.Vegetables3: itemId = 0x2D79; break;
            }

            ItemID = itemId;
            _type  = type;
        }
Пример #13
0
        private static IEnumerable <string> CreateImageList(FruitType shipType)
        {
            string filename;

            switch (shipType)
            {
            case FruitType.Red:
                filename = "red";
                break;

            case FruitType.Green:
                filename = "green";
                break;

            default:
                filename = "red";
                break;
            }
            List <string> imageList = new List <string>();

            /*for (int i = 1; i <= 4; i++)
             *  imageList.Add(filename + i + ".png");*/
            imageList.Add(filename + ".png");
            return(imageList);
        }
Пример #14
0
    static void Main(string[] args)
    {
        var       fruitFactory = new FruitFactory();
        FruitType fruitType    = AcquireFruit();
        IFruit    fruit        = fruitFactory.GetInstance(fruitType);

        fruit.Prepare();
        fruit.Eat();
    }
Пример #15
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            _FruitType = (FruitType)reader.ReadInt();
            _Vintage = reader.ReadString();
            _Maker = reader.ReadMobile();
        }
Пример #16
0
        public FruitTub(FruitType type)
            : base(0x2D7A)
        {
            Name   = GetName(type);
            Weight = 5.0;

            InitContents(type);
            SetType(type);
        }
Пример #17
0
        public BottleOfWine(FruitType type, string vintage, string year)
            : base(BeverageType.Wine)
        {
            Quantity = MaxQuantity;

            FruitType = type;
            Vintage   = vintage;
            Year      = year;
        }
Пример #18
0
        public Fruit(Vector2 position, FruitType fruitType, int energy) : base(position)
        {
            this.FruitType = fruitType;
            this.Energy    = energy;
            string textureName = $"Sprites/Fruit/{this.FruitType:G}";

            this._animationPlayer = new StaticAnimation(this, textureName);
            this.Properties.Set(GameObjectProperties.DrawOrder, (int)SpriteDrawOrder.StaticItem);
        }
Пример #19
0
		public FruitTub( FruitType type )
			: base( 0x2D7A )
		{
			Name = GetName( type );
			Weight = 5.0;

			InitContents( type );
			SetType( type );
		}
Пример #20
0
        public BottleOfWine(FruitType type, string vintage, Mobile maker)
            : base(BeverageType.Wine)
        {
            Quantity = MaxQuantity;

            _FruitType = type;
            _Vintage = vintage;
            _Maker = maker;
        }
 public static IFruit CreateFruit(FruitType f)
 {
     switch(f)
     {
         case FruitType.Banana: return new Banana();
         case FruitType.Apple: return new Apple();
         default: return null;
     }
 }
Пример #22
0
 public FruitTree(FruitType type, Map map, Vector2 position) : base(type.Texture, map, position)
 {
     this.Type            = type;
     this.FruitTimer      = this.Type.Time;
     this.RenderBounds    = new RectangleF(-1.5F, -3.5F, 3, 4);
     this.FadeBounds      = new RectangleF(-1.5F, -3.5F, 3, 3);
     this.CollisionBounds = new RectangleF(-0.3F, -0.3F, 0.6F, 0.6F);
     this.HighlightBounds = new RectangleF(-0.3F, -2F, 0.6F, 2.3F);
 }
Пример #23
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (_Fermented)
            {
                from.SendLocalizedMessage(1157245); // The fermentation barrel is not empty. Empty it first to add fruit and yeast.
            }
            else if (_Fermenting)
            {
                from.SendLocalizedMessage(1157244); // You may not add anything to the fermentation barrel after fermentation has begun.
            }
            else if (dropped is Yeast)
            {
                if (HasYeast)
                {
                    from.SendLocalizedMessage(1157256); // You have already added yeast to the barrel.
                }
                else
                {
                    BacterialResistance = ((Yeast)dropped).BacterialResistance;
                    dropped.Delete();
                }
            }
            else
            {
                FruitType type = GetFruitType(dropped.GetType());

                if (_FruitType != FruitType.None && _FruitType != type)
                {
                    from.SendLocalizedMessage(1157243); // You may only put one type of fruit in the fermentation barrel at one time. Empty the barrel first.
                }
                else if (type != FruitType.None)
                {
                    if (_FruitType == FruitType.None)
                    {
                        _FruitType = type;
                    }

                    if (_Fruit + dropped.Amount <= MaxFruit)
                    {
                        Fruit += dropped.Amount;
                        dropped.Delete();
                    }
                    else
                    {
                        dropped.Amount -= MaxFruit - _Fruit;
                        Fruit           = MaxFruit;
                    }
                }
                else if (!(dropped is Yeast))
                {
                    from.SendLocalizedMessage(1157246); // You may only put fruit and yeast in the fermentation barrel.
                }
            }

            return(false);
        }
Пример #24
0
 public FruitMermelade(string name, double weight, double sugarWeight, double price,
                       MarmeladeTaste marmeladeTaste, FruitType fruitType) : base(name, weight, sugarWeight, price, marmeladeTaste)
 {
     Name           = name;
     Weight         = weight;
     SugarWeight    = sugarWeight;
     Price          = price;
     MarmeladeTaste = marmeladeTaste;
     FruitType      = fruitType;
 }
Пример #25
0
        private void AddFruit(int slotNumber, Rectangle area, FruitType fruitType, int energy)
        {
            var gameState = GlobalServices.GameState;

            if (!this._population.TryGetValue(fruitType, out var population))
            {
                throw new InvalidOperationException("Population dictionary does not contain an entry for " + fruitType);
            }

            ref bool populated = ref population[slotNumber];
Пример #26
0
        /// <summary>
        /// Konstruktor kopiujący
        /// </summary>
        /// <param name="fruit">Obiekt wzorcowy.</param>
        public Fruit(Fruit fruit)
        {
            _fruitType    = fruit._fruitType;
            _fruitGraphic = fruit._fruitGraphic.Clone();
            _rectangle    = fruit._rectangle;
            _playerUse    = fruit.PlayerUse;
            _enemyUse     = fruit.EnemyUse;

            _isUsed = false;
        }
Пример #27
0
    public void InstantiateFruit(FruitType fruitType)
    {
        Fruit selectedFruit = GetFruitByType(fruitType);

        if (selectedFruit != null)
        {
            _fruitInstantiated = Instantiate(selectedFruit.gameObject,
                                             referenceNode.GetPosition2D(),
                                             Quaternion.identity);
        }
    }
Пример #28
0
 public Fruit(Texture2D spriteSheet,
              FruitType type)
     : base(spriteSheet)
 {
     _type  = type;
     _score = 500 + 100 * (int)_type;
     _tickToUpdatePerSecond = 2;
     SetFrameSize(_type);
     ImgDestination = new Rectangle(new Point(20, 20), _frameSize.ToPoint());
     Initialize();
 }
Пример #29
0
        public Fruit(Coordinate fruitCoordinate)
        {
            this.fruitCoordinate            = fruitCoordinate;
            fruitCoordinate.ShownColor      = GameUtility.GetRandomColor();
            fruitCoordinate.isFruitOccupied = true;

            this.fruitType = (FruitType)fruitCoordinate.ShownColor;

            SetPrepareFlashingTimer();
            SetDisappearTimer();
        }
Пример #30
0
 public Fruit(Texture2D spriteSheet,
              FruitType type)
     : base(spriteSheet)
 {
     _fuitCategory          = type;
     _tickToUpdatePerSecond = 2;
     SetFrameSize(_fuitCategory);
     ImgDestination = new Rectangle(new Point(500, 500), _frameSize.ToPoint());
     _itemCategory  = ItemType.Fruit;
     Initialize();
 }
Пример #31
0
 public void HpUp(FruitType type)
 {
     if (_currentHP >= _maxHP)
     {
         _currentHP = _maxHP;
     }
     if (_currentHP < _maxHP)
     {
         _currentHP += (float)type;
     }
 }
Пример #32
0
        public GameObject CreateFruit(FruitType type)
        {
            var fruitIntance = Instantiate(fruitPrefab);

            fruitIntance.gameObject.GetComponent <Fruit>().Type = type;
            var sprite = LoadSprite(type);

            fruitIntance.gameObject.GetComponent <SpriteRenderer>().sprite = sprite;

            return(fruitIntance);
        }
Пример #33
0
        public string GetFruit(FruitType fruitType)
        {
            Type   type     = this.GetType();
            string resource = "xaml." + fruitType.ToString() + ".xaml";

            using (Stream stream = type.Assembly.GetManifestResourceStream(type, resource))
                using (StreamReader reader = new StreamReader(stream))
                {
                    return(reader.ReadToEnd());
                }
        }
Пример #34
0
		private string GetName( FruitType type )
		{
			string name = "";

			switch( type )
			{
				case FruitType.Apples: name = "a tub of apples"; break;
				case FruitType.Bananas: name = "a tub of bananas"; break;
				case FruitType.Bread: name = "a tub of bread loaves"; break;
				case FruitType.Gourds: name = "a tub of gourds"; break;
				case FruitType.Grapes: name = "a tub of grapes"; break;
				case FruitType.Lemons: name = "a tub of lemons"; break;
				case FruitType.Tomatoes: name = "a tub of tomatoes"; break;
				case FruitType.Vegetables1: name = "a tub of vegetables"; break;
				case FruitType.Vegetables2: name = "a tub of vegetables"; break;
				case FruitType.Vegetables3: name = "a tub of vegetables"; break;
			}

			return name;
		} 
Пример #35
0
		private void InitContents( FruitType type )
		{
			Food item = null;
			byte count = (byte)Utility.RandomMinMax( 10, 30 );

			for( byte i = 0; i < count; i++ )
			{
				switch( type )
				{
					default:
					case FruitType.Apples: item = new Apple(); break;
					case FruitType.Bananas: item = new Banana(); break;
					case FruitType.Bread: item = new BreadLoaf(); break;
					case FruitType.Gourds: item = new Gourd(); break;
					case FruitType.Grapes: item = new Grapes(); break;
					case FruitType.Lemons: item = new Lemon(); break;
					case FruitType.Tomatoes: item = new Tomato(); break;
					case FruitType.Vegetables1:
					case FruitType.Vegetables2:
					case FruitType.Vegetables3:
						{
							switch( Utility.Random( 4 ) )
							{
								case 0: item = new Carrot(); break;
								case 1: item = new Onion(); break;
								case 2: item = new Pumpkin(); break;
								case 3: item = new Gourd(); break;
							}
							break;
						}
				}

				if( item != null )
					DropItem( item );
			}
		} 
Пример #36
0
		private void SetType( FruitType type )
		{
			int itemId = 0;

			switch( type )
			{
				case FruitType.Apples: itemId = 0x2D7A; break;
				case FruitType.Bananas: itemId = 0x2D7B; break;
				case FruitType.Bread: itemId = 0x2D76; break;
				case FruitType.Gourds: itemId = 0x2D7E; break;
				case FruitType.Grapes: itemId = 0x2D7D; break;
				case FruitType.Lemons: itemId = 0x2D7C; break;
				case FruitType.Tomatoes: itemId = 0x2D75; break;
				case FruitType.Vegetables1: itemId = 0x2D77; break;
				case FruitType.Vegetables2: itemId = 0x2D78; break;
				case FruitType.Vegetables3: itemId = 0x2D79; break;
			}

			ItemID = itemId;
			_type = type;
		} 
Пример #37
0
 public Fruit(FruitType type, FruitColor color, int weight)
 {
     Type = type;
     Color = color;
     Weight = weight;
 }
Пример #38
0
 public FruitDefinition(FruitType fruitType, int quantity)
 {
     this.FruitType = fruitType;
     this.FruitQuantity = quantity;
 }
Пример #39
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();

			Type = (FruitType)reader.ReadByte();
		}
Пример #40
0
    public void CreatePlayer(int playerID, FruitType type)
    {
        switch (playerID)
        {
        case 0:
            InitKeys(KeyCode.W, KeyCode.S, KeyCode.A, KeyCode.D,KeyCode.LeftControl);
            break;
        case 1:
            InitKeys(KeyCode.UpArrow, KeyCode.DownArrow, KeyCode.LeftArrow, KeyCode.RightArrow, KeyCode.RightControl);
            break;
        case 2:
            InitKeys(KeyCode.I, KeyCode.K, KeyCode.J, KeyCode.L, KeyCode.Space);
            break;
        case 3:
            InitKeys(KeyCode.Keypad8, KeyCode.Keypad5, KeyCode.Keypad4, KeyCode.Keypad6, KeyCode.KeypadEnter);
            break;
        }
        mPlayerID = playerID;

        if (mBody != null)
        {
            Destroy(mBody);
        }

        mBodyParts = new GameObject[4];
        mBodyParts2 = new GameObject[4];
        mBodyPartsBast = new GameObject[3];
        mBodyParts2Bast = new GameObject[3];
        Transform trans;
        mType = (FruitType)(playerID % (int)FruitType.FruitCount);
        switch (mType)
        {
        case FruitType.Carrot:
            trans = mCarrotBodyPartsPrefab.transform;
            mBody = Instantiate(mCarrotBodyPrefab);
            mBodyParts[0] = mBody.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/group5/carrot_upper_left1").gameObject;
            mBodyParts[1] = mBody.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/group5/carrot_upper_right1").gameObject;
            mBodyParts[2] = mBody.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/group5/carrot_lower_right1_1").gameObject;
            mBodyParts[3] = mBody.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/group5/carrot_lower_left1").gameObject;
            mBodyParts2[0] = trans.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/group5/carrot_upper_left1").gameObject;
            mBodyParts2[1] = trans.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/group5/carrot_upper_right1").gameObject;
            mBodyParts2[2] = trans.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/group5/carrot_lower_right1_1").gameObject;
            mBodyParts2[3] = trans.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/group5/carrot_lower_left1").gameObject;
            mBodyPartsBast[0] = mBody.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/polySurface37/carrot_blast_left1").gameObject;
            mBodyPartsBast[1] = mBody.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/polySurface37/carrot_blast_middle1").gameObject;
            mBodyPartsBast[2] = mBody.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/polySurface37/carrot_blast_right1").gameObject;
            mBodyParts2Bast[0] = trans.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/polySurface37/carrot_blast_left1").gameObject;
            mBodyParts2Bast[1] = trans.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/polySurface37/carrot_blast_middle1").gameObject;
            mBodyParts2Bast[2] = trans.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/polySurface37/carrot_blast_right1").gameObject;
            break;
        case FruitType.Onion:
            trans = mOinionBodyPartsPrefab.transform;
            mBody = Instantiate(mOinionBodyPrefab);
            mBodyParts[0] = mBody.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/onionbody/onion_body_part1").gameObject;
            mBodyParts[1] = mBody.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/onionbody/onion_body_part2").gameObject;
            mBodyParts[2] = mBody.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/onionbody/onion_body_part4").gameObject;
            mBodyParts[3] = mBody.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/onionbody/onion_body_part3").gameObject;
            mBodyParts2[0] = trans.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/onionbody/onion_body_part1").gameObject;
            mBodyParts2[1] = trans.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/onionbody/onion_body_part2").gameObject;
            mBodyParts2[2] = trans.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/onionbody/onion_body_part4").gameObject;
            mBodyParts2[3] = trans.transform.Find("full_body_ctrl/root_joint/hip_joint/Body_joint/onionbody/onion_body_part3").gameObject;
            break;
        }

        MeshRenderer[] renders = mBody.GetComponentsInChildren<MeshRenderer> ();
        Material refMat;
        Material otherMat;

        if (mType == FruitType.Carrot)
        {
            refMat = carrotMaterial;
            otherMat = carrotOtherMaterial;
        }
        else
        {
            refMat = onionMaterial;
            otherMat = onionOtherMaterial;
        }

        if ((playerID == 2) || (playerID == 3))
        {
            for (int i = 0; i < renders.Length; i++)
            {
                if (renders [i].sharedMaterial == refMat)
                {
                    renders [i].material = otherMat;
                }
            }
        }

        mAni = mBody.GetComponent<Animator> ();
        //mAni.CrossFade("Idel", 0.5f, 0, Random.value);
        mBody.transform.parent = transform;
        mBody.transform.localPosition = Vector3.zero;
        mBody.transform.localRotation = Quaternion.Euler (0,-90, 0);
        mBody.transform.localRotation = Quaternion.Euler(0, 180, 0);
    }
Пример #41
0
 public Fruit(FruitType fruitType)
 {
     this.fruitType = fruitType;
     this.mana += (int)fruitType;
 }
 public GameLevel(int LevelNumber, FruitType Fruit, int CharacterSpeed, int InvincibilityLength)
 {
     _fruit = Fruit;
     _characterSpeed = CharacterSpeed;
     _invincibilityLength = InvincibilityLength;
 }