Пример #1
0
    public void ScoreTesting()
    {
        POCC.GameManager manager = POCC.GameManager.getInstance();
        manager.destroyTest();
        manager = POCC.GameManager.getInstance();
        Assert.AreEqual(0, manager.getAchievements().Count);

        for (int i = 0; i < 10; i++)
        {
            manager.incrementCollectableScore(POCC.Collectable.GOLDFLY);
        }
        Debug.Log(manager.getAchievements());
        Assert.AreEqual(1, manager.getAchievements().Count);

        for (int i = 0; i < 9; i++)
        {
            manager.incrementCollectableScore(POCC.Collectable.GOLDFLY);
        }
        Debug.Log(manager.getAchievements());
        Assert.AreEqual(1, manager.getAchievements().Count);

        manager.incrementCollectableScore(POCC.Collectable.GOLDFLY);

        Assert.AreEqual(2, manager.getAchievements().Count);

        for (int i = 0; i < 10; i++)
        {
            manager.incrementCollectableScore(POCC.Collectable.GOLDFLY);
        }

        Assert.AreEqual(3, manager.getAchievements().Count);
    }
Пример #2
0
 void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Player" && !collisionFlag)
     {
         //Physics2D.IgnoreCollision (collision.gameObject.GetComponent<Collider2D>(), GetComponent<Collider2D>());
         collisionFlag = true;
         POCC.GameManager manager = POCC.GameManager.getInstance();
         manager.decrementHealth();
     }
 }
Пример #3
0
 /**
  * This will trigger when Pep come within the range of the enemy,
  * it will decrement the health as it is a discrete value on Pep.
  * DOUBLE CHECK THAT COLLISION2D IS OK.
  *
  * Also should probably have some kind of invulnerability period.
  * And should make him bounce somewehere.
  */
 void OnTriggerEnter2D(Collider2D pep)
 {
     Debug.Log("Trigger hit");
     if (pep.gameObject.tag == "Player")
     {
         if (!collisionFlag)
         {
             collisionFlag = true;
             POCC.GameManager manager = POCC.GameManager.getInstance();
             FindObjectOfType <AudioManager>().Play("damage");
             manager.decrementHealth();
             StartCoroutine(Knockback(0.02f, 300, pep.gameObject.transform.position, pep));
         }
     }
 }