コード例 #1
0
 public void Restart()
 {
     //       SaveManager.SetCrystal(Crystals);
     Crystals = 0;
     this.gameObject.transform.position = new Vector3(-7f, 1f, this.transform.position.z);
     HPControl.restart();
     MPControl.Reset();
 }
コード例 #2
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Obstacle")
     {
         if (other.name == "diamondpink")
         {
             other.GetComponent <Renderer>().enabled    = false;
             other.GetComponent <BoxCollider>().enabled = false;
             other.GetComponent <AudioSource>().PlayOneShot(diamondsound);
             other.transform.FindChild("ObParticle").gameObject.GetComponent <ParticleSystem>().Play();
             MPControl.increaseMP(0.005f);
         }
         else if (other.name == "diamondred")
         {
             other.GetComponent <Renderer>().enabled    = false;
             other.GetComponent <BoxCollider>().enabled = false;
             other.GetComponent <AudioSource>().PlayOneShot(diamondsound);
             other.transform.FindChild("ObParticle").gameObject.GetComponent <ParticleSystem>().Play();
             HPControl.increaseHP(0.015f);
         }
         else if (other.name == "redfire" || other.name == "bluefire")
         {
             other.GetComponent <Renderer>().enabled    = false;
             other.GetComponent <BoxCollider>().enabled = false;
             other.GetComponent <AudioSource>().PlayOneShot(fire);
             if (other.name == "redfire")
             {
                 other.transform.FindChild("redfire").GetComponent <Renderer>().enabled = false;
             }
             else
             {
                 other.transform.FindChild("bluefire").GetComponent <Renderer>().enabled = false;
             }
             other.transform.FindChild("Particle System").gameObject.GetComponent <ParticleSystem>().Play();
             if (canheart == true)
             {
                 StartCoroutine("heart");
             }
             HPControl.decreaseHP(0.05f);
         }
         else if (other.name == "crystalpurple" || other.name == "crystalblue" || other.name == "crystalpink")
         {
             other.GetComponent <Renderer>().enabled    = false;
             other.GetComponent <BoxCollider>().enabled = false;
             other.GetComponent <AudioSource>().PlayOneShot(diamondsound);
             other.transform.FindChild("ObParticle").gameObject.GetComponent <ParticleSystem>().Play();
             Crystals += 1;
         }
         else if (other.name == "babyghost")
         {
             other.transform.FindChild("babyghost").GetComponent <Renderer>().enabled = false;
             other.GetComponent <BoxCollider>().enabled = false;
             other.GetComponent <AudioSource>().PlayOneShot(babyghostsound);
             other.transform.FindChild("Particle System").gameObject.GetComponent <ParticleSystem>().Play();
             if (canheart == true)
             {
                 StartCoroutine("heart");
             }
             HPControl.decreaseHP(0.15f);
         }
         else if (other.name == "floatghost")
         {
             other.transform.FindChild("floatghost").GetComponent <Renderer>().enabled = false;
             other.GetComponent <BoxCollider>().enabled = false;
             other.GetComponent <AudioSource>().PlayOneShot(floatghostsound);
             other.transform.FindChild("Particle System").gameObject.GetComponent <ParticleSystem>().Play();
             if (canheart == true)
             {
                 StartCoroutine("heart");
             }
             HPControl.decreaseHP(0.3f);
         }
         else if (other.name == "sadakom")
         {
             if (canheart == true)
             {
                 StartCoroutine("heart");
             }
             HPControl.decreaseHP(0.5f);
         }
     }
 }
コード例 #3
0
ファイル: AIMeleeAttack.cs プロジェクト: migg32/UnityTest
 private void FindTarget()
 {
     m_targetHPControl = GameObject.FindGameObjectWithTag(m_targetTag).GetComponent<HPControl>();
 }