public void Touch(GameObject go, Gun.BulletType type = Gun.BulletType.Null, bool inverse = false) { string order = type == Gun.BulletType.Null ? go.tag : System.Enum.GetName(typeof(Gun.BulletType), type); _shapeController = _shapeController ?? GetComponentInParent <ShapeMovementController>(); _bonusMalus = _bonusMalus ?? GetComponentInChildren <BonusMalus>(); _bonusMalus?.Fire(); switch (order) { case "TurnRight": if (_shapeController.transform.position.x > go.transform.position.x) { if (!inverse) { _shapeController.RotateClockWise(true); } else { _shapeController.RotateClockWise(false); } } else { if (!inverse) { _shapeController.RotateClockWise(false); } else { _shapeController.RotateClockWise(true); } } break; case "TurnLeft": if (_shapeController.transform.position.x > go.transform.position.x) { if (!inverse) { _shapeController.RotateClockWise(true); } else { _shapeController.RotateClockWise(false); } } else { if (!inverse) { _shapeController.RotateClockWise(false); } else { _shapeController.RotateClockWise(true); } } break; case "Fall": _shapeController.InstantFall(); break; case "Move": if (_shapeController.transform.position.x > go.transform.position.x) { _shapeController.MoveHorizontal(!inverse ? ShapeMovementController.Direction.Right : ShapeMovementController.Direction.Left); } else { _shapeController.MoveHorizontal(!inverse ? ShapeMovementController.Direction.Left : ShapeMovementController.Direction.Right); } break; default: Debug.Log("collision detected but " + go.name); break; } }
public static string BM(int idCompanyMiddleman) { int idContractType = 0, idCompanyContractType = 0; List <Franchise> franchise = new List <Franchise>(); List <InsuranceZoneOfRegistration> insuranceZoneOfReg = new List <InsuranceZoneOfRegistration>(); List <bool> isLegal = new List <bool>(); List <CarInsuranceType> insuranceTypeOfCar = new List <CarInsuranceType>(); try { idContractType = ContractTypeDataManipulation.GetId("ГО"); idCompanyContractType = CompanyContractTypeDataManipulation.GetId(idCompanyMiddleman, idContractType); franchise = FranchiseDataManipulation.GetFranchises(ContractFranchiseDataManipulation.GetFranchiseIds(idCompanyContractType)); insuranceZoneOfReg = InsuranceZoneOfRegistrationDataManipulation.GetMulti(); isLegal = new List <bool> { true, false }; insuranceTypeOfCar = CarInsuranceTypeDataManipulation.GetMulti(); } catch { responseToClient.responseType = ResponseType.Bad; responseToClient.responseText = "Виникла помилка при генерації умов."; return(js.Serialize(responseToClient)); } foreach (var izor in insuranceZoneOfReg) { foreach (var il in isLegal) { foreach (var itoc in insuranceTypeOfCar) { foreach (var f in franchise) { var idContractFranchise = ContractFranchiseDataManipulation.GetId(idCompanyContractType, f.Id); if (BonusMalusDataManipulation.IsConditionExist(izor.Id, il, itoc.Id, idContractFranchise, idCompanyContractType, idCompanyMiddleman)) { var newRowBM = new BonusMalus() { IdInsuranceZoneOfReg = izor.Id, IsLegalEntity = il, IdCarInsuranceType = itoc.Id, IdContractFranchise = idContractFranchise, Value = 0, IdCompanyMiddleman = idCompanyMiddleman, }; try { BonusMalusDataManipulation.Insert(newRowBM); } catch { responseToClient.responseType = ResponseType.Bad; responseToClient.responseText = $"Виникла помилка при генерації запису для умов: \"{izor.Name}\"; \"{il}\"; \"{itoc.Type}\"; \"{f.Sum}\"."; return(js.Serialize(responseToClient)); } } } } } } responseToClient.responseType = ResponseType.Good; responseToClient.responseText = "Генерація даних пройшла успішно."; return(js.Serialize(responseToClient)); }
public static void Insert(BonusMalus newRecord) { db.BonusMalus.Add(newRecord); db.SaveChanges(); }