public void TriggerEffect(AGPEvent e)
 {
     for (int i = 0; i < stack; i++)
     {
         Services.actionManager.DrawCard();
     }
 }
 public void TriggerEffect(AGPEvent e)
 {
     PlayerStatsManager.LoseHpEvent a = (PlayerStatsManager.LoseHpEvent)e;
     thisEnemy.GainHp(a.value);
     thisEnemy.SummonFollower(Services.cardList.AngryKlippy);
     base.TriggerEffect();
 }
Exemple #3
0
    public void OnPlayersHit(AGPEvent e)
    {
        var ev = (PlayersHit)e;

        if (lastIssue[0] == null)//first time
        {
            lastIssue[0] = ev.player1;
            lastIssue[1] = ev.player2;
        }
        else
        {
            if ((lastIssue[0] == ev.player1 || lastIssue[1] == ev.player1) || (lastIssue[0] == ev.player2 || lastIssue[1] == ev.player2))
            {
                //this is the saemas  last time, don't do it again
                if (Time.time < lastHit + 1.0f)
                {
                    return;
                }
            }
            else
            {
                lastIssue[0] = ev.player1;
                lastIssue[1] = ev.player2;
            }
        }
        lastHit = Time.time;
        Services.GameController.whistle.Play();
    }
    public void TriggerEffect(AGPEvent e)
    {
        EnemyMoveset.EnemyDealDamage a = (EnemyMoveset.EnemyDealDamage)e;

        base.TriggerEffect();
        Services.statsManager.TakeDamage(stack);
    }
Exemple #5
0
    void OnGoalScored(AGPEvent e)
    {
        var goal = (GoalScored)e;

        scores[goal.whichTeam]++;
        gameStateMachine.TransitionTo <ResetGame>();
    }
Exemple #6
0
    void OnDay2(AGPEvent e)
    {
        Debug.Log("day2");

        Services.GameController.makeNarrativeEvents = true;
        //ActivateTutorial(tutorials[2], 15);
    }
Exemple #7
0
    void onPlantDestroyed(AGPEvent e)
    {
        var      plantEvent = (PlantDestroyed)e;
        OldPlant plant      = plantEvent.plant;

        FMODUnity.RuntimeManager.PlayOneShot(ondestroyEvent, plant.position);
    }
Exemple #8
0
 private void OnGoalScored(AGPEvent e)
 {
     foreach (var player in _players)
     {
         player.SetToStartingPosition();
     }
 }
Exemple #9
0
    void OnPlantCreated(AGPEvent e)
    {
        var      plantEvent = (PlantCreated)e;
        OldPlant plant      = plantEvent.plant;

        //Play creation sound
        FMODUnity.RuntimeManager.PlayOneShot(oncreateEvent, plant.position);
    }
        private void GameTimedOut(AGPEvent e)
        {
            var timedOut = (TimedOut)e;

            Context.gameOver.SetWinnerMessage(timedOut.blueScore > timedOut.redScore ? "Blue won!" : "Red won!");

            TransitionTo <GameOver>();
        }
Exemple #11
0
 public void NewCombat(AGPEvent e)
 {
     if (generated)
     {
         Services.eventManager.Unregister <RunStateManager.CombatStart>(NewCombat);
         Destroy(gameObject);
     }
 }
 public void TriggerEffect(AGPEvent e)
 {
     PlayerActionManager.PlayerPlayCardEvent a = (PlayerActionManager.PlayerPlayCardEvent)e;
     if (a.thisCard.generated)
     {
         Services.actionManager.DrawMutipleCard(stack);
     }
 }
 public void TriggerEffect(AGPEvent e)
 {
     CardFunction.CardTriggerEvent a = (CardFunction.CardTriggerEvent)e;
     if ((a.thisCard.GetAttackCost() <= 5 && a.thisCard.GetDrawCost() == 0) || (a.thisCard.GetAttackCost() == 0 && a.thisCard.GetDrawCost() <= 5))
     {
         a.thisCard.JustTriggerEffect();
     }
 }
Exemple #14
0
 void OnFirstSleep(AGPEvent e)
 {
     Debug.Log("firstsleep");
     DeactivateTutorial();
     ActivateTutorial(tutorials[3], 15);
     ActivateCounter("Grass grown: ", grassGrown, Services.GameController.unlockLevels[0]);
     check = GrownCheck.grassUnlock;
 }
 public void TriggerEffect(AGPEvent e)
 {
     //Debug.Log("EnemyDie");
     thisEnemy.GainNewBuff(new MoreDamage(), 2);
     Services.visualEffectManager.EnemyGainBuffEffect(thisEnemy.gameObject);
     //become stronger
     base.TriggerEffect();
 }
Exemple #16
0
    void OnPlantFed(AGPEvent e)
    {
        var      plantEvent = (PlantJustFed)e;
        OldPlant plant      = plantEvent.plant;

        FMODUnity.RuntimeManager.PlayOneShot(ondestroyEvent, plant.position);
        UnityEngine.Debug.Log("REEEEEE");
        UnityEngine.Debug.Log("REEEEEE");
    }
Exemple #17
0
    void OnPlantGrownUp(AGPEvent e)
    {
        //Need To check if all FMOD get components work with decentralized eventsystem.
        //GetComponent<FMODUnity.StudioEvent.Emitter>().Play();
        var      plantEvent = (PlantGrown)e;
        OldPlant plant      = plantEvent.plant;

        FMODUnity.RuntimeManager.PlayOneShot(oncreateEvent, plant.position);
    }
    private void ResetPlayers(AGPEvent e)
    {
        foreach (var player in _players)
        {
            player.SetPosition();
        }

        _referee.SetPosition();
    }
    public void Fire(AGPEvent e)
    {
        var type = e.GetType();

        if (_registeredHandlers.TryGetValue(type, out var handlers))
        {
            handlers(e);
        }
    }
Exemple #20
0
 private void UpdateBasicActionCost(AGPEvent e)
 {
     currentAttackCost -= 5;
     currentRedrawCost -= 5;
     currentRedrawCost  = Mathf.Max(currentRedrawCost, 0);
     currentAttackCost  = Mathf.Max(currentAttackCost, 0);
     //update visual
     UpdateBasicActionCostDisplay();
 }
Exemple #21
0
    void OnPlantGrown(AGPEvent e)
    {
        var      plantEvent = (PlantGrown)e;
        OldPlant plant      = plantEvent.plant;

        if (plant.type == OldPlantType.Spread)
        {
            grassGrown++;
            if (check == GrownCheck.grassUnlock)
            {
                ActivateCounter("Grass grown: ", grassGrown, Services.GameController.unlockLevels[0]); //these update the counter

                if (grassGrown >= Services.GameController.unlockLevels[0])
                {
                    Debug.Log("FLOWER MSG");

                    DeactivateTutorial();
                    ActivateTutorial(tutorials[6], 20); //HEY YOU UNLOCKED FLOWERS
                    check             = GrownCheck.flowerUnlock;
                    hasGivenUnlockTut = 0;
                }
            }
        }
        if (plant.type == OldPlantType.Grass)
        {
            flowersGrown++;
            if (check == GrownCheck.flowerUnlock)
            {
                ActivateCounter("Flowers grown: ", flowersGrown, Services.GameController.unlockLevels[1]);
                if (flowersGrown >= Services.GameController.unlockLevels[1])
                {
                    DeactivateCounter();
                    DeactivateTutorial();
                    ActivateTutorial(tutorials[7], 15);
                    check             = GrownCheck.bushUnlock;
                    hasGivenUnlockTut = 0;
                }
            }
        }
        if (plant.type == OldPlantType.Shrub)
        {
            bushesGrown++;
            if (check == GrownCheck.bushUnlock)
            {
                ActivateCounter("Bushes grown: ", bushesGrown, Services.GameController.unlockLevels[2]);
                if (bushesGrown >= Services.GameController.unlockLevels[2])
                {
                    DeactivateCounter();
                    DeactivateTutorial();
                    ActivateTutorial(tutorials[8], 15);
                    check             = GrownCheck.gotTree;
                    hasGivenUnlockTut = 0;
                }
            }
        }
    }
    private void InitializeGameScreen(AGPEvent e)
    {
        ServicesLocator.EventManager.Unregister <ExitTitleScreen>(InitializeGameScreen);

        ServicesLocator.AIManager.Initialize();

        titleScreen.SetActive(false);
        gameScreen.SetActive(true);

        gameScreenObjectsReady = true;
    }
 public void TriggerEffect(AGPEvent e)
 {
     Debug.Log("EnemyDie");
     Enemy.DieEvent a = (Enemy.DieEvent)e;
     if (a.deadEnemy.gameObject == thisEnemy.gameObject)
     {
         base.TriggerEffect();
         thisEnemy.SummonFollower(Services.cardList.AngryKlippy);
     }
     //summon angry klippy
 }
    public void Initialize(AGPEvent e)
    {
        _players = new List <Player>();
        GeneratePlayers();
        _referee.Initialize();
        ServicesLocator.EventManager.Register <GoalScored>(ResetPlayers);

        foreach (var player in _players)
        {
            player.Initialize();
        }
    }
Exemple #25
0
 void OnFadeOutComplete(AGPEvent e)
 {
     foreach (OldPlant p in Services.PlantManager.plants)
     {
         if (p.plantFood.isValid())
         {
             p.shouldPlay = false;
             p.plantFood.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
             p.plantFood.release();
         }
     }
 }
Exemple #26
0
    public void OnGoalScored(AGPEvent e)
    {
        var goalName = ((GoalScored)e).goalName;

        if (goalName == "PlayerGoal")
        {
            redScore++;
        }
        else if (goalName == "EnemyGoal")
        {
            blueScore++;
        }
    }
Exemple #27
0
    public void IncrementTeamScore(AGPEvent e)
    {
        GoalScored goalScoreEvent = (GoalScored)e;

        if (goalScoreEvent.didRedTeamScore)
        {
            redTeamScore++;
        }
        else
        {
            blueTeamScore++;
        }
    }
Exemple #28
0
    private void IncrementTeamScore(AGPEvent e)
    {
        var goalScoredEvent = (GoalScored)e;

        if (goalScoredEvent.blueTeamScored)
        {
            blueScore++;
        }
        else
        {
            redScore++;
        }
    }
 public void TriggerEffect(AGPEvent e)
 {
     PlayerActionManager.PlayerPlayCardEvent a = (PlayerActionManager.PlayerPlayCardEvent)e;
     if (a.thisCard.GetAttackCost() > 0)
     {
         Services.resourceManager.GainAttackBar(a.thisCard.GetAttackCost());
     }
     else if (a.thisCard.GetDrawCost() > 0)
     {
         Services.resourceManager.GainDrawBar(a.thisCard.GetDrawCost());
     }
     this.LoseStack();
 }
    public void onGoalScored(AGPEvent e)
    {
        var goalScoreEvent = (GoalScored)e;

        if (goalScoreEvent.blueTeamScored)
        {
            _blueScore++;
        }
        else
        {
            _redScore++;
        }

        ball.transform.position = Vector3.zero;
    }