void ShowMenu(int windowID)
    {
        GameObject   PointCounter = GameObject.Find("Points");
        PointCounter Points       = PointCounter.GetComponent <PointCounter> ();

        GUI.Label(new Rect(20, Screen.height / 8, Screen.width - 40, (Screen.height / 2) - 60), loseText + (Points.point) + loseText2);

        if (GUI.Button(new Rect(20, (Screen.height / 4), (Screen.width / 2) - 30, (Screen.height / 2) - 20), "Main Menu"))
        {
            GlobalVariables.pause();
            showLoseMenu = false;
            LoadLevels.loadMenu("bubble_menu");
            Time.timeScale           = 1;
            GlobalVariables.isPaused = false;
        }
        if (GUI.Button(new Rect((Screen.width / 2), (Screen.height / 4), (Screen.width / 2) - 20, (Screen.height / 2) - 20), "Try Again"))
        {
            //LoadLevels.loadMenu ("OceanGame");
            //GlobalVariables.pause();
            //Application.LoadLevel(Application.loadedLevel);
            //Time.timeScale = 1;
            //GlobalVariables.isPaused = false;
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
            Time.timeScale           = 1;
            GlobalVariables.isPaused = false;
        }
    }
    void OnMouseDown()
    {
        if (!GlobalVariables.isPaused)
        {
            GameObject     Dropplay = GameObject.Find("Playdrop");
            Playdropscript drop     = Dropplay.GetComponent <Playdropscript> ();
            drop.play();
            //This plays a sound from another game objects audio source using another script.
            //You need to do this if your object is being destroyed or else the sound won't play, even if you have it before the destroy.
            //If it's not being destroyed you can use the objects own audio source and files e.g.
            //AudioSource source = GetComponent<AudioSource>();
            //source.PlayOneShot(WaterDrop, 1f);



            //Finds Points and increments public variable
            GameObject   PointCounter = GameObject.Find("Points");
            PointCounter Points       = PointCounter.GetComponent <PointCounter> ();
            Points.point += 1;

            Destroy(gameObject);

            //Spawn Bubbles
            Instantiate(dustParticle, transform.position, Quaternion.identity);
        }
    }
    void stayInBounds()
    {
        // Turn around if at the end of the map
        if ((rb.velocity.x > 0 && transform.position.x > X_BOUND) ||
            (rb.velocity.x < 0 && transform.position.x < -X_BOUND))
        {
            //Finds Points and increments public variable
            GameObject   PointCounter = GameObject.Find("Points");
            PointCounter Points       = PointCounter.GetComponent <PointCounter> ();
            Points.point += 1;

            GameObject       playsound = GameObject.Find("Playbottle");
            playbottlescript sound     = playsound.GetComponent <playbottlescript>();
            sound.play();

            Destroy(gameObject);

            //rb.velocity = new Vector2 (rb.velocity.x * -1, rb.velocity.y);
        }

        // Keep in the y bounds
        if ((transform.position.y > Y_BOUND && rb.velocity.y > 0) || (transform.position.y < (-Y_BOUND) && rb.velocity.y < 0))
        {
            rb.velocity = new Vector2(rb.velocity.x / 5, 0);             //rb.velocity.y * -1);
        }
        // Make sure it stays in the same plane
        if (transform.position.z != 0)
        {
            transform.position = new Vector3(transform.position.x, transform.position.y, 0);
        }
    }
Exemple #4
0
 public static PointCounter getInstance() {
     if(instance == null) {
         instance = new PointCounter();
     }
     instance.pointText = GameObject.Find("PointText").GetComponent<Text>();
     return instance;
 }
Exemple #5
0
    // Start is called before the first frame update
    void Start()
    {
        playerObject = Instantiate(playerPrefab);
        enemyObject  = Instantiate(enemyPrefab);

        _inputHandler = new InputHandler();
        _inputHandler.InputInit();
        _player      = new Player(playerObject);
        _powerUpPool = new ObjectPool <PowerUp>();

        _levelGeneration = new LevelGeneration(_player, _powerUpPool) as ILevelGenerator;
        _score           = new PointCounter();

        powerUpManager = new PowerUpManager();
        //powerUpManager.createRandomPowerUp(Instantiate(PowerUpPrefab).transform);

        _enemyStateMachine = new EnemyFSM();
        _enemyStateMachine.AddState(EnemyStateType.Idle, new IdleState());
        _enemyStateMachine.AddState(EnemyStateType.Attack, new AttackState());



        _levelGeneration = new LevelGeneration() as ILevelGenerator;

        _randomCoordinate = new RandomCoordinate(_levelGeneration);
        _pathfinder       = new Pathfinder2(_levelGeneration);
    }
Exemple #6
0
        private static double[] ForFour(List <Point> points, int p0)
        {
            var KT = CountingAlgoritm.CountPoints(points);
            int k  = KT.K;
            int t  = KT.T;

            var m12 = (IMarking)PointMarking90.MarkContourPoints(points);
            int m1  = m12.CountNegativeAngles;
            int m2  = m12.CountPositiveAngles;

            var m34 = (IMarking)PointMarking135.Build(points);
            int m3  = m34.CountNegativeAngles;
            int m4  = m34.CountPositiveAngles;

            var orientations = PointCounter.ToCountPoints(points);

            var Lln   = 0.5d * (k * 2d * A + (double)t * 2 * B);
            var Lvp   = 0.5d * (m1 * 2d * B + m3 * (A + B));
            var Lvg   = 0.5d * (m2 * 2d * B + m4 * (A + B));
            var Lkont = GetLkont(orientations);

            double k1 = m1 / p0;
            double k2 = m2 / p0;
            double k3 = m3 / p0;
            double k4 = m4 / p0;
            double k5 = k / p0;
            double k6 = t / p0;
            double k7 = Lln / Lkont;
            double k8 = Lvg / Lkont;
            double k9 = Lvp / Lkont;

            return(new double[] { k1, k2, k3, k4, k5, k6, k7, k8, k9 });
        }
Exemple #7
0
 void Start()
 {
     anim            = this.gameObject.GetComponent <Animator> ();
     score           = FindObjectOfType <PointCounter> ();
     healthbar.value = maxHealth;
     currentHealth   = healthbar.value;
 }
 private void Awake()
 {
     S              = this;
     _maxPoints     = 0;
     _currnetPoints = 0;
     _mobCounter    = 0;
 }
Exemple #9
0
 // Start is called before the first frame update
 void Start()
 {
     pointCounter = GameObject.Find("Canvas").GetComponent <PointCounter>();
     user         = GameObject.Find("Knight_man").GetComponent <SimpleSideController>();
     tempy        = GameObject.FindGameObjectWithTag("MrManager");
     manny        = tempy.GetComponent <GameManager>();
 }
Exemple #10
0
    // Use this for initialization
    void Start()
    {
        GlobalVariables.LoadCamera();

        if (growOnPoint)
        {
            MIN_X = -GlobalVariables.width / 2;
            MAX_X = GlobalVariables.width / 2;
            MIN_Y = -GlobalVariables.height / 2;
            MAX_Y = -GlobalVariables.height / 5;
        }
        else
        {
            MIN_X = -GlobalVariables.width / 2;
            MIN_Y = -GlobalVariables.height / 2;
            MAX_X = GlobalVariables.width / 2;
            MAX_Y = GlobalVariables.height / 2;
        }


        if (randomizeRotation)
        {
            transform.rotation = Quaternion.AngleAxis(Random.Range(0, 360), Vector3.forward);
        }

        // Come up with position variables
        float newY = Random.Range(MIN_Y, MAX_Y);
        float newZ = (float)MAX_Z - (float)newY / (float)MIN_Y * ((float)MAX_Z - (float)MIN_Z);

        if (changeSizeDynamically)
        {
            transform.position = new Vector3(Random.Range(MIN_X, MAX_X), newY, newZ);
            size = (float)Random.Range(MIN_SIZE, MAX_SIZE) *
                   (((float)MAX_Z - (float)newZ) / ((float)MAX_Z - (float)MIN_Z));
        }
        else
        {
            transform.position = new Vector3(Random.Range(MIN_X, MAX_X), newY, Random.Range(MIN_Z, MAX_Z));
            size = (float)Random.Range(MIN_SIZE, MAX_SIZE);
        }

        //Debug.Log ("Size: " + size + " Z: " + transform.position.z);

        transform.localScale = new Vector3(0, 0, 0);

        if (growOnPoint)
        {
            GameObject PointCounter = GameObject.Find("Points");
            points    = PointCounter.GetComponent <PointCounter> ();
            lastPoint = points.point;
        }

        if (growOnMiss)
        {
            GameObject PointCounter = GameObject.Find("Points");
            points     = PointCounter.GetComponent <PointCounter> ();
            lastMissed = points.trashMissed;
        }
    }
Exemple #11
0
    // Use this for initialization
    void Start()
    {
        rigidbody = transform.root.GetComponent <Rigidbody>();

        speedometer  = speedField.GetComponent <TextMesh>();
        pointCounter = pointField.GetComponent <TextMesh>();

        pointScript = GetComponent <PointCounter>();
    }
Exemple #12
0
 // Start is called before the first frame update
 void Start()
 {
     PointCounter.Reset();
     shake     = GameObject.FindGameObjectWithTag("ScreenShake").GetComponent <Shake>();
     animator  = GetComponent <Animator>();
     hitPoints = MaxHitPoints;
     animator.SetInteger("Character", PlayerPrefs.GetInt("SelectedCharacter"));
     // animator.SetInteger("Character", 0);
 }
 /// <summary>
 /// Awake is called when the script instance is being loaded.
 /// </summary>
 void Awake()
 {
     AnimateCommonCanvas();
     EnableGameObjects();
     audioPlayer.PlayMainTheme();
     lightController.MainLightMode();
     _timeCounter  = GetComponent <TimeCounter>();
     _pointCounter = GetComponent <PointCounter>();
     _touchCounter = GetComponent <TouchCounter>();
 }
        private void StartNewGame_Click(object sender, RoutedEventArgs e)
        {
            pc = new PointCounter();
            //up = new Upgrade();
            pc.Initialize();
            pc.OnTick += (points) =>
            {
            };

            Upgrade1Btn.Visibility = Visibility.Visible;
            Upgrade2Btn.Visibility = Visibility.Visible;
        }
    // Update is called once per frame
    void Update()
    {
        if (!GlobalVariables.isPaused)
        {
            // Used to make sure garbage becomes visible to the player before counting for score (not needed)
            timeAlive++;

            // Rotate the trash
            transform.Rotate(Vector3.back * Time.deltaTime * UnityEngine.Random.Range(3, 10));

            // Get the position
            Vector3 pos = transform.position;

            // Turn around if at the end of the map
            if ((rb.velocity.x > 0 && pos.x > X_BOUND) || (rb.velocity.x < 0 && pos.x < -X_BOUND))
            {
                if (timeAlive > 60)
                {
                    //Finds Points and increments public variable
                    GameObject   PointCounter = GameObject.Find("Points");
                    PointCounter Points       = PointCounter.GetComponent <PointCounter> ();
                    Points.trashMissed += 1;
                }

                Destroy(gameObject);
                //rb.velocity = new Vector3( rb.velocity.x * -1, rb.velocity.y, rb.velocity.z);
            }


            // Keep in the y bounds
            if (pos.y > Y_BOUND && rb.velocity.y > 0 || (pos.y < -Y_BOUND && rb.velocity.y < 0))
            {
                rb.velocity = new Vector3(rb.velocity.x, rb.velocity.y * -1);
            }


            // Make sure it stays in the same plane
            if (pos.z != 0)
            {
                rb.velocity        = new Vector2(rb.velocity.x, rb.velocity.y);
                transform.position = new Vector3(pos.x, pos.y, 0);
            }

            limitSpeed();

            // Move the object
            transform.position = new Vector3(
                transform.position.x + rb.velocity.x,
                transform.position.y + rb.velocity.y,
                transform.position.z
                );
        }
    }
 public void SetActive(bool state)
 {
     isActive = state;
     if (isActive == true)
     {
         displayLeftScore  = GameObject.Find("ScoreLeft").GetComponent <PointCounter>();
         displayRightScore = GameObject.Find("ScoreRight").GetComponent <PointCounter>();
     }
     else
     {
         Debug.Log("No Scoring in this scene. Remember to  reset the Scores when needed /° ! °\\");
     }
 }
Exemple #17
0
 // Start is called before the first frame update
 void Start()
 {
     if (gameObject.name == "orange")
     {
         isOrange = true;
     }
     else if (gameObject.name == "blue")
     {
         isOrange = false;
     }
     pointCounter       = GameObject.FindGameObjectWithTag("point");
     pointCounterScript = pointCounter.GetComponent <PointCounter>();
 }
Exemple #18
0
    // Sets
    public void setAwake()
    {
        currentDashResistance = maxDashResistance;

        currentHealth = maxHealth;                                          // Sets the player health to the value of maxHealth that you indicated.

        sword10Active = false;                                              // Sets the sword10Active bool to false by default.
        //sword20Active = false;                                                // Sets the sword20Active bool to false by default.
        chain10Active   = false;                                            // Sets the chain10Active bool to false by default.
        trailActivation = false;

        sphereCollider         = GetComponent <SphereCollider>();
        capsuleCollider        = GetComponent <CapsuleCollider>();
        attackAction           = GetComponentInChildren <BoxCollider>();        // Gets the BoxCollider of the PlaceHolder_Sword children.
        attack01ColliderRadius = attack01Collider.radius;

        chainTransition = GetComponentInChildren <ChainAnimTrigger>();

        crackGround.SetActive(false);

        playerAudio = GetComponent <AudioSource>();                              // Gets the component AudioSource from the player.

        timeStunned = timeStunnedIni;

        flashColor            = new Color(1.0f, 0.0f, 0.0f, 0.1f);                  // Sets the color values for the damageImage.
        swordSprite.enabled   = true;
        chainSprite.enabled   = false;
        sword10Sprite.enabled = false;
        sword20Sprite.enabled = false;
        chain10Sprite.enabled = false;
        newAbility.color      = new Color(0.0f, 0.0f, 0.0f, 0.0f);

        pointsText = GameObject.FindGameObjectWithTag("Score");
        score      = pointsText.GetComponent <PointCounter>();

        rigidBody = GetComponent <Rigidbody>();                                  // Gets the RigidBody from the GameObject.

        anim = GetComponent <Animator>();

        swordMaterial = GetComponent <Renderer>().material;

        blackScreen.enabled = false;
        //counterMenu = counterMenuAux;
        victoryText.enabled     = false;
        lostText.enabled        = false;
        cooldownSword10.enabled = false;

        state = PlayerStates.AWAKE;                                             // Cals the AWAKE state.

        slashFX.Stop();
    }
Exemple #19
0
        /// <summary>
        /// Cancels the prvious rally.
        /// </summary>
        public IEnumerable <Receive> CancelRally()
        {
            if (Points.Count < 1)
            {
                throw new InvalidOperationException("Cannot rollback from empty state!");
            }
            var point = Points.Last();

            Points.Remove(point);
            PointCounter.Rollback();
            (PointA, PointB) = (PointCounter.PointA, PointCounter.PointB);
            OnRallyCanceled(point);
            return(point.Receives);
        }
Exemple #20
0
 public PointCounterTile(Tile t, Dictionary <Direction, PointCounterTile> d, int x, int y, PointCounter parent)
 {
     X              = x;
     Y              = y;
     this.parent    = parent;
     this.neighbors = new Dictionary <Direction, PointCounterTile>(d);
     foreach (Direction dir in Enum.GetValues(typeof(Direction)))
     {
         if (neighbors[dir] != null)
         {
             neighbors[dir].SetNeighbor(this, Utilities.oppositeDirection(dir));
         }
     }
     this.tile = t;
 }
Exemple #21
0
    public void Reward(GameObject[] allTrash)
    {
        for (int i = 0; i < allTrash.Length; i++)
        {
            GameObject   trashInstance = allTrash [i];
            GameObject   PointCounter  = GameObject.Find("Points");
            PointCounter Points        = PointCounter.GetComponent <PointCounter> ();
            Points.point += 1;

            Destroy(trashInstance);
        }
        GameObject       SwooshPlay = GameObject.Find("Playswoosh");
        playbottlescript swoosh     = SwooshPlay.GetComponent <playbottlescript> ();

        swoosh.play();
    }
Exemple #22
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Drone")
     {
         shake.CamShake();
         hitPoints--;
         canvas.GetComponent <HitPointsController>().Remove();
     }
     if (hitPoints == 0)
     {
         //TODO: end game
         PlayerPrefs.SetInt("Points", PointCounter.Get());
         SceneManager.LoadScene(
             PlayerPrefs.GetInt("SelectedCharacter") == 0 ?
             "GameOver40000" : "GameOver"
             );
     }
 }
Exemple #23
0
    // Update is called once per frame
    void Update()
    {
        stamina           = FindObjectOfType <Boxer2Stamina> ();
        currentStamina    = stamina.currentStamina;
        boxer1KnockedDown = FindObjectOfType <Boxer1Health> ();
        boxer1Down        = boxer1KnockedDown.down;
        boxer2KnockedDown = FindObjectOfType <Boxer2Health> ();
        boxer2Down        = boxer2KnockedDown.down;
        boxer1Attacks     = FindObjectOfType <Boxer1Attacks> ();
        attackType        = boxer1Attacks.attack;
        pointIncrease     = FindObjectOfType <PointCounter> ();

        if (boxer1Down == false && boxer2Down == false && PauseMenu.gamePaused == false)
        {
            if (Input.GetButtonDown("Controller2LeftStick") && currentStamina >= 20f)
            {
                anim.SetBool("BackDodge", true);
                stamina.dodgeStamina();
                if (attackType != 0)
                {
                    pointIncrease.boxer2DefencePoints();
                }
            }
            else
            {
                anim.SetBool("BackDodge", false);
            }

            if (Input.GetButtonDown("Controller2RightStick") && currentStamina >= 5f)
            {
                anim.SetBool("CentreBlock", true);
                stamina.blockStamina();
                if (attackType != 0)
                {
                    pointIncrease.boxer2DefencePoints();
                }
            }
            else
            {
                anim.SetBool("CentreBlock", false);
            }
        }
    }
Exemple #24
0
    // Use this for initialization
    void Start()
    {
        a        = GetComponent <Animator> ();
        redDot   = GameObject.Find("redDot");
        greenDot = GameObject.Find("greenDot");

        points = GetComponent <PointCounter> ();
        render = GetComponent <SpriteRenderer> ();

        if (type == 1)
        {
            render.sprite = pink;
            points.SetMultiplier(2);
        }
        else if (type == 2)
        {
            render.sprite = blue;
            hasFreeDeath  = true;
        }
    }
Exemple #25
0
 /// <summary>
 /// Called when the rally is over.
 /// </summary>
 /// <param name="point">Point.</param>
 public void RallyFinished(Point <TTeam> point)
 {
     Points.Add(point);
     if (point.WinnerTeam == TeamA)
     {
         PointCounter.IncrementA();
     }
     else if (point.WinnerTeam == TeamB)
     {
         PointCounter.IncrementB();
     }
     //Allows child to raise INotifyPropertyChanged.PropertyChanged event.
     (PointA, PointB) = (PointCounter.PointA, PointCounter.PointB);
     if (PointCounter.IsGameSet)
     {
         WinnerTeam = point.WinnerTeam;
         OnGameOver();
         Set.CurrentGameFinished();
     }
 }
Exemple #26
0
    // Sets
    public void setAwake()
    {
        currentHealth = maxHealth;

        player = GameObject.FindGameObjectWithTag("Player");               // Finds the gameobject with the tag "Player".

        playerManager = player.GetComponent <PlayerManager>();             // Gets the script PlayerManager of the player.
        pointsText    = GameObject.FindGameObjectWithTag("Score");
        score         = pointsText.GetComponent <PointCounter>();

        nav = GetComponent <NavMeshAgent>();                                    // Gets the NavMeshAgent component.

        playerInRange = false;                                                  // Initalize the playerInRange bool to false.

        playerAttacked = false;                                                 // Initialize the playerAttacked bool to false.

        onStunTimer = onStunTimerIni;                                           // Initialize the onStunTimer.

        stunCooldown = stunCooldownIni;                                         // Initialize the stunCooldown.

        stunOffset = stunOffsetIni;                                             // Initialize the stunOffset.

        stunThunderParticle.Stop();

        hitSparkParticle.Stop();

        hitTextureParticle.Stop();

        blood.Stop(true);

        //enemyAudio = GetComponent<AudioSource>();                             // Gets the AudioSource component from the enemy.

        //rigidBody = GetComponent<Rigidbody>();                                // Gets the rigidbody component from the enemy.
        //capsuleCollider = GetComponent<CapsuleCollider>();
        //sphereCollider = GetComponent<SphereCollider>();
        //leftHandAttack1 = GetComponentInChildren<SphereCollider>();           // Gets the SphereCollider of the leftHandAttack1 children.

        anim = GetComponent <Animator>();                                       // Gets the animator component from the enemy.

        state = EnemyStates.AWAKE;                                              // Goes to the AWAKE state.
    }
Exemple #27
0
    public PointCounterTile(Tile t, PointCounterTile[] neighbors, int x, int y, PointCounter parent)
    {
        X           = x;
        Y           = y;
        this.parent = parent;
        if (neighbors.Length != 4)
        {
            Debug.LogError("Wrong usage of PointCounterTile, neighbours argument has to have 4 fields!");
        }
        this.neighbors = new Dictionary <Direction, PointCounterTile>();

        foreach (Direction d in Enum.GetValues(typeof(Direction)))
        {
            if (neighbors[(int)d] != null)
            {
                this.neighbors[d] = neighbors[(int)d];
                this.neighbors[d].SetNeighbor(this, Utilities.oppositeDirection(d));
            }
        }

        this.tile = t;
    }
Exemple #28
0
    // Start is called before the first frame update
    void Start()
    {
        _winScreen.gameObject.SetActive(false);
        _playerObject = Instantiate(_playerPrefab);

        _inputHandler = new InputHandler();
        _inputHandler.InputInit();
        _player      = new Player(_playerObject);
        _powerUpPool = new ObjectPool <PowerUp>();

        _levelGeneration = new LevelGeneration(_player, _powerUpPool) as ILevelGenerator;
        _score           = new PointCounter();

        _powerUpManager = new PowerUpManager();

        _enemyStateMachine = new EnemyFSM();
        _enemyStateMachine.AddState(EnemyStateType.Idle, new IdleState());
        _enemyStateMachine.AddState(EnemyStateType.Attack, new AttackState());

        _randomCoordinate = new RandomCoordinate(_levelGeneration);
        _pathfinder       = new Pathfinder2(_levelGeneration);
    }
	// Sets
	public void setAwake()
    { 
		currentDashResistance = maxDashResistance;

        currentHealth = maxHealth;                          		        // Sets the player health to the value of maxHealth that you indicated.

		sword10Active = false;                                		        // Sets the sword10Active bool to false by default.
        //sword20Active = false;                                		        // Sets the sword20Active bool to false by default.
        chain10Active = false;                                		        // Sets the chain10Active bool to false by default.

        sphereCollider = GetComponent<SphereCollider>();
        capsuleCollider = GetComponent<CapsuleCollider>();
        attackAction = GetComponentInChildren<BoxCollider>();      	        // Gets the BoxCollider of the PlaceHolder_Sword children.
		attack01ColliderRadius = attack01Collider.radius;

        chainTransition = GetComponentInChildren<ChainAnimTrigger>();       

        playerAudio = GetComponent<AudioSource>();          		        // Gets the component AudioSource from the player.

        timeStunned = timeStunnedIni;

        flashColor = new Color(1.0f, 0.0f, 0.0f, 0.1f);           		    // Sets the color values for the damageImage.
        swordSprite.enabled = true;
        chainSprite.enabled = false;
        sword10Sprite.enabled = false;
        sword20Sprite.enabled = false;
        chain10Sprite.enabled = false;
        newAbility.color = new Color(0.0f, 0.0f, 0.0f, 0.0f);
        
        pointsText = GameObject.FindGameObjectWithTag("Score");
        score = pointsText.GetComponent<PointCounter>();

        rigidBody = GetComponent<Rigidbody>();              		        // Gets the RigidBody from the GameObject.

        anim = GetComponent<Animator>();

        swordMaterial = GetComponent<Renderer>().material;

        blackScreen.enabled = false;
        counterMenu = counterMenuAux;
        victoryText.enabled = false;
        lostText.enabled = false;

        state = PlayerStates.AWAKE;                         		        // Cals the AWAKE state.
	}
 private void Start()
 {
     pc = GameObject.Find("GameController").GetComponent <PointCounter>();
     setNextState(GameState.PLAYING);
 }
Exemple #31
0
    public void Update()
    {
        gameManager  = GameObject.Find("GameManager").GetComponent <GameManager>();
        hudText      = GameObject.Find("HUDObject").GetComponentsInChildren <Text>();
        pointCounter = GameObject.Find("HUDObject").GetComponentInChildren <PointCounter>();

        //Finally, enable lines 154-326

        /*if(hudText != null && hudChecked == false)
         * {
         *  CheckForHUDObject();
         *  hudChecked = true;
         * }*/

        if (hudText[12].color.a >= 0.9 && playedSound == false && playSound1 == false)
        {
            playSound1 = true;
            if (playSound1 == true)
            {
                chimeSource.PlayOneShot(clipToPlay);
                playedSound = false;
            }
        }

        if (hudText[13].color.a >= 0.9 && playSound2 == false && playedSound == false)
        {
            playSound2  = true;
            playedSound = true;
            if (playSound2 == true && playedSound == true)
            {
                chimeSource.PlayOneShot(clipToPlay);
                playedSound = false;
            }
        }

        if (hudText[14].color.a >= 0.9 && playSound3 == false && playedSound == false)
        {
            playSound3  = true;
            playedSound = true;
            if (playSound3 == true && playedSound == true)
            {
                chimeSource.PlayOneShot(clipToPlay);
                playedSound = false;
            }
        }

        if (hudText[15].color.a >= 0.9 && playSound4 == false && playedSound == false)
        {
            playSound4  = true;
            playedSound = true;
            if (playSound4 == true && playedSound == true)
            {
                chimeSource.PlayOneShot(startClip);
                playedSound = false;
            }
        }

        if (pauseTimer == true)
        {
            time += Time.deltaTime;
        }


        var minutes  = Mathf.Floor(time / 60);
        var seconds  = time % 60;//Use the euclidean division for the seconds.
        var fraction = (time * 100) % 100;

        //update the label value
        timerLabel.text = string.Format("{0:00} : {1:00} : {2:00}", minutes, seconds, fraction);
    }
Exemple #32
0
 void Start()
 {
     cTime = sTime;
     score = FindObjectOfType <PointCounter> ();
 }
    // Sets
    public void setAwake()
    {
        currentHealth = maxHealth;

        player = GameObject.FindGameObjectWithTag("Player");                    // Finds the gameobject with the tag "Player".

        playerManager = player.GetComponent<PlayerManagerBackup>();             // Gets the script PlayerManager of the player.
        pointsText = GameObject.FindGameObjectWithTag("Score");
        score = pointsText.GetComponent<PointCounter>();

        nav = GetComponent<NavMeshAgent>();                                     // Gets the NavMeshAgent component.

        playerInRange = false;                                                  // Initalize the playerInRange bool to false.

        playerAttacked = false;                                                 // Initialize the playerAttacked bool to false.

        onStunTimer = onStunTimerIni;                                           // Initialize the onStunTimer.

        stunCooldown = stunCooldownIni;                                         // Initialize the stunCooldown.

        stunOffset = stunOffsetIni;                                             // Initialize the stunOffset.
        
        //enemyAudio = GetComponent<AudioSource>();                             // Gets the AudioSource component from the enemy.

        //rigidBody = GetComponent<Rigidbody>();                                // Gets the rigidbody component from the enemy.
        //capsuleCollider = GetComponent<CapsuleCollider>();
        //sphereCollider = GetComponent<SphereCollider>();
        //leftHandAttack1 = GetComponentInChildren<SphereCollider>();           // Gets the SphereCollider of the leftHandAttack1 children.

        anim = GetComponent<Animator>();                                        // Gets the animator component from the enemy.

        state = EnemyStates.AWAKE;                                              // Goes to the AWAKE state.
    }
Exemple #34
0
 // Use this for initialization
 void Start()
 {
     this.counter = GameObject.Find("PointCounter").GetComponent<PointCounter>();
     Debug.Log(counter);
     Debug.Log("Point created with counter", this.counter);
 }
Exemple #35
0
 // Use this for initialization
 void Start()
 {
     this.counter = GameObject.Find("PointCounter").GetComponent<PointCounter>();
     this.GetComponent<SpriteRenderer>().enabled = true;
     this.GetComponent<Collider2D>().enabled = true;
 }
Exemple #36
0
 void Start()
 {
     rb = gameObject.GetComponent<Rigidbody2D>();
     animator = GetComponent<Animator>();
     lastShot = Time.time;
     eaten = new Stack();
     counter = GameObject.Find("PointCounter").GetComponent<PointCounter>();
 }