Start() public method

check missconfiguration
public Start ( ) : void
return void
Ejemplo n.º 1
0
    public TestCharacter(string name) {
      charObj = new GameObject();
      charObj.name = name;
      character = charObj.AddComponent<Character>();
      Assert.NotNull(character);
      health = charObj.GetComponent<CharacterHealth>();
      Assert.NotNull(health);
      health.Start();

      enterHitBox = charObj.CreateChild("entreAreas").AddComponent<HitBox>();
      enterHitBox.type = HitBoxType.EnterAreas;
      enterHitBox.gameObject.layer = 1;

      enterBox2D = enterHitBox.gameObject.AddComponent<BoxCollider2D>();
      enterBox2D.size = new Vector2(1, 1);
      enterHitBox.owner = health;
      enterHitBox.Start();

      dealHitBox = charObj.CreateChild("dealHitBox").AddComponent<HitBox>();
      Assert.NotNull(dealHitBox);

      dealHitBox.type = HitBoxType.DealDamage;
      dealHitBox.collideWith = (1 << 2); // | (1 << ?)
      dealHitBox.gameObject.layer = 2;
      damage = dealHitBox.gameObject.AddComponent<Damage>();
      damage.causer = health;
      damage.Start();
      dealHitBox.owner = health;

      dealBox2D = dealHitBox.gameObject.AddComponent<BoxCollider2D>();
      dealBox2D.size = new Vector2(1, 1);
      dealHitBox.Start();

      recieveHitBox = charObj.CreateChild("recieveHitBox").AddComponent<HitBox>();
      Assert.NotNull(recieveHitBox);

      recieveHitBox.type = HitBoxType.RecieveDamage;
      recieveHitBox.collideWith = (1 << 2);
      recieveHitBox.gameObject.layer = 2;
      recieveHitBox.owner = health;

      recieveBox2D = recieveHitBox.gameObject.AddComponent<BoxCollider2D>();
      recieveBox2D.size = new Vector2(1, 1);
      recieveHitBox.Start();

      // init health callbacks
      health.onHeal += () => { onHealCalled = true; };
      health.onDamage += () => { onDamageCalled = true; };
      health.onImmunity += () => { onImmunityCalled = true; };
      health.onMaxHealth += () => { onMaxHealthCalled = true; };
      health.onInjured += (Damage dt, CharacterHealth to) => { onInjuredCalled = true; };
      health.onHurt += (Damage dt, CharacterHealth to) => { onHurtCalled = true; };
      health.onDeath += () => { onDeathCalled = true; };
      health.onGameOver += () => { onGameOverCalled = true; };
      health.onInvulnerabilityStart += () => { onInvulnerabilityStartCalled = true; };
      health.onInvulnerabilityEnd += () => { onInvulnerabilityEndCalled = true; };
      health.onRespawn += () => { onRespawnCalled = true; };

    }