public void DropCard(MoodCard card) { manager.PlayCard(card.mood); //GameObject.Destroy(card.gameObject); card.transform.position = transform.position; card.transform.Translate(Vector3.up); cardOnBox = card; CanDrop = false; }
public Card GetCard() { Card c = new Card() { name = this.name, }; if (cardType == eCardType.mood) { c = new MoodCard() { name = this.name, moodChanges = new List <MoodValue>() }; var cm = c as MoodCard; for (int i = 0; i < moodChanges.Length / 2; i++) { int amount = int.Parse(moodChanges[i * 2 + 1]); if (amount > 0) { cm.moodChanges.Add(new MoodValue() { mood = (Note.Mood)System.Enum.Parse(typeof(Note.Mood), moodChanges[i * 2], true), value = amount, }); } } return(cm); } if (cardType == eCardType.combo) { var cm = new ComboCard() { name = this.name, }; cm.multiplier = comboMultiplier; cm.mood = (Note.Mood)System.Enum.Parse(typeof(Note.Mood), comboMood, true); return(cm); } if (cardType == eCardType.draw) { var cm = new DrawCard() { name = this.name, }; cm.cardsToDraw = cardsToDraw; return(cm); } return(c); }
private void ScoreMood(Note note, MoodCard card) { int numberOfMissedSlots = 0; int angerAmount = 0; foreach (var noteMood in note.moodScores) { bool hasMatchedWithCard = false; foreach (var cardSlot in card.moodChanges) { // if player's card has the required mood if (cardSlot.mood == noteMood.Key) { var gameScore = moodValues.Find(r => r.mood == cardSlot.mood); if (gameScore != null) { int delta = cardSlot.value - noteMood.Value; int actualChange = 0; // max we add is the value from the note (don't go over that) if (delta > 0) { actualChange = note.moodScores[cardSlot.mood]; } else // otherwise take the value from the card only { actualChange = cardSlot.value; } gameScore.value += actualChange; if (delta < 0) // if less than required, add to Anger { angerAmount += -delta; } uiScoring.SetScore(gameScore.mood, gameScore.value); if (actualChange > 0) { menu_Game.AnimateScore(gameScore.mood, actualChange); } hasMatchedWithCard = true; } comboStartNote = note; } else { // if card has a mood not in the note, don't do anything with it } } if (!hasMatchedWithCard) { // if you played a card that doesn't have required mood from the Note, convert the note to Anger numberOfMissedSlots++; angerAmount += noteMood.Value; } } if (angerAmount > 0) { int newAngerAmount = currentAngerAmount + angerAmount; uiScoring.SetAnger(newAngerAmount); menu_Game.AnimateAnger(angerAmount); currentAngerAmount = newAngerAmount; } else if (numberOfMissedSlots == 0) { // card used up all the mood slots, excellent, now reduce Anger currentAngerAmount -= level.angerReduction; if (currentAngerAmount < 0) { currentAngerAmount = 0; } } if (currentAngerAmount >= level.angerLimit) { EndLevelBecauseAnger(); } }