void Select(GameObject go) { switch (go.name) { case "TornadoShell": TornadoController tc = go.GetComponentInParent <TornadoController> (); tc.isSelected = true; break; case "CarShell": EmptyCarController ecc = go.GetComponentInParent <EmptyCarController> (); ecc.isSelected = true; break; case "SharkShell": EmptySharkController esc = go.GetComponentInParent <EmptySharkController> (); esc.isSelected = true; break; case "CowShell": CowController cc = go.GetComponentInParent <CowController> (); cc.isSelected = true; break; case "Barn": EmptyBarnController ebc = go.GetComponentInParent <EmptyBarnController> (); ebc.isSelected = true; break; } }
// Use this for initialization void Start () { rb = GetComponent<Rigidbody2D>(); boxCollider = GetComponent<BoxCollider2D>(); playerText = GameObject.Find("Zaal").GetComponent<PlayerText>(); dayController = GameObject.Find("GameManager").GetComponent<DayController>(); cowController = GameObject.Find("CowContainer").GetComponent<CowController>(); cowActions = new CowAction[4]; cowActions[0] = () => { }; cowActions[1] = cowController.AccelerateCows; cowActions[2] = cowController.ReverseCows; cowActions[3] = cowController.AlternateCowPaths; GameObject planeObject = GameObject.Find("PlaneContainer"); planeActions = new PlaneAction[4]; if (planeObject != null) { planeController = planeObject.GetComponent<PlaneController>(); planeActions[0] = () => { }; planeActions[1] = planeController.AcceleratePlane; planeActions[2] = planeController.ReversePlane; planeActions[3] = planeController.AlternatePlanePath; } }
void _MakeInstance() { if (instance == null) { instance = this; } }
private void spawn(string spawnLayerName) { var spawn_layer = map.getObjectGroup(spawnLayerName); for (var i = 0; i < spawn_layer.objects.Length; i++) { var obj = spawn_layer.objects[i]; var objPosition = new Vector2(obj.position.X + obj.width / 2, obj.position.Y + obj.height / 2); switch (obj.type) { case "BurglarSpawn": { var burglar = new Burglar(); burglar.transform.position = objPosition; Core.scene.addEntity(burglar); break; } case "CowSpawn": { var orientation = CowController.Orientation.Right; if (obj.properties.ContainsKey("orientation")) { orientation = CowController.getOrientationFromName(obj.properties["orientation"]); } var cow = new Cow(orientation: orientation); cow.transform.position = objPosition; cow.name = obj.name; Core.scene.addEntity(cow); break; } case "BullSpawn": { var orientation = CowController.Orientation.Right; if (obj.properties.ContainsKey("orientation")) { orientation = CowController.getOrientationFromName(obj.properties["orientation"]); } var bull = new Bull(orientation: orientation); bull.transform.position = objPosition; bull.name = obj.name; Core.scene.addEntity(bull); break; } case "IdolSpawn": { var idol = new Idol(); idol.transform.position = objPosition; Core.scene.addEntity(idol); break; } default: break; } } }
public void CaptureCow(GameObject cow) { CowController captueredCow = cow.GetComponent <CowController>(); CapturedCows.Push(captueredCow.cow); Destroy(cow); GameObject.FindWithTag(TagConstants.MissionStatus).GetComponent <MissionStatus>().UpdateInventoryCow(captueredCow.cow); }
public override void onAddedToScene() { base.onAddedToScene(); tag = (int)Tags.Cow; controller = addComponent(new CowController() { orientation = orientation }); }
public override void onAddedToScene() { base.onAddedToScene(); tag = (int)Tags.Bull; controller = addComponent(new CowController() { orientation = orientation, watchForDistractions = false }); }
public void CowRead_ExceptionThrown_BadRequest() { var storage = A.Fake <IStorage>(); var controller = new CowController(storage); A.CallTo(() => storage.Read(A <string> .Ignored)).Throws <ArgumentException>(); var result = controller.CowRead(A.Dummy <string>()).Result; Assert.IsType <BadRequestResult>(result); }
public void CowRead_ValidEarTag_OkResult() { // We mock the storage because it is an external dependency // When unit testing it is very important to mock out external dependencies (Dependencies that are dependency injected). // If we dont do it, it is an integration test and not a unit test. var storage = A.Fake <IStorage>(); // In this case we test the CowRead method so we dont need to mock it. var sut = new CowController(storage); // Here we call the method getting the result for assertion. var result = sut.CowRead(A.Dummy <string>()).Result; // We test the returned type is correct here, because we are testing an API controller returning http200. Assert.IsType <OkObjectResult>(result); }
// Use this for initialization void Start() { transform.position = Vector3.zero; tc = GetComponentInChildren <TornadoController> (); ecc = GetComponentInChildren <EmptyCarController> (); esc = GetComponentInChildren <EmptySharkController> (); sc = GetComponentInChildren <SharkController> (); cc = GetComponentInChildren <CowController> (); ebc = GetComponentInChildren <EmptyBarnController> (); sbc = GetComponentInChildren <SpinBarnController> (); tornado = GameObject.Find("Tornado"); car = GameObject.Find("Car"); emptyCar = GameObject.Find("EmptyCar"); shark = GameObject.Find("Shark"); emptyShark = GameObject.Find("EmptyShark"); emptySpin = GameObject.Find("EmptySpin"); emptyBarn = GameObject.Find("EmptyBarn"); tornadoOldSpeed = 0; carOldSpeed = 0; sharkOldSpeed = 0; sharkOldOsciSpeed = 0; barnOldSpeed = 0; barnOldSpinSpeed = 0; cowOldSpeed = 0; allPaused = false; barnPaused = false; sharkPaused = false; carPaused = false; windowRect = new Rect(0, 0, 600, 200); tornadoScale = 1.0F; barnRotateSpeed = 40.0f; barnSpinSpeed = 100.0F; sharkRotateSpeed = 60.0f; sharkOsciSpeed = 30.0f; sharkOsciRange = 8.0F; carRotateSpeed = 30.0F; carDirection = 180.0F; }