Ejemplo n.º 1
0
	void Awake () {
		jod = GetComponent<JamoDrum> ();
		jodkey = GetComponent<JamoDrumKeyVersion> ();
		launcher = GetComponent<SingleLauncher> ();
		platform = GameObject.Find("TracingPanel")
			.GetComponent<TracingPanel>();
		spawn = GameObject.FindGameObjectWithTag("SpawnController")
			.GetComponent<SpawnMarbles>();
		soundManager = GameObject.Find ("SoundManager")
			.GetComponent<SoundManagerScript>();

		if (launcher.key) {
			jodkey.AddHitEvent(HitHandler);
			jodkey.AddSpinEvent(SpinHandler);
		}
		else {
			jod.AddHitEvent(HitHandler);
			jod.AddSpinEvent(SpinHandler);
		}

		stateStartAction = () => {
			stateTimer = 0f;
			heroTapSum = 0;
			heroSpinSum = 0;
		};
	}
Ejemplo n.º 2
0
	void Awake () {
		spawn = GetComponent<SpawnMarbles> ();
		health = GameObject.Find ("VillainHealth")
			.GetComponent<VillainHealth>();
		soundManager = GameObject.Find ("SoundManager")
			.GetComponent<SoundManagerScript>();
		explosion = GameObject.Find ("ExplosionController")
			.GetComponent<ExplosionController>();
	}
Ejemplo n.º 3
0
	void Awake () {
		controller = GameObject.Find ("GameController")
			.GetComponent<GameController> ();
		soundManager = GameObject.Find ("SoundManager")
			.GetComponent<SoundManagerScript> ();
		hpUI = GameObject.Find ("HPStuff")
			.GetComponentInChildren<DragonHP> ();
		maxHealth = health;
	}
Ejemplo n.º 4
0
	// Use this for initialization
	void Start () {
		beating = false;
		soundManager = GameObject.Find ("SoundManager")
			.GetComponent<SoundManagerScript> ();
		balls = GameObject.Find ("SpawnController")
			.GetComponent<SpawnMarbles> ().ballChain;
		gameController = GameObject.Find ("GameController")
			.GetComponent<GameController> ();
	}
Ejemplo n.º 5
0
	void Awake(){
		if (instance != null && instance != this) {
			Destroy (gameObject);
		} else {
			instance = this;
		}

		DontDestroyOnLoad (gameObject);
	}
 void Awake()
 {
     if (soundManagerInstance != null && soundManagerInstance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         soundManagerInstance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
Ejemplo n.º 7
0
    private void OnMouseUp()
    {
        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;

        // if put in incorrect posistion - CAT
        if (sceneName == "CatExercise")
        {
            if (Mathf.Abs(transform.position.x - cat[0].position.x) <= 0.5f &&
                Mathf.Abs(transform.position.y - cat[0].position.y) <= 0.5f ||
                Mathf.Abs(transform.position.x - cat[1].position.x) <= 0.5f &&
                Mathf.Abs(transform.position.y - cat[1].position.y) <= 0.5f ||
                Mathf.Abs(transform.position.x - cat[2].position.x) <= 0.5f &&
                Mathf.Abs(transform.position.y - cat[2].position.y) <= 0.5f)
            {
                Destroy(this.gameObject);
                SoundManagerScript.playErrorSound();
            }
            else
            {
                transform.position = new Vector2(initialPosition.x, initialPosition.y);
            }
        }
        // DOG
        if (sceneName == "DogExercise")
        {
            // if put in incorrect posistion
            if (Mathf.Abs(transform.position.x - dog[0].position.x) <= 0.5f &&
                Mathf.Abs(transform.position.y - dog[0].position.y) <= 0.5f ||
                Mathf.Abs(transform.position.x - dog[1].position.x) <= 0.5f &&
                Mathf.Abs(transform.position.y - dog[1].position.y) <= 0.5f ||
                Mathf.Abs(transform.position.x - dog[2].position.x) <= 0.5f &&
                Mathf.Abs(transform.position.y - dog[2].position.y) <= 0.5f)
            {
                Destroy(this.gameObject);
                SoundManagerScript.playErrorSound();
            }
            else
            {
                transform.position = new Vector2(initialPosition.x, initialPosition.y);
            }
        }
        else
        {
            transform.position = new Vector2(initialPosition.x, initialPosition.y);
        }
    }
Ejemplo n.º 8
0
    public void Move(float move, bool jump)
    {
        //only control the player if grounded or airControl is turned on
        if ((m_Grounded || m_AirControl) && knockBackCount <= 0)
        {
            // Move the character by finding the target velocity
            Vector3 targetVelocity = new Vector2(move * 10f, m_Rigidbody2D.velocity.y);
            // And then smoothing it out and applying it to the character
            m_Rigidbody2D.velocity = Vector3.SmoothDamp(m_Rigidbody2D.velocity, targetVelocity, ref m_Velocity, m_MovementSmoothing);

            // If the input is moving the player right and the player is facing left...
            if (move > 0 && !m_FacingRight)
            {
                // ... flip the player.
                Flip();
            }
            // Otherwise if the input is moving the player left and the player is facing right...
            else if (move < 0 && m_FacingRight)
            {
                // ... flip the player.
                Flip();
            }
        }
        else
        {
            // If player was knocked back
            if (knockBackFromRight)
            {
                m_Rigidbody2D.velocity = new Vector2(-knockBack, knockBack);
            }
            else
            {
                m_Rigidbody2D.velocity = new Vector2(knockBack, knockBack);
            }
            knockBackCount -= Time.deltaTime;
        }
        // If the player should jump...
        if (m_Grounded && jump)
        {
            // Play jump sound
            SoundManagerScript.PlaySound("Jump");

            // Add a vertical force to the player.
            m_Grounded = false;
            m_Rigidbody2D.AddForce(new Vector2(0f, m_JumpForce));
        }
    }
Ejemplo n.º 9
0
    private void DoubleJump(Vector3 wishDir)
    {
        if (canDJump)
        {
            SoundManagerScript.PlaySound("djump");
            float tempJumpForce = jumpForce;
            //Calculate upwards
            float upSpeed = rb.velocity.y;
            if (upSpeed < 0)
            {
                upSpeed = 0;
            }
            else if (upSpeed < dJumpBaseSpd)
            {
                upSpeed       = dJumpBaseSpd;
                tempJumpForce = 0;
            }

            //Calculate sideways
            Vector3 jumpVector = Vector3.zero;
            Vector2 force      = Vector2.zero;
            wishDir = wishDir.normalized;
            Vector3 spid = new Vector3(rb.velocity.x, 0, rb.velocity.z);
            if (spid.magnitude < airTargetSpeed)
            {
                jumpVector  = wishDir * dashForce;
                jumpVector -= spid;
            }
            else if (Vector3.Dot(spid.normalized, wishDir) > -0.4f)
            {
                jumpVector   = wishDir * dashForce;
                force        = ClampedAdditionVector(new Vector2(rb.velocity.x, rb.velocity.z), new Vector2(jumpVector.x, jumpVector.z));
                jumpVector.x = force.x;
                jumpVector.z = force.y;
            }
            else
            {
                jumpVector = wishDir * spid.magnitude;
            }

            //Apply Jump
            jumpVector.y = tempJumpForce;
            rb.velocity  = new Vector3(rb.velocity.x, upSpeed, rb.velocity.z);
            rb.AddForce(jumpVector, ForceMode.Impulse);
            canDJump = false;
        }
    }
Ejemplo n.º 10
0
    private void Update()
    {
        //  Debug.Log(Health);
        HealthBar.SetHealth(Health);
        if (Health <= 0)
        {
            LostLevel.SetActive(true);
            Time.timeScale = 0f;
            Health         = 100;
            SoundManagerScript.PlaySound("stinger_lose");
            //animator.SetTrigger("Death");
            //DestroyGameObject();
            return;
        }

        //white dizzzy logic
    }
Ejemplo n.º 11
0
    private void ActivateAssistant()
    {
        AssistantHelp ah = GameObject.Find("MainGameLogic").GetComponent <AssistantHelp>();

        if (!ah.activated)
        {
            DisplayMessageOnScreen("Assistente Monetario Ativado");
            ah.activated = true;
            SoundManagerScript.PlaySound("happy");
        }
        else
        {
            DisplayMessageOnScreen("Assistente Monetario Desactivado");
            ah.activated = false;
            SoundManagerScript.PlaySound("sad");
        }
    }
Ejemplo n.º 12
0
    IEnumerator Countdown(int seconds)
    {
        int count = seconds;

        while (count > 0)
        {
            yield return(new WaitForSeconds(1));

            if (count != 1)
            {
                countDownText.text = (count - 1).ToString();
                SoundManagerScript.playSecondSound();
            }
            count--;
        }
        StartGame();
    }
Ejemplo n.º 13
0
    IEnumerator Pickup(Collider player)
    {
        stats = player.GetComponent <PlayerMovement>();
        if (isBoosted == false)
        {
            isBoosted = true;
            SoundManagerScript.PlaySound("PowerUp");
            stats.speed *= multiplier;
            StartCoroutine(FromTo(60f, 75f, 0.2f, false));
            yield return(new WaitForSeconds(duration));

            isBoosted = false;
            SoundManagerScript.PlaySound("PowerDown");
            StartCoroutine(FromTo(stats.speed, stats.speed / multiplier, 0.7f, true));
            StartCoroutine(FromTo(75f, 60f, 0.7f, false));
        }
    }
Ejemplo n.º 14
0
    public void DisplayNextSentence()
    {
        if (talk.Count == 0)
        {
            EndDialogue();
            return;
        }
        DialogueSpecial temp = talk.Dequeue();

        person.text = temp.name;
        character   = person.text;
        string s = temp.sentence;

        StopAllCoroutines();
        SoundManagerScript.StopSound();
        StartCoroutine(TypeSentence(s, character));
    }
Ejemplo n.º 15
0
 public void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         SoundManagerScript.PlaySound("SFX/GetHit");
         HealthScript.health -= 10f;
         //isDead = true;
     }
     if (collision.gameObject.tag == "Bullet")
     {
         bossHealth -= 10;
         // if (bossHealth <= 0)
         //{
         //   boss1IsDead = true;
         //}
     }
 }
Ejemplo n.º 16
0
    private void Spit()
    {
        Vector2 direction;

        spitTimer += Time.deltaTime;

        if (spitTimer >= spitInterval)
        {
            direction = player.transform.position - transform.position;
            direction.Normalize();

            SoundManagerScript.PlaySound("ThrowWBC");
            Instantiate(spit, spitPoint.transform.position, spitPoint.transform.rotation);

            spitTimer = 0;
        }
    }
Ejemplo n.º 17
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "FallDetector")
     {
         gameLevelManager.Respawn();
     }
     if (other.tag == "Checkpoint")
     {
         respawnPoint = other.transform.position;
     }
     if (other.tag == "ArenaTriggers")
     {
         if (movingToRight)
         {
             fixMove            = true;
             rigidBody.velocity = new Vector2((movement * speed) / -1, rigidBody.velocity.y);
         }
         else if (movingToLeft)
         {
             fixMove            = true;
             rigidBody.velocity = new Vector2((movement * speed) / -1, rigidBody.velocity.y);
         }
     }
     if (other.gameObject.tag == "Coin")
     {
         money++;
         SoundManagerScript.PlaySound("coin");
     }
     if (other.gameObject.tag == "Characters")
     {
         isNearCharacter = true;
     }
     if (other.gameObject.name == "Goofy")
     {
         isNearGoofy = true;
     }
     if (other.gameObject.name == "Motor_oil")
     {
         SoundManagerScript.PlaySound("questitem");
         hasMotorOil = true;
     }
     if (other.gameObject.name == "Bus_Stop")
     {
         nearBusStop = true;
     }
 }
Ejemplo n.º 18
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Virus") && collision.gameObject.GetComponent <VirusBehavior>().isDamaging())
     {
         mainController.PlayHitEffects();
         if (shield > 0)
         {
             SoundManagerScript.PlaySound("TakeDamage");
             shield--;
         }
         else
         {
             mainController.LowerLives();
             mainController.PlayDamageEffects();
         }
     }
 }
Ejemplo n.º 19
0
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            _instance = this;
        }

        coin   = Resources.Load <AudioClip>("coin");
        draw   = Resources.Load <AudioClip>("draw");
        attack = Resources.Load <AudioClip>("attack");

        audioSrc = GetComponent <AudioSource>();
    }
Ejemplo n.º 20
0
 public void ResetProgress()
 {
     SoundManagerScript.PlaySound("button");
     PlayerPrefs.DeleteAll();
     instruction11.SetActive(false);
     instruction1.SetActive(true);
     button1.interactable = false;
     image1.enabled       = true;
     button2.interactable = false;
     image2.enabled       = true;
     hs1.GetComponent <TextMeshProUGUI>().SetText("0");
     hs2.GetComponent <TextMeshProUGUI>().SetText("0");
     hs3.GetComponent <TextMeshProUGUI>().SetText("0");
     ButtonSettings.releasedLevelStatic = 1;
     ResetUI.SetActive(true);
     StartCoroutine(LateCall());
 }
Ejemplo n.º 21
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         SoundManagerScript.PlaySound("SFX/GetHit");
         Destroy(gameObject);
         HealthScript.health -= 10;
     }
     if (collision.gameObject.tag == "Barrier")
     {
         Destroy(gameObject);
     }
     if (collision.gameObject.tag == "Bullet")
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 22
0
    void UpdateValue()
    {
        Debug.LogFormat("Updating value of diffSlider to {0}", diffSlider.value);

        if (diffSlider.value == 1)
        {
            SoundManagerScript.PlayOneShot("Kid_Laugh");
        }
        else if (diffSlider.value == 2)
        {
            SoundManagerScript.PlayOneShot("Laughter");
        }
        else if (diffSlider.value == 3)
        {
            SoundManagerScript.PlayOneShot("Maniac");
        }
    }
Ejemplo n.º 23
0
    // Use this for initialization
    void Start()
    {
        //HSDM_Script = GameObject.FindGameObjectWithTag("High Score Display Manager").GetComponent<HighScoreDisplayManagerScript>();
        SoundManager_Script = GameObject.FindGameObjectWithTag("SoundManager").GetComponent <SoundManagerScript> ();

        //Original sprite before click
        playGamePanel.SetActive(false);
        topScorePanel.SetActive(false);
        creditsPanel.SetActive(false);

        Time.timeScale = 1.0f;
        CheckDifficultyLock();

        //Sounds manager Mute button work around and starting back ground music
        SoundManager_Script.GetMuteButton();
        SoundManager_Script.Play_BG_loop("bg1");
    }
Ejemplo n.º 24
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         if (LivesUI.lives >= 10)
         {
             ;
         }
         else
         {
             LivesUI.lives += 5;
             SoundManagerScript.PlaySound("HealthUp");
             //SpawnPowerup();
             Destroy(this.gameObject);
         }
     }
 }
Ejemplo n.º 25
0
    /**
     * Checks for each objective in the objectives array to see if the player has come within 1 unit of that object,
     * signifying that the player has collected or completed that object. The objective's hasCompleted boolean will
     * be set to true.
     */
    void CheckObjectives()
    {
        Transform player = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();

        foreach (Objective o in objectives)
        {
            if (Vector2.Distance(o.objective.transform.position, player.position) < 1)
            {
                o.hasCompleted = true;
                if (o.objective.activeSelf)
                {
                    SoundManagerScript.PlaySound("money");
                }
                o.objective.SetActive(false);
            }
        }
    }
Ejemplo n.º 26
0
    IEnumerator coroutineA()
    {
        int i = 3;

        while (i >= 1)
        {
            cont.text = i.ToString();
            i--;
            yield return(new WaitForSeconds(1.0f));
        }
        cont.fontSize = 900;
        cont.text     = "GOO!!";
        SoundManagerScript.PlaySound("go");
        yield return(new WaitForSeconds(1.0f));

        cont.enabled = false;
    }
Ejemplo n.º 27
0
    private void OnTriggerEnter(Collider collider)
    {
        if (collider.gameObject == Ball && Ball.GetComponent <Ball_Script>().follow == false)
        {
            lives--;
            SoundManagerScript.PlaySoundFX("ball_destroyed");
            Ball.GetComponent <Ball_Script>().Respawn();
        }

        if (collider.gameObject.transform.IsChildOf(GameObject.Find("PowerUps").transform))
        {
            collider.gameObject.GetComponent <PowerUp_Script>().start = false;
            collider.gameObject.GetComponent <PowerUp_Script>().GetComponent <MeshRenderer>().enabled = false;
            collider.gameObject.GetComponent <PowerUp_Script>().GetComponent <BoxCollider>().enabled  = false;
            collider.gameObject.GetComponent <PowerUp_Script>().transform.position = collider.gameObject.GetComponent <PowerUp_Script>().pos;
        }
    }
Ejemplo n.º 28
0
    protected override void OnMouseUp()
    {
        pressed = false;
        if (sceneName == "SecretaryExercise")
        {
            transform.position = ReplaceBlocks(transform.position.x, transform.position.y, initialPosition.x, initialPosition.y, 4.391f, 3.119f);
        }
        else if (sceneName == "ArtemisExercise")
        {
            if (Mathf.Abs(transform.position.x - targetBlock[0].position.x) <= 0.5f &&
                                     Mathf.Abs(transform.position.y - targetBlock[0].position.y) <= 0.5f ||
                                     Mathf.Abs(transform.position.x - targetBlock[1].position.x) <= 0.5f &&
                                     Mathf.Abs(transform.position.y - targetBlock[1].position.y) <= 0.5f ||
                                     Mathf.Abs(transform.position.x - targetBlock[2].position.x) <= 0.5f &&
                                     Mathf.Abs(transform.position.y - targetBlock[2].position.y) <= 0.5f ||
                                      Mathf.Abs(transform.position.x - targetBlock[3].position.x) <= 0.5f &&
                                     Mathf.Abs(transform.position.y - targetBlock[3].position.y) <= 0.5f)
            {
                this.gameObject.SetActive(false);
                destroyed = true;
                SoundManagerScript.playErrorSound();
                if (sceneName == "ArtemisExercise")
                {
                    fairyAnimator.runtimeAnimatorController = Resources.Load("fairy disappointed 1") as RuntimeAnimatorController;
                }
            }
            else
            {
                transform.position = new Vector2(initialPosition.x, initialPosition.y);
                SpriteChangeTest.rend.sprite = SpriteChangeTest.fairy01;
            }
        }
        else
        {
            transform.position = new Vector2(initialPosition.x, initialPosition.y);
        }
        // doubleclick
        if (Input.GetMouseButtonUp(0))
            clickCounter += 1;

        if (clickCounter == 1 && coroutineAllowed)
        {
            firstClickTime = Time.time;
            StartCoroutine(DoubleClickDetection());
        }
    }
Ejemplo n.º 29
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        GameObject      player          = GameObject.Find("Player");
        PlayersMovement playersMovement = player.GetComponent <PlayersMovement>();

        if (collision.collider.gameObject.CompareTag("PickUp"))
        {
            Destroy(collision.collider.gameObject);

            SoundManagerScript.PlaySound("slurp");
            transform.localScale += new Vector3(.03F, .03F, 0);
            GameManager.gameManager.consumePerson();
            print("People = " + GameManager.gameManager.getPeopleConsumed());
            playersMovement.jumpForce = 120f + playersMovement.jumpForce;
            playersMovement.Speed     = .2f + playersMovement.Speed;
        }
    }
Ejemplo n.º 30
0
 public void ability() // cd: 10f
 {
     if (!cooldowns[1])
     {
         SoundManagerScript.PlaySound("Skill");
         RaycastHit2D[] ultHits = Physics2D.CircleCastAll(wielder.position, 4.0f, Vector2.zero);
         foreach (RaycastHit2D hit in ultHits)
         {
             if (hit.transform.CompareTag("Enemy"))
             {
                 hit.transform.GetComponent <Enemy>().takeDamage(damage + 2);
             }
         }
         SpawnAndDestroy(hitbox, 0.25f);
         StartCoroutine(FadeTo(1, 10, 1, cooldownImageAbility));
     }
 }
Ejemplo n.º 31
0
    private void Reset()
    {
        Vector3 playerPosition = GameObject.FindGameObjectWithTag("Player").transform.position;

        transform.position = playerPosition + new Vector3(0, 0.5f, 0);

        float dirX = Random.Range(-5.0f, 5.0f);
        float dirY = Random.Range(2.0f, 5.0f);

        direcao = new Vector3(dirX, dirY).normalized;
        gm.vidas--;
        SoundManagerScript.PlaySound("death");
        if (gm.vidas < 0)
        {
            gm.ChangeState(GameManager.GameState.ENDGAME);
        }
    }
Ejemplo n.º 32
0
    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        if (hitInfo.CompareTag("Enemy"))
        {
            SoundManagerScript.PlaySound("ShotFired1");
            Enemy target = hitInfo.GetComponent <Enemy>();
            target.TakeDamage(damage);

            Instantiate(impactEffect, transform.position, transform.rotation);
            Destroy(gameObject);
        }
        else if (!hitInfo.CompareTag("Range"))
        {
            Instantiate(impactEffect, transform.position, transform.rotation);
            Destroy(gameObject);
        }
    }
Ejemplo n.º 33
0
 private void Atack()
 {
     if (atackCD > 0)
     {
         return;
     }
     atackCD = 1.2f;
     PerformAction("Atack");
     foreach (var enemy in FindObjectsOfType <Enemigo>())
     {
         if (Vector3.Distance(transform.position, enemy.transform.position) <= 2)
         {
             enemy.getHit(stats.GetAtack());
             SoundManagerScript.PlaySound("SwordAttack");
         }
     }
 }
Ejemplo n.º 34
0
 void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.CompareTag("Platform") || collision.gameObject.CompareTag("Trigger") || collision.gameObject.CompareTag("Bubble") || collision.gameObject.CompareTag("Lock1"))
     {
         //Debug.Log("Reflect");
         reflectedBullet = true;
         SoundManagerScript.PlaySound("Reflect");
         var speed     = lastVelocity.magnitude + 0.5f;
         var direction = Vector3.Reflect(lastVelocity.normalized, collision.contacts[0].normal);
         //Debug.Log(direction);
         rigidBody.velocity = direction * speed;
     }
     else
     {
         //reflectedBullet = false;
     }
 }
Ejemplo n.º 35
0
    //Unity calls this function when our pickup touches any other object
    //If the player touches the pickup object, it will disappear and the player's score will go up

    private void OnCollisionEnter2D(Collision2D collision)
    {
        //Check if the thing we touched was the Player
        Player playerScript = collision.collider.GetComponent <Player>();

        //If the thing we touched has the player script, that means it IS the player, so....
        if (playerScript)
        {
            //We hit the player!
            SoundManagerScript.PlaySound("coinSound");
            //Add to the score based on our value
            scoreObject.AddScore(timepieceValue);

            //Destroy the gameObject that this script is attached to (the coin)
            Destroy(gameObject);
        }
    }
Ejemplo n.º 36
0
    /// <summary>
    /// Méthode permettant de diminuer ou d'augmenter les points de vie du Personnage
    /// </summary>
    /// <param name="dmg">nb de points de vie a ajouter (valeur négative pour enlever)</param>
    /// /// <returns> true si tué sinon false</returns>
    public bool takeDamageHeal(int dmg)
    {
        health += dmg;
        if (health <= 0)
        {
            health    = 0;
            healthMax = 0;
            for (int k = 0; k < hand.Count; k++)
            {
                GameObject.Find("GameManager").GetComponent <GameManager>().Disc(hand[k]);
            }
            hand.Clear();

            List <GameObject> Personnages = GameObject.Find("GameManager").GetComponent <GameManager>().Personnages;

            for (int i = 0; i < Personnages.Count; i++)
            {
                if (Personnages[i].GetComponent <ThisPersonnage>().GetPersonnage().GetHealth() == 0)
                {
                    if (Personnages[i].GetComponent <ThisPersonnage>().GetPersonnage().GetRole() == "Sheriff")
                    {
                        GameObject.Find("GameManager").GetComponent <GameManager>().nbSheriff--;
                        Debug.Log(GameObject.Find("GameManager").GetComponent <GameManager>().nbSheriff);
                    }
                    else if (Personnages[i].GetComponent <ThisPersonnage>().GetPersonnage().GetRole() == "Hors La Loi")
                    {
                        GameObject.Find("GameManager").GetComponent <GameManager>().nbHorsLaLoi--;
                        Debug.Log(GameObject.Find("GameManager").GetComponent <GameManager>().nbHorsLaLoi);
                    }

                    Personnages.RemoveAt(i);
                }
            }
        }
        if (health > healthMax)
        {
            health = healthMax;
        }
        if (health == 0 && !isDead)
        {
            isDead = true;
            SoundManagerScript.PlaySound("Oof");
        }

        return(isDead);
    }
Ejemplo n.º 37
0
	void Awake () {
		soundManager = GameObject.Find ("SoundManager")
			.GetComponent<SoundManagerScript> ();
	}
 /**
  * Awake function
  */
 void Awake()
 {
     if (Singleton == null) // Not instantiated yet
         Singleton = this;
     else if (Singleton != this) // Can only have one
         Destroy(gameObject);
     DontDestroyOnLoad(gameObject); // Persist this object
 }
Ejemplo n.º 39
0
 void Awake()
 {
     if (instance != null)
         Debug.LogError("Only one plox");
     instance = this;
 }
Ejemplo n.º 40
0
	void Awake () {
		soundManager = GameObject.Find ("SoundManager")
			.GetComponent<SoundManagerScript> ();
		explosion = GameObject.Find ("ExplosionController")
			.GetComponent<ExplosionController>();
	}
Ejemplo n.º 41
0
	// Use this for initialization
	void Start () {
		NM = GameObject.FindGameObjectWithTag("NoteManager").GetComponent<NoteManager>();
		//SMS = GameObject.FindGameObjectWithTag ("SoundManager").GetComponent<SoundManagerScript> ();

		SMS = SoundManagerScript.Instance;

		if(noteName == "MiddleC"){
			currentNote = note.MiddleC;
			Yposition = -1.5f;
		}
		if(noteName == "CSharp"){
			currentNote = note.CSharp;
			Yposition = -1.5f;
		}
		if(noteName == "D"){
			currentNote = note.D;
			Yposition = -1.25f;
		}
		if(noteName == "DSharp"){
			currentNote = note.DSharp;
			Yposition = -1.25f;
		}
		if(noteName == "E"){
			currentNote = note.E;
			Yposition = -1f;
		}
		if(noteName == "F"){
			currentNote = note.F;
			Yposition = -0.75f;
		}
		if(noteName == "FSharp"){
			currentNote = note.FSharp;
			Yposition = -0.75f;
		}
		if(noteName == "G"){
			currentNote = note.G;
			Yposition = -0.5f;
		}
		if(noteName == "GSharp"){
			currentNote = note.GSharp;
			Yposition = -0.5f;
		}
		if(noteName == "A"){
			currentNote = note.A;
			Yposition = -0.25f;
		}
		if(noteName == "ASharp"){
			currentNote = note.ASharp;
			Yposition = -0.25f;
		}
		if(noteName == "B"){
			currentNote = note.B;
			Yposition = 0f;
		}
		if(noteName == "HighC"){
			currentNote = note.HighC;
			Yposition = 0.25f;
		}
		if(noteName == "HighCSharp"){
			currentNote = note.HighCSharp;
			Yposition = 0.25f;
		}
		if(noteName == "HighD"){
			currentNote = note.HighD;
			Yposition = 0.5f;
		}
		if(noteName == "HighDSharp"){
			currentNote = note.HighDSharp;
			Yposition = 0.5f;
		}
		if(noteName == "HighE"){
			currentNote = note.HighE;
			Yposition = 0.75f;
		}
		if(noteName == "HighF"){
			currentNote = note.HighF;
			Yposition = 1f;
		}
		this.gameObject.transform.position = new Vector3(transform.position.x, Yposition, transform.position.z);
	}