コード例 #1
0
        private CCSprite CreateFruitGraphic(FruitColor color)
        {
            CCSprite graphic;

            if (color == FruitColor.Yellow)
            {
                graphic = new CCSprite(CCTextureCache.SharedTextureCache.AddImage("lemon.png"))
                {
                    IsAntialiased = false
                };

                _scoreLabel.Color     = CCColor3B.Black;
                _scoreLabel.PositionY = 0;
            }
            else
            {
                graphic = new CCSprite(CCTextureCache.SharedTextureCache.AddImage("cherry.png"))
                {
                    IsAntialiased = false
                };

                _scoreLabel.Color     = CCColor3B.White;
                _scoreLabel.PositionY = -8;
            }

            FruitColor = color;

            return(graphic);
        }
コード例 #2
0
ファイル: TreeController.cs プロジェクト: StephanSchue/NFC
    /// <summary>
    /// Compare the given color to the fruit types that defined on the tree.
    /// </summary>
    /// <returns><c>true</c> if the color is possible; otherwise, <c>false</c>.</returns>
    /// <param name="diceColor">Dice color.</param>
    public bool IsColorPossible(FruitColor fruitColor)
    {
        FruitColor colorOfTheFruit = FruitColor.None;

        if (possibleFruits != null && possibleFruits.Length > 0)
        {
            string[] fruitTypes = FruitToColor.Instance.GetFruitsForColor(fruitColor);

            // -- If user set manually possible fruits --
            for (int i = 0; i < fruitTypes.Length; i++)
            {
                for (int y = 0; i < possibleFruits.Length; y++)
                {
                    if (fruitTypes[i] == possibleFruits[i])
                    {
                        return(true);
                    }
                }
            }
        }
        else
        {
            // -- If any fruit is possible --
            return(true);
        }

        return(false);
    }
コード例 #3
0
ファイル: TreeController.cs プロジェクト: StephanSchue/NFC
    /// <summary>
    /// Get a fruit type by diceColor.
    /// </summary>
    /// <returns>The fruit type by color.</returns>
    /// <param name="diceColor">Dice color.</param>
    public string GetFruitTypeByColor(FruitColor fruitColor)
    {
        if (possibleFruits != null && possibleFruits.Length > 0)
        {
            string[] shuffledPossibleFruits = Shuffle <string>(possibleFruits);
            string[] fruitTypes             = FruitToColor.Instance.GetFruitsForColor(fruitColor);

            // -- If user set manually possible fruits --
            for (int i = 0; i < fruitTypes.Length; i++)
            {
                for (int y = 0; i < possibleFruits.Length; y++)
                {
                    if (fruitTypes[i] == possibleFruits[i])
                    {
                        return(fruitTypes[i]);
                    }
                }
            }
        }
        else
        {
            // -- If any fruit is possible --
            return(GetRandomFruitType(fruitColor));
        }

        return(null);
    }
コード例 #4
0
 public void DiceRoleComplete(DiceFieldType diceNumber, FruitColor color)
 {
     if (!voiceOverOfColorDone)
     {
         VoiceOverOfColor(color);
     }
 }
コード例 #5
0
 public void OnAddToBasket(FruitColor color)
 {
     if (!playerCheeringDone && currentFruitsToPickCount >= fruitsToPickCount)
     {
         CheeringPlayer();
         playerCheeringDone = true;
     }
 }
コード例 #6
0
ファイル: TreeController.cs プロジェクト: StephanSchue/NFC
    /// <summary>
    /// Gets the random entry of the fruit enum.
    /// </summary>
    private string GetRandomFruitType()
    {
        // Random Color
        Array values = Enum.GetValues(typeof(FruitColor));

        System.Random random           = new System.Random();
        FruitColor    randomFruitColor = (FruitColor)values.GetValue(random.Next(values.Length));

        return(GetRandomFruitType(randomFruitColor));
    }
コード例 #7
0
    public FruitColor GetFruitColorToDiceNumber(DiceFieldType diceNumber)
    {
        FruitColor color = FruitColor.None;

        if ((int)diceNumber > 0)
        {
            color = imageColorList[GetSpecificFruitIndex(diceNumber)];
        }

        return(color);
    }
コード例 #8
0
    /// <summary>
    /// Gets the specific fruit count.
    /// </summary>
    /// <returns>The specific fruit count.</returns>
    /// <param name="id">Identifier.</param>
    public int GetSpecificFruitCount(FruitColor id)
    {
        int count = 0;

        if (GetSpecificFruitIndex(id) > -1)
        {
            count = specificFruitCount[GetSpecificFruitIndex(id)];
        }

        return(count);
    }
コード例 #9
0
ファイル: TreeController.cs プロジェクト: StephanSchue/NFC
    /// <summary>
    /// Creates the tree fruits by diceColor.
    /// </summary>
    /// <param name="diceColor">Dice color.</param>
    public void CreateTreeFruits(FruitColor color)
    {
        GetFruitPlaceholders();

        if (FruitPlaceholders.Count <= 0)
        {
            return;
        }

        SetupTreeFruits(GetFruitTypeByColor(color));
    }
コード例 #10
0
    public int GetTreeIndexOfColor(FruitColor color)
    {
        for (int i = 0; i < imageColorList.Length; i++)
        {
            if (color == imageColorList[i])
            {
                return(i);
            }
        }

        return(-1);
    }
コード例 #11
0
        public static CCColor4B ToCCColor(this FruitColor color)
        {
            switch (color)
            {
            case FruitColor.Yellow:
                return(new CCColor4B(150, 150, 0, 150));

            case FruitColor.Red:
                return(new CCColor4B(150, 0, 0, 150));
            }
            throw new ArgumentException("Unknown color " + color);
        }
コード例 #12
0
ファイル: FruitToColor.cs プロジェクト: StephanSchue/NFC
    /// <summary>
    /// Gets the color of the fruits for.
    /// </summary>
    /// <returns>The fruits for color.</returns>
    /// <param name="fruitColor">Fruit color.</param>
    public string[] GetFruitsForColor(FruitColor fruitColor)
    {
        List <string> fruits = new List <string>();

        for (int i = 0; i < fruitEntries.Count; i++)
        {
            if (fruitColor == fruitEntries[i].FruitColor)
            {
                fruits.Add(fruitEntries[i].FruitType);
            }
        }

        return(fruits.ToArray());
    }
コード例 #13
0
ファイル: TreeController.cs プロジェクト: StephanSchue/NFC
    /// <summary>
    /// Gets the random entry of the fruit enum.
    /// </summary>
    private string GetRandomFruitType(FruitColor fruitColor)
    {
        string[] fruittypes = FruitToColor.Instance.GetFruitsForColor(fruitColor);

        if (fruittypes == null || fruittypes.Length <= 0)
        {
            Debug.Log("No Fruittype found!");
            return(null);
        }
        else
        {
            return(fruittypes [UnityEngine.Random.Range(0, fruittypes.Length)]);
        }
    }
コード例 #14
0
    public void RemoveFruitFromTheBasket(FruitColor id)
    {
        // -- Count down the fruit amount --
        fruitCount += 1;
        int fruitCountIterator = GetSpecificFruitIndex(id);

        // --- Decrease added fruit ---
        if (fruitCountIterator > -1)
        {
            specificFruitCount[fruitCountIterator]++;
        }

        print(id.ToString() + " in the basket");
        print("Fruits remaining: " + fruitCount);
    }
コード例 #15
0
        public Fruit(FruitColor fruitCollor, FruitsPool pool)
        {
            _pool       = pool;
            Score       = 1;
            _scoreLabel = CreateScoreLabel();

            CreateCollision();

            Acceleration.Y = GameCoefficients.FruitGravity;

            AddChild(CreateFruitGraphic(fruitCollor));
            AddChild(_scoreLabel);

            CreateDebugGraphic();
        }
コード例 #16
0
    public void VoiceOverOfColor(FruitColor id)
    {
        showPointerAtColorWheelTutorial = false;

        if (id > 0)
        {
            UnityAction callback = null;

            if (currentFruitsToPickCount >= fruitsToPickCount - 1)
            {
                voiceOverOfColorDone = true;
            }

            AudioManager.Instance.SetVoiceOver(voiceOversColor[currentFruitsToPickCount], callback);
            ++currentFruitsToPickCount;
        }
    }
コード例 #17
0
    public DiceFieldType GetDiceNumberForFruitColor(FruitColor fruitColor)
    {
        DiceFieldType diceNumber = DiceFieldType.None;

        if ((int)fruitColor > 0)
        {
            for (int i = 0; i < imageColorList.Length; i++)
            {
                if (fruitColor == imageColorList[i])
                {
                    diceNumber = (DiceFieldType)(i + 1);
                }
            }
        }

        return(diceNumber);
    }
コード例 #18
0
ファイル: Fruit.cs プロジェクト: matry-ny/brain
 protected Fruit(FruitColor color)
 {
     Color = color;
 }
コード例 #19
0
 public FruitBin(FruitColor color)
 {
     _fruitColor = color;
     CreateDebugGraphics();
 }
コード例 #20
0
ファイル: Fruit.cs プロジェクト: CoronaFiredancer/praktikant
 public Fruit(FruitType type, FruitColor color, int weight)
 {
     Type = type;
     Color = color;
     Weight = weight;
 }
コード例 #21
0
    // The things below are just for the debug, to give text feedback to the user
    // TODO: replace with actual logic and animations
    public void AddedFruitToTheBasket(FruitColor id)
    {
        // -- Count down the fruit amount --
        fruitCount -= 1;
        int fruitCountIterator = GetSpecificFruitIndex(id);

        // --- Decrease added fruit ---
        if (fruitCountIterator > -1)
        {
            specificFruitCount[fruitCountIterator]--;

            if (specificFruitCount[fruitCountIterator] == 0)
            {
                if (fruitCount > 0)
                {
                    DiceController.StartBlinking(0.0f);
                }
            }
        }

        if (OnFruitIsAddedToTheBasket != null)
        {
            OnFruitIsAddedToTheBasket(id);
            InputManager.UnblockInput();
        }

        print(id.ToString() + " in the basket");
        print("Fruits remaining: " + fruitCount);

        // -- Finish the Game --
        if (fruitCount == 0)
        {
            // --- Debug Stuff ---
            DisablePointerAtColorWheelHint();
            DisablePointerFingerSwipeAnimation();

            // Disable Dice
            DiceController.HideColorWheel();
            DiceController.Enable(false);
            DiceController.AllowToRoll(false);
            uiController.EnableDiceButton(false); // Debug

            InputManager.BlockInput();
            InputManager.BlockDiceRole();

            // Win Game
            Raven.transform.rotation = Quaternion.AngleAxis(180, Vector3.up);
            Raven.RavenLoss(WinTheGame);
            uiController.backButton.gameObject.SetActive(false);
        }
        else
        {
            // --- Normal GAME ---

            // Allow Only One fruit
            colourID = FruitColor.None;
            DiceController.StartBlinking(0.0f);
            DiceController.AllowToRoll(true);
            DiceController.Enable(true);
            uiController.diceButton.enabled = true;
            InputManager.UnblockDiceRole();
            InputManager.blockGrabing = true;
            DiceController.UnHightLightSelected();

            if (!tutorial)
            {
                //showPointerAtColorWheelTutorial = true;
                //StartCoroutine(DoFunctionWithDelay(ShowPointerAtColorWheel, 5.0f));
            }
        }
    }
コード例 #22
0
ファイル: Fruit.cs プロジェクト: CoronaFiredancer/praktikant
 public Fruit(FruitType type, FruitColor color, int weight)
 {
     Type   = type;
     Color  = color;
     Weight = weight;
 }
コード例 #23
0
 public int GetSpecificFruitIndex(FruitColor value)
 {
     return((int)(value - 1));
 }
コード例 #24
0
ファイル: FruitToColor.cs プロジェクト: StephanSchue/NFC
 public FruitEntry(string fruitType, FruitColor fruitColor)
 {
     FruitType  = fruitType;
     FruitColor = fruitColor;
 }
コード例 #25
0
    /// <summary>
    /// Function after dice role to set the result
    /// </summary>
    /// <param name="id">Identifier.</param>
    public void SetDiceResult(DiceFieldType id)
    {
        colourID = GetFruitColorToDiceNumber(id);
        DiceController.HightLightSelected(id);
        ActivateFruitHint();

        if (OnDiceRoleComplete != null)
        {
            OnDiceRoleComplete(id, GetFruitColorToDiceNumber(id));
        }

        if (id == DiceFieldType.Raven)
        {
            // Shuffle Dice Minigsame
            DiceController.AllowToRoll(false);
            DiceController.Enable(false);
            uiController.diceButton.enabled = false;

            //Handheld.Vibrate();

            int  index          = ravenPositionsCount - ravenPosition;   //CalculateRavenMiniGameLiklyhood();
            bool miniGame       = false;
            bool miniGameBubble = false;

            for (int i = 0; i < positionOfTheMinigame.Length; i++)
            {
                if (positionOfTheMinigame[i] == index)
                {
                    miniGame = true;
                }
            }

            if (!tutorial && UnityEngine.Random.Range(0, 100) <= bubblePossibility)
            {
                for (int i = 0; i < positionOfTheBubble.Length; i++)
                {
                    if (positionOfTheBubble[i] == index)
                    {
                        miniGameBubble = true;
                    }
                }
            }

            if ((miniGame || miniGameBubble) && ravenMinigames != null && ravenMinigames.Length > 0) //index >= 0 && index < ravenMinigames.Length && ravenMinigames[index] != null)
            {
                // Start Animation, after completing run callback on method "StartMiniGame"
                --ravenPosition;

                if (miniGameBubble)
                {
                    // Bubble Game
                    currentRavenGameIndex = 0;
                }
                else
                {
                    // Random Game
                    currentRavenGameIndex = tutorial ? 0 : UnityEngine.Random.Range(0, ravenMinigames.Length);
                }

                RavenHide(StartMiniGame);
            }
            else
            {
                if (ravenPosition > 0)
                {
                    Debug.Log("No Minigame implementent for Position " + (index));
                    currentRavenGameIndex = -1;
                    MoveRaven();
                    --ravenPosition;
                }
                else
                {
                    RavenWinGame();
                }
            }
        }
        else
        {
            DiceController.AllowToRoll(false);
            InputManager.UnblockInput();
            InputManager.BlockDiceRole();
            InputManager.blockGrabing       = false;
            uiController.diceButton.enabled = false;
        }
    }
コード例 #26
0
ファイル: FruitToColor.cs プロジェクト: StephanSchue/NFC
 /// <summary>
 /// Adds the node.
 /// </summary>
 /// <param name="fruitType">Fruit type.</param>
 /// <param name="fruitColor">Fruit color.</param>
 public void AddNode(string fruitType, FruitColor fruitColor)
 {
     fruitEntries.Add(new FruitEntry(fruitType, fruitColor));
 }
コード例 #27
0
ファイル: FruitColor.cs プロジェクト: matry-ny/brain
 public bool Equals(FruitColor other)
 {
     return string.Equals(ColorString, other.ColorString);
 }
コード例 #28
0
 public FruitDescription(FruitSize size, FruitColor color)
 {
     _size  = size;
     _color = color;
 }