public ScoreNodeView()
 {
     InitializeComponent();
     nodeImage        = this.FindControl <Image>("nodeImage");
     nodeImage.Source = new Bitmap("Jeffistance.Client\\Assets\\Skullbisu.png");
     State            = ScoreState.NoResult;
 }
Esempio n. 2
0
        private async Task <DialogTurnResult> NameStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            // Find the matching game to play and set up our state
            ScoreState ss = stepContext.SetStateAs(new ScoreState(_pdata.GetGameData(stepContext.GetResultAs <FoundChoice>().ToLowerCaseTrimmedString())));

            return(await stepContext.BuildTextPrompt($"Great, let's play {ss.CurrentGame.GameName}, Please enter your name to begin.", cancellationToken));
        }
Esempio n. 3
0
        public GameMain()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory    = "Content";
            Window.AllowUserResizing = false;
            graphics.IsFullScreen    = true;
            Resolution.Init(ref graphics);
            Resolution.SetVirtualResolution(VIRTUAL_WIDTH, VIRTUAL_HEIGHT);

            Resolution.SetResolution(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width,
                                     GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height, true);

            gameStateManager = new GameStateManager(this);
            Components.Add(gameStateManager);

            TitleScreenState = new TitleScreenState(this);
            PlayState        = new PlayState(this);
            ScoreState       = new ScoreState(this);
            CountdownState   = new CountdownState(this);
            gameStateManager.ChangeState((TitleScreenState)TitleScreenState);

            Components.Add(new InputHandler(this));

            Window.ClientSizeChanged += new EventHandler <EventArgs>(Resize);
        }
Esempio n. 4
0
        /*
         ******************************************************
         *** dropObject
         *** Zachary Languell
         ******************************************************
         *** Handles when a ScoringObject is dropped.
         *** Method Inputs:
         ***     forceDrop - A boolean variable that determines if a ScoringObject needs to force dropped.
         *** Return Values:
         ***     NA
         ******************************************************
         *** 11/17/2015
         ******************************************************
         */
        public void dropObject(bool forceDrop)
        {
            // Sets the ScoringObject forceDrop variable to the boolean that was passed to the method.
            this.forceDrop = forceDrop;

            // If forceDrop is true, then score is set to 0.
            if (forceDrop)
            {
                this.score = 0;
            }

            // The variable scoreState is set to a dropped state.
            scoreState = ScoreState.Dropped;

            // If else statement is used to change the Y position of
            // the ScoringObject if the Y position is less than 600 + frameHeight
            // otherwise set isVisable to false.
            if (this.position.Y < 600 + frameHeight)
            {
                this.position.Y += 6;
            }
            else
            {
                isVisable = false;
            }
        }
Esempio n. 5
0
 void Awake()
 {
     text     = this.GetComponent <UnityEngine.UI.Text>();
     initTime = Time.time;
     state    = ScoreState.normal;
     animator = GetComponent <Animator>();
     // puts the object to the front (the last element to be drawn)
     transform.SetAsFirstSibling();
 }
Esempio n. 6
0
 void StartFading()
 {
     state = ScoreState.fading;
     if (animator != null)
     {
         animator.SetTrigger("fade");
     }
     Destroy(this.gameObject, 1.5f);
 }
Esempio n. 7
0
        public void Reset()
        {
            if (_state == ScoreState.Locked)
            {
                return;
            }

            _state = ScoreState.Unassigned;
            _value = 0;
        }
Esempio n. 8
0
        public void Preview(IEnumerable <int> dices)
        {
            if (_state == ScoreState.Locked)
            {
                return;
            }

            _value = _scorer(dices);
            _state = ScoreState.Preview;
        }
 //constructor -------------------------------------------------------------------
 public ScoreboardManager()
 {
     scoreNames         = new List <string>();
     highScores         = new List <int>();
     scoreState         = ScoreState.loading;
     prevPressed        = new bool[256];
     characterLocations = new Vector2[] { new Vector2(198, 448), new Vector2(298, 448), new Vector2(398, 448) };
     centerLeft         = new Vector2(338, 448);
     topLeftThird       = new Vector2(298, 128);
     playerName         = "--";
 }
        //methods -----------------------------------------------------------------------
        public GameState UpdateGameover() //method for updating the gameover screen
        {
            GameState toReturn = GameState.gameOver;

            currentKB = Keyboard.GetState();
            switch (scoreState)
            {
            case ScoreState.loading:
                playerName = "--";
                scoreNames.Clear();
                highScores.Clear();
                LoadScores();
                index = TestHighScore();
                if (index == 10)
                {
                    scoreState = ScoreState.viewScore;
                }
                else
                {
                    scoreState = ScoreState.getName;
                }

                break;

            case ScoreState.getName:
                if (playerName.Length != 3)
                {
                    GetName();
                }
                else
                {
                    scoreNames.Insert(index, playerName);
                    highScores.Insert(index, currentScore);
                    scoreNames.RemoveAt(10);
                    highScores.RemoveAt(10);
                    scoreState = ScoreState.saving;
                }
                break;

            case ScoreState.saving:
                SaveScores();
                scoreState = ScoreState.viewScore;
                break;

            case ScoreState.viewScore:
                if (currentKB.IsKeyDown(Keys.Enter))
                {
                    toReturn = GameState.start;
                }
                break;
            }
            previousKB = currentKB;
            return(toReturn);
        }
Esempio n. 11
0
    public void Awake()
    {
        m_par = 3;
        RenderSettings.ambientLight = ambientColor;


        //unpause the game
        GameConfig.setPaused(false);
        ScoreState ss = (ScoreState)GameObject.FindObjectOfType(typeof(ScoreState));

        if (ss)
        {
            m_scoreStateGO = ss.gameObject;
        }
        //if its levle 1 reset the scores.
        int holeIndex = getHoleNomUsingCourse();

//		Debug.Log("holeIndex"+holeIndex);
        if (holeIndex == 1)
        {
            setScoreForHole(getHoleNomUsingCourse(), currentNumberOfStrokes);
            setTotalScore(0);
//			m_totalScore=0;
            m_totalPar = 0;
        }
        else
        {
//			m_totalScore = getTotalScore();
        }
        ParScript ps = (ParScript)GameObject.FindObjectOfType(typeof(ParScript));

        if (ps)
        {
            m_par = ps.par;
            setParForHole(getHoleNomUsingCourse(), m_par);
            m_totalPar += m_par;
        }
        else
        {
            setParForHole(getHoleNomUsingCourse(), m_par);
        }


        //get a ref to the gamescript!
        GameObject go = GameObject.FindWithTag("Player");

        if (go)
        {
            m_ballScript = go.GetComponent <BallScript>();
        }

        GameManager.enterState(GameScript.State.INIT.ToString());
    }
Esempio n. 12
0
        public DTController(DTenemy e, Orb o, Tree tree, ChaseState cS, GuardState gS, ScoreState sS, Goal pG, Goal eG)
        {
            this.e       = e;
            this.tree    = tree;
            this.cS      = cS;
            this.gS      = gS;
            this.sS      = sS;
            this.o       = o;
            currentState = new State(e, o, pG, eG);

            MakeDtree();
        }
Esempio n. 13
0
        private async Task <DialogTurnResult> EndGameStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            // Find the matching game to play and set up our state
            ScoreState so = stepContext.GetResultAs <ScoreState>();

            await stepContext.Context.SendMultipleTextActivity(new[] {
                $"{so.PlayerName}, you finished the {so.CurrentGame.GameName} game!, with {so.GetCurrentScore()} points!",
                "Talk to me to restart"
            });

            return(await stepContext.EndDialogAsync(so, cancellationToken));
        }
Esempio n. 14
0
    private void Initialize()
    {
        inUseFallDelay = fallDelay;
        fallTimer      = 0F;
        softDropTimer  = 0F;
        hardDropTimer  = 0F;

        scoreState = new ScoreState(0, 0);

        UpdateScore();

        SpawnRandomShape(true);
    }
Esempio n. 15
0
    public void BaseAwake()
    {
        if (ToolBox.GetData(out sceneData))
        {
            state = Serialyzer.RegisterState <ScoreState>("ScoreState");

            targetScore = sceneData.TargetScore;

            OnAwake();

            Subscribes();
        }
    }
Esempio n. 16
0
    private void Disable()
    {
        var args = new MonoBehaviourEventArgs(this);

        _scoreState       = ScoreState.SCORING_DISABLED;
        _renderer.enabled = false;
        _timedCounter.gameObject.SetActive(false);
        zenAbsorbEffect.Stop();

        _light.enabled = false;

        Notifier.SendEventNotification(OnDeactivateEvent, args);
    }
Esempio n. 17
0
 public void SetFinalState(bool isWinner)
 {
     Winner = isWinner;
     if (isWinner)
     {
         FinalPicture = Image.FromFile("data/Final.png");
         AddScores(500);
     }
     else
     {
         FinalPicture = Image.FromFile("data/Defeat.png");
     }
     active = ScoreState.Final;
 }
Esempio n. 18
0
        public void LockIn()
        {
            if (_state == ScoreState.Unassigned)
            {
                throw new Exception("Cannot lock in score that hasn't been previewed.");
            }

            if (_state == ScoreState.Locked)
            {
                throw new Exception("State has already been locked.");
            }

            _state = ScoreState.Locked;
        }
Esempio n. 19
0
        public void ChangeState(bool isJeffistanceVictory)
        {
            var assets = AvaloniaLocator.Current.GetService <IAssetLoader>();

            if (isJeffistanceVictory)
            {
                State            = ScoreState.JeffistanceVictory;
                nodeImage.Source = AvaloniaTools.GetImageFromResources("Jeffistance.Client", "RoundStateResistenceVictory.png");
            }
            else
            {
                State            = ScoreState.SpyVictory;
                nodeImage.Source = AvaloniaTools.GetImageFromResources("Jeffistance.Client", "RoundStateSpyVictory.png");
            }
        }
Esempio n. 20
0
    void ProcessLineRemoval(int clearedLines)
    {
        if (clearedLines <= 0)
        {
            scoreState.ResetCombo();
        }
        else
        {
            scoreState += LineScoreHandler.GetScore(clearedLines, scoreState);

            scoreState.IncreaseCombo();
        }

        UpdateScore();
    }
Esempio n. 21
0
    private void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Debug.LogError("More than once instance of the GameManager Singleton. Deleting the old instance.");
            DestroyImmediate(instance);

            instance = this;
        }

        if (headTransform == null)
        {
            Debug.LogError("Missing Head Transform! Game cannot continue correctly");
        }

        // This number converts the look threshold to a dot product-comparable value
        // Save us from computing it every frame
        angleThresholdDot       = Mathf.Cos(Mathf.Deg2Rad * angleThresholdDegrees);
        scoreState              = ScoreState.CannotScore;
        levelIndex              = 0;
        introButtonIndex        = 0;
        gameState               = GameState.Intro;
        levelStartTime          = 0.0f;
        levelScoreThresholdTime = 0.0f;

        // Set up the intro buttons correctly
        foreach (GameObject gameObject in introButtons)
        {
            gameObject.SetActive(false);
        }

        initialLeftHandColor  = leftHandRenderer.material.color;
        initialRightHandColor = rightHandRenderer.material.color;


        // Do this here incase we came from a restart
        RevertHandColors();

        // Initialize API data for this session
        sessionData = new GameData(UUIDManager.instance.GetUUIDString());

        // Start the intro action
        StartIntro();
    }
Esempio n. 22
0
    // public methods
    public void Enable()
    {
        var args = new MonoBehaviourEventArgs(this);

        _scoreState = ScoreState.SCORING_ENABLED;
        _timedCounter.Reset();
        _timedCounter.gameObject.SetActive(true);
        _renderer.enabled = true;
        _timedCounter.StartTimer();

        zenAbsorbEffect.Play();

        _light.enabled = true;

        Notifier.SendEventNotification(OnActivateEvent, args);
    }
Esempio n. 23
0
    void setState(ScoreState newState)
    {
        switch (newState)
        {
        case ScoreState.Normal:
            StateUpdate = normalUpdate;
            break;

        case ScoreState.Party:
            partyCountdown = secondsForCurrentParty;
            StateUpdate    = partyUpdate;
            break;

        default:
            throw new System.ArgumentOutOfRangeException();
        }
        currentState = newState;
    }
Esempio n. 24
0
    private ScoreState CreateScoreState(ScenarioController scenarioController)
    {
        var input = new ScoreStateInput(scenarioController);
        var state = new ScoreState(input, scenarioController);

        var menuTransition = new EventTransition(MenuState.StateName);

        input.NextEvent += menuTransition.ChangeState;

        var questionnaireTransition = new EventTransition(QuestionnaireState.StateName);

        input.InGameQuestionnaire += scenarioController.NextQuestionnaire;
        input.InGameQuestionnaire += questionnaireTransition.ChangeState;

        state.AddTransitions(menuTransition, questionnaireTransition);

        return(state);
    }
Esempio n. 25
0
    void Update()
    {
        if (gameState == GameState.Intro || gameState == GameState.Levels)
        {
            // Get the dot product between the head's forward direction and the world forward direction
            float lookDeviation = Vector3.Dot(Vector3.forward, headTransform.forward);

            // Only process a threshold violation if changing states
            if (Mathf.Abs(lookDeviation) > angleThresholdDot)
            {
                if (scoreState == ScoreState.CannotScore)
                {
                    scoreState = ScoreState.CanScore;

                    // Update visuals here
                    if (gameState == GameState.Levels)
                    {
                        UpdateTransparency(currentConfig.bagConfiguration, 1.0f);
                    }
                    else
                    {
                        UpdateTransparency(introButtons[introButtonIndex], 1.0f);
                    }
                }
            }
            else
            {
                if (scoreState == ScoreState.CanScore)
                {
                    scoreState = ScoreState.CannotScore;

                    // Update visuals again
                    if (gameState == GameState.Levels)
                    {
                        UpdateTransparency(currentConfig.bagConfiguration, 0.2f);
                    }
                    else
                    {
                        UpdateTransparency(introButtons[introButtonIndex], 0.2f);
                    }
                }
            }
        }
    }
Esempio n. 26
0
    public void EndGame()
    {
        gameState  = GameState.Endgame;
        scoreState = ScoreState.CanScore;

        // Return everything to normal transparency
        UpdateTransparency(currentConfig.bagConfiguration, 1.0f);

        // Clean up all punching bags, hands, and buttons
        currentConfig.bagConfiguration.SetActive(false);

        // Set hands to universal interaction colors
        SetMultiHandColors();

        // Set final score
        sessionData.FinalizeSessionData(ScoreManager.instance.GetTotalScore());
        Debug.Log("Ending Game");
        StartCoroutine(SendAPIData());
    }
Esempio n. 27
0
        void LoadGame()
        {
            //Goals---------------------------------------------
            eGoal = new Goal(new Vector2(1, 450));
            pGoal = new Goal(new Vector2(1500, 450));
            //--------------------------------------------------
            //Player--------------------------------------------
            p = new Player(tM.getTexture(1), Constants.GetRandomPos(), hitBoxes, tM, eGoal);
            p.Init();
            //--------------------------------------------------

            //Enemy---------------------------------------------
            stEnemy1 = new StandardEnemy(tM.getTexture(3), new Vector2(50, 450), hitBoxes, tM, pGoal, Color.Red);
            stEnemy1.Init();
            stEnemy2 = new StandardEnemy(tM.getTexture(3), Constants.GetRandomPos(), hitBoxes, tM, pGoal, Color.Blue);
            stEnemy2.Init();

            //--------------------------------------------------

            //DecisionTree Enemy-----------------------------------------
            dtEnemy = new DTenemy(tM.getTexture(3), new Vector2(50, 450), hitBoxes, tM, pGoal, Color.Purple);
            //------------------------------------------------------------

            //Orb-----------------------------------------------
            aC  = new AimControl(tM.getTexture(5), Vector2.Zero, p);
            orb = new Orb(tM.getTexture(4), Constants.GetRandomPos(), hitBoxes, Color.Red, 0.1f, p, stEnemy1, stEnemy2, dtEnemy, aC);
            orb.Init();

            //--------------------------------------------------


            //FuSM----------------------------------------------
            //fuSM = new FuSMachine(p, orb, stEnemy1, stEnemy2, eGoal, pGoal);
            //--------------------------------------------------

            //States---------------------------------------
            gS = new GuardState(dtEnemy, orb, pGoal, eGoal);
            cS = new ChaseState(dtEnemy, orb, pGoal, eGoal);
            sS = new ScoreState(dtEnemy, orb, pGoal, eGoal);
            //--------------------------------------------------

            dtController = new DTController(dtEnemy, orb, tree, cS, gS, sS, pGoal, eGoal);
        }
Esempio n. 28
0
    public void Awake()
    {
        m_par = 3;
        RenderSettings.ambientLight = ambientColor;
        m_courceController          = (CourceController)GameObject.FindObjectOfType(typeof(CourceController));
        //unpause the game
        GameConfig.setPaused(false);
        ScoreState ss = (ScoreState)GameObject.FindObjectOfType(typeof(ScoreState));

        if (ss)
        {
            m_scoreStateGO = ss.gameObject;
        }
        //if its levle 1 reset the scores.
        int holeIndex = getHoleNomUsingCourse();

        if (holeIndex == 1)
        {
            setScoreForHole(getHoleNomUsingCourse(), currentNumberOfStrokes);
            setTotalScore(0);
            //          m_totalScore=0;
            m_totalPar = 0;
        }
        else
        {
            //          m_totalScore = getTotalScore();
        }
        ParScript ps = (ParScript)GameObject.FindObjectOfType(typeof(ParScript));

        if (ps)
        {
            m_par = ps.par;
            setParForHole(getHoleNomUsingCourse(), m_par);
            m_totalPar += m_par;
        }
        else
        {
            setParForHole(getHoleNomUsingCourse(), m_par);
        }
        GameManager.enterState(GameScript.State.INIT.ToString());
    }
Esempio n. 29
0
        private async Task <DialogTurnResult> AskQuestionDialogStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            // Read in the passed down values from the parent dialog
            ScoreState ss = stepContext.SetStateAs(stepContext.GetOptionsAs <ScoreState>());

            await stepContext.Context.SendTextActivity(
                $"Question {ss.GetCurrentPositionGame() + 1} coming up");

            await Task.Delay(2500);

            switch (ss.CurrentGame.GameType)
            {
            case "Maths":

                return(await stepContext.BuildNumberPrompt(ss.GetCurrentQuestion(), cancellationToken));

            case "Phonics":

                return(await stepContext.BuildTextPrompt(ss.GetCurrentQuestion(), cancellationToken));
            }

            return(await stepContext.BuildTextPrompt("Something went wrong here, you don't seem to be following one of our standard games", cancellationToken));
        }
Esempio n. 30
0
        public void LoadLeaders(bool FromLast = true)
        {
            Players = new List <string>();
            StreamReader file = new StreamReader(@"" + LeadersFile);
            string       line = "";

            while ((line = file.ReadLine()) != null)
            {
                Players.Add(line);
            }
            Players.Remove("");
            Players.Sort(Comparer);
            Players.Reverse();
            for (int i = 0; i < Players.Count && FromLast; i++)
            {
                string nowPlayer = Score.ToString() + " " + Winner.ToString() + " " + name + " " + ArrayToString(WasAchievements, '/', 0);
                if (nowPlayer == Players[i])
                {
                    ShowNow = i;
                    break;
                }
            }
            active = ScoreState.Leaders;
        }
Esempio n. 31
0
	// Update is called once per frame
	void Update () {
	  
    float dt = Time.deltaTime;

    float rt = Time.time;

    if(!m_isPlaying) {
    
      if(Input.GetKeyUp(KeyCode.P)) {
        
        m_rt = rt;

        m_numStars = Random.Range(1, 11);

        Debug.Log("stars: " + m_numStars);

        m_timer = 1f;

        m_isPlaying = true;

        Debug.Log("LETTER " + (rt - m_rt) );

        m_state = ScoreState.Letter;  
      }
    }

    switch (m_state) {
    
      case ScoreState.Null: {
      }
      break;
      case ScoreState.Letter: {
        
        if(m_timer >= 0f) {
        
          m_timer -= dt;

          if(m_timer < 0f) {
            
            //m_hasNext = true;

            Debug.Log("STAR " + (rt - m_rt));

            m_numStars--;

            m_timer = (m_numStars > 0) ? 0.5f : 1f;

            m_state = ScoreState.Star;
          }
        }

      }
      break;
      case ScoreState.Light: {
      }
      break;
      case ScoreState.Star: {

        if(m_timer >= 0f) {
        
          m_timer -= dt;

          if(m_timer < 0f) {
            
            if(m_numStars > 0) {
              
              m_numStars--;

              Debug.Log("STAR " + (rt - m_rt));

              m_timer = (m_numStars > 0) ? 0.5f : 1f;
            }
            else {
              
              Debug.Log("TOTAL " + (rt - m_rt) );
              
              m_timer = 1f;

              m_state = ScoreState.Total;
            }
          }
        } 
        
      }
      break;
      case ScoreState.Total: {
      }
      break;
    }
	}
Esempio n. 32
0
        public override void Initialize()
        {
            toAdd = 0;
            Power = 100;

            state = ScoreState.Balance;

            float xScale = HalfSize.X * 2 / TextureSize;
            float yScale = HalfSize.Y * 2 / TextureSize;
            scale = new Vector2(xScale, yScale);

            base.Initialize();
        }
Esempio n. 33
0
        public override void Initialize()
        {
            Score = 5f;
            toAdd = 0;

            scoreDropTimer = 0;

            ResetMultiplier();

            State = ScoreState.Balance;

            float xScale = HalfSize.X * 2 / TextureSize;
            float yScale = HalfSize.Y * 2 / TextureSize;
            scale = new Vector2(xScale, yScale);

            base.Initialize();
        }
Esempio n. 34
0
        public override void Update(GameTime gameTime)
        {
            //Delta Time.
            float dt = (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (toAdd != 0)
            {
                //First calculate how many points max can be add or subtracted this frame.
                float pointsThisFrame = (PercentPerSecond * dt);

                //Are we gaining or loosing points?
                bool isDone;
                if (toAdd < 0)
                {
                    //Reset the multiplier.
                    ResetMultiplier();

                    //Check if these are the last points to subtract.
                    pointsThisFrame *= -1;
                    isDone = toAdd > pointsThisFrame;

                    //Change to the appropriate state.
                    State = ScoreState.Loss;

                    //Don't drop score for to long.
                    scoreDropTimer += dt;
                    if (scoreDropTimer >= ScoreDropTimeLimit)
                    {
                        ClearStacks();
                    }
                }
                else
                {
                    //Add the multiplier.
                    pointsThisFrame *= multiplier;

                    //Check if thes are the last points to add.
                    isDone = toAdd < pointsThisFrame;

                    //Change to the appropiate state.
                    State = ScoreState.Gain;

                    //Reset the scoreDropTimer.
                    scoreDropTimer = 0;
                }

                //Check the value which we add to or subtract from the score.
                float diffValue = isDone ? toAdd : pointsThisFrame;

                //Change toAdd and the score with score to be added or subtracted this frame.
                toAdd -= diffValue;
                Score += diffValue;
            }
            else
            {
                //Reset the scoreDropTimer.
                scoreDropTimer = 0;

                //Change to the appropiate state.
                State = ScoreState.Balance;
            }

            //Check if reached any score border.
            if (Score <= 0)
            {
                (GDGame.GetActiveScreen() as GameplayScreen).GameOver();
            }
            else if (Score >= Goal)
            {
                (GDGame.GetActiveScreen() as GameplayScreen).Won();
            }

            //Multiplier logic.
            if (forcedTimer == 0)
            {
                multiplierTimer += dt;
                if (multiplierTimer >= MultiplierTimeBorder)
                {
                    ResetMultiplier();
                }

                //Lastly the time.
                timeCounter += dt;
                if (timeCounter >= SecondsPerPointDrop)
                {
                    timeCounter -= SecondsPerPointDrop;
                    SubtractScore(PercentDropByTimeBorder, false);
                }
            }
            else
            {
                forcedTimer -= dt;
                if (forcedTimer <= 0)
                {
                    ResetMultiplier();
                }
            }

            if (isTimeLimited)
            {
                timeLeft -= dt;
                if (timeLeft <= 0)
                {
                    (GDGame.GetActiveScreen() as GameplayScreen).GameOver();
                }
            }

            base.Update(gameTime);
        }
Esempio n. 35
0
        public void ChangeColor(string param)
        {
            if (state == RatingsState.Static)
            {
                if (param == "criticality")
                {
                    if (criticality == 0)
                    {
                        scoreState = ScoreState.None;
                        return;
                    }
                    if (criticality < ConfigurationSettings.Instance.BOMlowThreshold1)
                        scoreState = ScoreState.High;
                    if (criticality >= ConfigurationSettings.Instance.BOMlowThreshold1 && criticality <= averageAmount)
                        scoreState = ScoreState.Medium;
                    if (criticality > averageAmount)
                        scoreState = ScoreState.Low;
                }
                if (param == "differentiation")
                {
                    if (differentiation == 0)
                    {
                        scoreState = ScoreState.None;
                        return;
                    }
                    if (differentiation < ConfigurationSettings.Instance.BOMlowThreshold1)
                        scoreState = ScoreState.High;
                    if (differentiation >= ConfigurationSettings.Instance.BOMlowThreshold1 && differentiation <= ConfigurationSettings.Instance.BOMhighThreshold1)
                        scoreState = ScoreState.Medium;
                    if (differentiation > ConfigurationSettings.Instance.BOMhighThreshold1)
                        scoreState = ScoreState.Low;
                }

                if (param == "effectiveness")
                {
                    if (effectiveness == 0)
                    {
                        scoreState = ScoreState.None;
                        return;
                    }
                    if (effectiveness < ConfigurationSettings.Instance.BOMlowThreshold1)
                        scoreState = ScoreState.High;
                    if (effectiveness >= ConfigurationSettings.Instance.BOMlowThreshold1 && effectiveness <= ConfigurationSettings.Instance.BOMhighThreshold1)
                        scoreState = ScoreState.Medium;
                    if (effectiveness > ConfigurationSettings.Instance.BOMhighThreshold1)
                        scoreState = ScoreState.Low;
                }

                if (param == "bomscore")
                {
                    if (totalBOMScore == 0)
                    {
                        scoreState = ScoreState.None;
                        return;
                    }
                    if (totalBOMScore < ConfigurationSettings.Instance.BOMlowThreshold1)
                        scoreState = ScoreState.High;
                    if (totalBOMScore >= ConfigurationSettings.Instance.BOMlowThreshold1 && totalBOMScore <= ConfigurationSettings.Instance.BOMhighThreshold1)
                        scoreState = ScoreState.Medium;
                    if (totalBOMScore > ConfigurationSettings.Instance.BOMhighThreshold1)
                        scoreState = ScoreState.Low;
                }
            }
        }
Esempio n. 36
0
        /// <summary>
        /// Uses the power and starts dropping it.
        /// The power gain cooldown automaticly starts.
        /// </summary>
        /// <param name="playerPos">The player's position for the power.</param>
        public void UsePower(Vector2 playerPos)
        {
            if (state != ScoreState.Gain)
            {
                //Don't activate a power if you can't use it.
                return;
            }

            //Drop the power over time.
            toAdd = -100;
            state = ScoreState.Loss;

            //Create the PowerBall.
            PowerBall temp = new PowerBall(GDGame, playerPos);
            GDGame.GetActiveScreen().Components.Add(temp);
            temp.Initialize();
        }
Esempio n. 37
0
        public override void Update(GameTime gameTime)
        {
            //Power addition logic.
            if (toAdd != 0)
            {
                float dt = (float)gameTime.ElapsedGameTime.TotalSeconds;
                float powerThisFrame = dt * PercentPerSecond;

                //How much do we add?
                bool isDone;
                if (toAdd < 0)
                {
                    powerThisFrame *= -1;
                    isDone = toAdd > powerThisFrame;
                }
                else
                {
                    isDone = toAdd < powerThisFrame;
                }
                float diffValue = isDone ? toAdd : powerThisFrame;
                toAdd -= diffValue;

                //And now add the Power.
                Power += diffValue;
            }

            //Power state logic.
            switch (state)
            {
                case ScoreState.Loss:
                    if (Power == 0)
                    {
                        state = ScoreState.Balance;
                    }
                    break;
                case ScoreState.Balance:
                    if (Power == 100)
                    {
                        state = ScoreState.Gain;
                    }
                    break;
            }

            base.Update(gameTime);
        }