示例#1
0
        // Defines what should happen when balls have been succesfully dispersed
        private static void OnDispersed()
        {
            int index = numberList.GetIndexOfNode(newlyInsertedNode);

            // Check for combo
            // Suggestion for improvement: onderstaande functie een array aanleveren zodat je alleen het deel
            // van de ketting bekijkt waar:
            // - De bal net is ingekomen
            // - De delen die niet door dit deel van de ketting worden aangeraakt
            //   worden niet in acht genomen
            if (numberList.CheckForComboAt(index, target))
            {
                nextBallValue = UnityEngine.Random.Range(NumberList.BOUND_LOW, NumberList.BOUND_HIGH);
            }

            nodeDestroyer.DestroyDeadNodes();

            // Check win condition
            if (numberList.nodeLinkedList.Count == 0)
            {
                UnityEngine.Debug.Log("GUTTER CLEARED! Game won!");
                GameStateManager.SwitchToWon();
                return;
            }

            GetValidTarget();

            // Reset the newly inserted node
            newlyInsertedNode = null;

            // Switch the gamestate to resetting
            GameStateManager.SwitchToResetting();
            ScoreAdd.ReduceScore();
        }
示例#2
0
    // Use this for initialization
    void Start()
    {
        _score = GameObject.Find("PoseManager").GetComponent <ScoreAdd>();
        _pose  = GameObject.Find("PoseManager").GetComponent <PoseManager> ();

        _Additional = 0;
        _L_Addscore = false;
        _R_Addscore = false;
        _Fadeflag   = false;
        _Fade       = false;

        //_Score = gameObject.GetComponent<Image>();
        _Score = gameObject.GetComponent <Text>();
        r      = _Score.GetComponent <Text>().color.r;
        g      = _Score.GetComponent <Text>().color.g;
        b      = _Score.GetComponent <Text>().color.b;
        alpha  = _Score.GetComponent <Text>().color.a;

        _Score.text = "PointGet";

        _fadeTime = 1.5f;
        _fiTime   = _fadeTime;
        _foTime   = 0.0f;

        _timer = 0.0f;
    }
示例#3
0
 private void Start()
 {
     rayLength         = nearLength;
     jumpFlag          = false;
     rigidbody2D       = this.GetComponent <Rigidbody2D>();
     scoreAdd          = GameObject.Find(scoreObj).GetComponent <ScoreAdd>();
     highScoreControll = GameObject.Find(rankingText).GetComponent <HighScoreControll>();
     nameInput         = GameObject.Find(input).GetComponent <NameInput>();
     animator          = this.gameObject.GetComponent <Animator>();
     StartCoroutine(Run(speed));
 }
        public void CheckButtonPressed()
        {
            TextFieldEditableManager.SetUneditable();
            DisplayResult.SetShouldDisplayTrue();
            timeStamp = Time.time + timeAfterSubmit;
            submitted = true;

            if (CheckpointManager.CheckAnswer())
            {
                ScoreAdd.AddCheckpointScore();
            }
        }
        public ActionResult Create(ScoreAdd model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = CreateScoreService();

            service.AddScore(model);
            return(RedirectToAction("Index"));
        }
示例#6
0
        public bool AddScore(ScoreAdd model)
        {
            var entity =
                new Score()
            {
                OwnerID    = _userId,
                CourseID   = model.CourseID,
                Hole1      = model.Hole1,
                ParHole1   = model.ParHole1,
                Hole2      = model.Hole2,
                ParHole2   = model.ParHole2,
                Hole3      = model.Hole3,
                ParHole3   = model.ParHole3,
                Hole4      = model.Hole4,
                ParHole4   = model.ParHole4,
                Hole5      = model.Hole5,
                ParHole5   = model.ParHole5,
                Hole6      = model.Hole6,
                ParHole6   = model.ParHole6,
                Hole7      = model.Hole7,
                ParHole7   = model.ParHole7,
                Hole8      = model.Hole8,
                ParHole8   = model.ParHole8,
                Hole9      = model.Hole9,
                ParHole9   = model.ParHole9,
                Hole10     = model.Hole10,
                ParHole10  = model.ParHole10,
                Hole11     = model.Hole11,
                ParHole11  = model.ParHole11,
                Hole12     = model.Hole12,
                ParHole12  = model.ParHole12,
                Hole13     = model.Hole13,
                ParHole13  = model.ParHole13,
                Hole14     = model.Hole14,
                ParHole14  = model.ParHole14,
                Hole15     = model.Hole15,
                ParHole15  = model.ParHole15,
                Hole16     = model.Hole16,
                ParHole16  = model.ParHole16,
                Hole17     = model.Hole17,
                ParHole17  = model.ParHole17,
                Hole18     = model.Hole18,
                ParHole18  = model.ParHole18,
                CreatedUtc = DateTimeOffset.Now
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Scores.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
示例#7
0
        // Destroys dead nodes from the NodeManager
        public void DestroyDeadNodes()
        {
            List <NumberNode> nodesToDestroy = new List <NumberNode>();

            // Loop over each node and mark them for destruction
            foreach (NumberNode node in NodeManager.GetNodes())
            {
                // If node is dead
                if (!node.alive)
                {
                    // Mark node eligible for destruction
                    nodesToDestroy.Add(node);


                    ParticlesList.Add(node.transform.position);
                    ScoreAdd.AddScore(10);
                    nodeDestroyedAudio.ShouldPlay = true;
                }
                else
                {
                    // If node is alive, but has reached the end of the gutter
                    if (node.pathFollower.distanceTravelled >= node.pathFollower.pathCreator.path.length)
                    {
                        // Mark node eligible for destruction
                        nodesToDestroy.Add(node);

                        screenShake.CamShake();
                        healthController.RemoveLife();
                        GameStateManager.SwitchToMoveBack();
                    }
                }
            }

            // Destroy nodes that are eligible for destruction
            // (Do this afterwards to not mess with the array during the foreach loop)
            foreach (NumberNode node in nodesToDestroy)
            {
                ScoreAdd.SetFurthestDistanceTravelled(node.pathFollower.distanceTravelled);
                NodeManager.RemoveNode(node);
                Destroy(node.gameObject);
            }
        }
示例#8
0
    // Use this for initialization
    void Start()
    {
        _L_Shoulder = GameObject.Find("Player_LeftHand1");
        _L_Elbow    = GameObject.Find("Player_LeftHand2");
        _L_HipJoint = GameObject.Find("Player_LeftLeg1");
        _L_Knee     = GameObject.Find("Player_LeftLeg2");
        _R_Shoulder = GameObject.Find("Player_RightHand1");
        _R_Elbow    = GameObject.Find("Player_RightHand2");
        _R_HipJoint = GameObject.Find("Player_RightLeg1");
        _R_Knee     = GameObject.Find("Player_RightLeg2");

        _Pose = PoseState.None;

        _RArm = false;
        _LHip = false;

        _score   = GetComponent <ScoreAdd>();
        _chance  = GameObject.Find("Chance").GetComponent <Chance>();
        _scores  = GameObject.Find("Score").GetComponent <Score>();
        _pause_h = GameObject.Find("Pause_H").GetComponent <Pause_H>();
    }
示例#9
0
    private void CellDestroyed(int score, Transform position)
    {
        cellCount--;
        ScoreChanged(score);
        ScoreAdd go = Instantiate(addScorePrefab, position.position + new Vector3(0, 0, -1), Quaternion.identity, levelHandler);

        go.scoreText.text = GetSign(score) + score.ToString();

        Random.InitState(System.DateTime.Now.Millisecond);
        float chance = Random.Range(0, 100);

        if (chance < 20)
        {
            Random.InitState(System.DateTime.Now.Millisecond);
            Instantiate(bonuses[(int)(Random.value * 100) % bonuses.Length], position.position + new Vector3(0, 0, -1), Quaternion.identity, levelHandler);
        }

        if (cellCount == 0)
        {
            LevelCompleted();
        }
    }
示例#10
0
 public static void SwitchToWon()
 {
     ScoreAdd.AddEndLevelScore();
     SceneManager.LoadScene("WinScreen");
 }
示例#11
0
 public static void SwitchToGameover()
 {
     ScoreAdd.GameOverScore();
     SceneManager.LoadScene("LossScreen");
     SetGameState(GameState.GAMEOVER);
 }
示例#12
0
 void Start()
 {
     ScoreAdd.Start();
     textMesh = GetComponent <TextMeshProUGUI>();
 }
示例#13
0
 void Start()
 {
     powerup = GameObject.Find("Player").GetComponent <ScoreAdd>();
 }
示例#14
0
 private string scoreObj = "ScoreAdd";// スコアを加算するオブジェクトの名前
 private void Awake()
 {
     ScoreTxt = this.GetComponent <Text>();
     scoreAdd = GameObject.Find(scoreObj).GetComponent <ScoreAdd>();
 }