コード例 #1
0
    public void Dead()
    {
        Debug.Log("Game Over");

        Vector3 spawnPosition = new Vector3();

        spawnPosition.x = 0f;
        spawnPosition.y = rb.position.y;

        deadParticleSystemMain            = deadParticleSystem.main;
        deadParticleSystemMain.startColor = sr.color;

        //deadParticleSystem.startColor = sr.color;
        Instantiate(deadParticleSystem, spawnPosition, Quaternion.identity); // Particle creater
        Destroy(particles);
        Destroy(player);
        GameStatus = 0;                                       // Gameover variable for conditions which are using RigidBody2D rb
        animator.SetTrigger("EndGame");                       // End Game animation trigger
        scoreText scoreText = FindObjectOfType <scoreText>(); //Updates the highscore

        scoreText.HighScoreSaver();                           //Updates the highscore
    }
コード例 #2
0
ファイル: sword.cs プロジェクト: aluminumbulb/The-Long-Farm
 // Start is called before the first frame update
 void Start()
 {
     anim         = GetComponent <Animator>();
     scoreTracker = FindObjectOfType <scoreText>();
 }