예제 #1
0
 public void removeHealth(int v)
 {
     if (!healthBar.activeSelf)
     {
         return;
     }
     health -= v;
     GameObject.Find("Health").GetComponent <Image>().fillAmount = (float)health / (float)initHealth;
     if (health <= 0)
     {
         enable = false;
         GameCore.instance.GameWin();
         SpikeMovement move = GameObject.Find("Stage3Boss").GetComponent <SpikeMovement>();
         bossSound.Stop();
         move.y       = 15;
         move.max_y   = 5;
         move.destroy = true;
     }
 }
예제 #2
0
 void Update()
 {
     if (!enable || GameCore.instance.getProgress() <= 0.05)
     {
         return;
     }
     if (nextSpawn <= 0)
     {
         StartCoroutine(spawnEnemy());
         nextSpawn = 4 + Random.Range(0, 2f) - 4 * (1 - GameCore.instance.getSpeed()) + (GameCore.instance.getProgress() > 0.5f ? 4 : 0);
     }
     if (nextSpawnSpike <= 0)
     {
         StartCoroutine(spawnSpike());
         nextSpawnSpike = 8 + Random.Range(0, 4f);
     }
     if (nextSpawnUpSpike <= 0)
     {
         StartCoroutine(spawnUpSpike());
         nextSpawnUpSpike = 8 + Random.Range(0, 4f);
     }
     if (GameCore.instance.getProgress() > 0.28f)
     {
         if (stage2 != null)
         {
             Instantiate(stage2).gameObject.name = "Stage2Boss";
             stage2 = null;
         }
     }
     if (GameCore.instance.getProgress() > 0.5)
     {
         if (!boss2go)
         {
             SpikeMovement move = GameObject.Find("Stage2Boss").GetComponent <SpikeMovement>();
             move.y       = 2;
             move.max_y   = 5;
             move.destroy = true;
             boss2go      = true;
         }
     }
     if (GameCore.instance.getProgress() > 0.66f)
     {
         if (stage3 != null)
         {
             Instantiate(stage3).name = "Stage3Boss";
             stage3 = null;
             healthBar.SetActive(true);
             GameObject.Find("Depth").SetActive(false);
             StartCoroutine(startHealth());
             bossSound.Play();
         }
     }
     if (GameCore.instance.getProgress() > 0.70f)
     {
         nextSpawnUpSpike -= Time.deltaTime;
     }
     if (GameCore.instance.getProgress() > 0.33f)
     {
         nextSpawnSpike -= Time.deltaTime;
     }
     nextSpawn -= Time.deltaTime;
 }
예제 #3
0
파일: Spike.cs 프로젝트: K33W1/MOBIGAM-MP
 private void Awake()
 {
     spikeMovement = GetComponent <SpikeMovement>();
     colliders     = GetComponentsInChildren <Collider>();
 }