void Update() { if (m_roof != null) { int rd = m_roof.GetComponent <Roof>().RoofDurability; if (CalcMass() >= rd) { Destroy(m_roof.gameObject); // event roof destroyed if (EventRoofDestroyed != null) { EventRoofDestroyed(); } } } if (Input.GetMouseButtonDown(0)) { Ray ray = m_camera.ScreenPointToRay(Input.mousePosition); RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction); if (hit.collider != null) { Meteor meteor = hit.collider.GetComponent <Meteor>(); if (meteor != null) { Vector2 position = meteor.gameObject.transform.position; ParticleSystem ps = meteor.GetComponentInChildren <ParticleSystem>(); ps.Play(); if (meteor.DestroyMeteor()) { Score += meteor.ScorePoints * ScoreMultiplier; m_profile.SetScore(m_score); m_meteors.Remove(meteor); BonusController bc = FindObjectOfType <BonusController>(); bc.CreateBonusActivator(position); //if (EventMeteorDestroyed != null) //{ // EventMeteorDestroyed(); //} } } BonusActivator ba = hit.collider.GetComponent <BonusActivator>(); if (ba != null) { BonusController bc = FindObjectOfType <BonusController>(); bc.AddBonus(ba.Type); Destroy(ba.gameObject); } } } }
public async Task TestCreateBonus() { Bonus bonus = new Bonus() { MinuteBonus = 100, SmsBonus = 20, DateBonus = 10, Contract = new Contract(), TipBonus = "National" }; repositoryMock.Setup(t => t.Insert(It.IsAny <Bonus>())).Verifiable(); await controller.AddBonus(bonus); repositoryMock.VerifyAll(); }