public void shoot(float delayBetweenShots) { //anim.SetBool("shoot",true); if (x >= delayBetweenShots) { anim.SetBool("shoot", true); RaycastHit hit; if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, range)) { Debug.Log(hit.transform.name); DummyTarget dTarget = hit.transform.GetComponent <DummyTarget>(); if (dTarget != null) { dTarget.TakeDamage(damage); } } x = 0; } else { x += Time.deltaTime; } }
public void ShouldCheckForNullIfPropertyAbsent() { // arrange var targets = new DummyTarget { A = new Mock<IObsoleteTask>().Object, B = null }; // act / assert (no exceptions) var targetsDictionary = new TargetsParser().ParseTargetsFromObject(targets); }
public override void Init() { var dummyTarget1 = new DummyTarget("DUMMY_A", "Dummy A", "DT-A"); dummyTarget1.MoveTo(1000, 0, 1000); World.AddEntity(dummyTarget1); var dummyTarget2 = new DummyTarget("DUMMY_B", "Dummy B", "DT-B"); dummyTarget2.MoveTo(-2000, 0, -2000); World.AddEntity(dummyTarget2); }
public void ShouldCheckForNullIfPropertyAbsent() { // arrange var targets = new DummyTarget { A = new Mock <IObsoleteTask>().Object, B = null }; // act / assert (no exceptions) var targetsDictionary = new TargetsParser().ParseTargetsFromObject(targets); }
public override void Init() { var dummyTarget1 = new DummyTarget("DUMMY_1", "Dummy 1", "DT-1"); dummyTarget1.MoveTo(2000, 0, 0); World.AddEntity(dummyTarget1); var dummyTarget2 = new DummyTarget("DUMMY_2", "Dummy 2", "DT-2"); dummyTarget2.MoveTo(500, 0, -3000); World.AddEntity(dummyTarget2); var dummyTarget3 = new DummyTarget("DUMMY_3", "Dummy 3", "DT-3"); dummyTarget3.MoveTo(-6000, 0, 2000); World.AddEntity(dummyTarget3); }
public DummyTargetTest() { _target = Registry.GetTarget("dummy-target") as DummyTarget; }