// Update is called once per frame
    void Update()
    {
        /*if(transform.position.x < screenBounds.x*2 )
         * {
         *  Destroy(obj);
         * }*/

        //onclick destroy
        if (Input.touchCount > 0)
        {
            //Touch touch = Input.GetTouch(0);
            Vector3 objpos = obj.transform.position; //+25 -25
            for (int i = 0; i < Input.touchCount; i++)
            {
                Vector3 touchPosition = Camera.main.ScreenToWorldPoint(Input.touches[i].position);
                if ((objpos.x - 25) <= touchPosition.x && touchPosition.x <= (objpos.x + 25) && (objpos.y - 25) <= touchPosition.y && (objpos.y + 25) <= touchPosition.y)
                {
                    Destroy(obj);
                    ScorePoints.Scoreplus1();
                }
                //Debug.DrawLine(Vector3.zero, touchPosition, Color.red);
            }
        }
        //display score here
    }
Example #2
0
        static void Main()
        {
            Console.WriteLine("Enter a word to see the Scrabble points it is worth");
            string      userInput   = Console.ReadLine();
            ScorePoints ScorePoints = new ScorePoints();

            Console.WriteLine(ScorePoints.GrabValues(userInput));
        }
Example #3
0
        public void AddPoints_AddingPointsFromList_FinalPoints()
        {
            List <int> finalPoints = new List <int> {
                2, 1, 2
            };
            ScorePoints testScorePoints = new ScorePoints();

            Assert.AreEqual(5, testScorePoints.AddPoints(finalPoints));
        }
Example #4
0
        public void GrabValue_LoopArrayToGetValue_totalPoints()
        {
            string      userInput       = "dog";
            ScorePoints testScorePoints = new ScorePoints();

            CollectionAssert.AreEqual(new List <int> {
                2, 1, 2
            }, testScorePoints.GrabValues(userInput));
        }
Example #5
0
    public void NextLevel()
    {
        GameObject  scoreDisplay   = GameObject.Find("ScoreDisplay");
        ScorePoints totalAllScores = scoreDisplay.GetComponent <ScorePoints> ();

        GrandScore    += totalAllScores.TotalScore;
        GrandShots    += totalAllScores.PlayerShotCount;
        GrandAndCount += totalAllScores.AndroidDeathCount;
        GrandDroCount += totalAllScores.DroneDeathCount;


        SceneManager.LoadScene(CurrentScene + 1);
        //Application.LoadLevel (CurrentScene + 1);
    }
    //countdown till it deletes enemy gameobject
    IEnumerator deathTimer()
    {
        //Debug.Log ("Waitfor seconds");
        yield return(new WaitForSeconds(1.5f));

        //Add points to score and counter in ScorePoints.cs on
        GameObject  scoreDisplay = GameObject.Find("ScoreDisplay");
        ScorePoints addScore     = scoreDisplay.GetComponent <ScorePoints> ();

        addScore.AddAndroidScore();
        //Need to determine if android or drone and add apropriate score

        gameObject.SetActive(false);
    }
Example #7
0
    public void SetEndTimer()
    {
        //finds the reference
        GameObject Pathfinder = GameObject.Find("Pathfinder");
        FlightPath flightPath = Pathfinder.GetComponent <FlightPath> ();

        //Stores the variable "TimeTillEnd" into EndTimer
        EndTimer = flightPath.TimeTillEnd;

        //Sets bool to TRUE so script can start the end timer
        StartEndTimer = true;

        GameObject  scoreDisplay = GameObject.Find("ScoreDisplay");
        ScorePoints scorePoints  = scoreDisplay.GetComponent <ScorePoints> ();

        //Calls the final score function in ScorePoints.cs
        scorePoints.ScoreResult();
    }
        public Level2(DataBase db)
        {
            this.db = db;
            InitializeComponent();
            InitializeMyComponenets();
            this.FormBorderStyle = FormBorderStyle.None;
            timer1.Start();
            ScorePoints.Text = db.Score.ToString();
            HPBar.Increment(db.Life);
            ScorePoints.Text = db.Score.ToString();
            ScorePoints.SendToBack();
            ScoreLable.SendToBack();
            HPBar.SendToBack();
            HP.SendToBack();
            ChangeHpColor();

            if (Music.IsPlaying)
            {
                Music.Playlevel2();
            }
        }
Example #9
0
        public Level3(DataBase db)
        {
            npo     = new NonPlayer[25];
            respawn = new Point(30, 550);
            this.db = db;
            letMe   = true; right = false; left = false; playerIsMoving = false;
            InitializeMyComponenets();
            InitializeComponent();
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

            ScorePoints.Text = db.Score.ToString();
            HPBar.Increment(db.Life);
            ScorePoints.Text = db.Score.ToString();

            ScorePoints.SendToBack();
            ScoreLable.SendToBack();
            HPBar.SendToBack();
            HP.SendToBack();
            ChangeHpColor();
            if (Music.IsPlaying)
            {
                Music.Playlevel3();
            }
        }
 void Awake()
 {
     points = GetComponent <ScorePoints>();
 }
    // Update is called once per frame
    void Update()
    {
        //Shoots and detects if it hit and returns info about what it hit on update
        RaycastHit hit;
        //Sets a point in the middle of the camera using x,y,z coordinates
        Vector3 rayOrigin = fpsCamera.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0));


        //checks left mouse button is down and checks if enough time has passed since last shot
        if (PlayerMovement.shipMovement.activateControls == true)
        {
            //MOUSE SUPPORT, AND DEBUGGING
            //if (Input.GetButtonDown ("Fire1") && Time.time > nextFireTime) {

            //XBox Controller support, if the right trigger is used at all, this condition is met
            if (Input.GetAxis("RightTrigger") > 0 && Time.time > nextFireTime)
            {
                //timer so player can't spam the fire button
                nextFireTime = Time.time + fireRate;

                //Counter in ScorePoints class to keep track of how many shots fired
                GameObject  scoreDisplay = GameObject.Find("ScoreDisplay");
                ScorePoints scorePoints  = scoreDisplay.GetComponent <ScorePoints> ();
                scorePoints.AddPlayerShot();

                //Rayorigin where we are casting from
                //fps.forwars where we are casting towards
                //Out to get additional info and store it. passes data as reference and stores it in variable
                //Range range till we are casting the raycast
                if (Physics.Raycast(rayOrigin, fpsCamera.transform.forward, out hit, range))
                {
                    //Uses hit to see what we hit and check for what action can be performed with that object
                    IDamageable dmgScript = hit.collider.gameObject.GetComponent <EnemyHealth> ();

                    //Checks for damage script
                    if (dmgScript != null)
                    {
                        //Passes damage and where the damage happened
                        dmgScript.Damage(damage, hit.point);
                    }


                    //Michael- I commented out the force on hit to protect the player's frame,
                    //also idk if we want to push over the enemies
//					if (hit.rigidbody != null) {
//						//Adds force away from the face the the object was hit(if it has a rigidbody)
//						hit.rigidbody.				AddForce (-hit.normal * 100f);
//					}

                    //Start drawing of our line
                    lineRenderer.SetPosition(0, gunEnd.position);
                    //End of line
                    lineRenderer.SetPosition(1, hit.point);

                    //Creates particles at hit.point
                    //Instantiate (hitParticles, hit.point, Quaternion.identity);
                }

                //When button pressed down it calls function
                StartCoroutine(ShotEffect());
            }
        }
    }