private void Update() { if (!modEnabled.Value || AedenthornUtils.IgnoreKeyPresses(true)) { return; } if (AedenthornUtils.CheckKeyDown(hotKey.Value)) { float closest = attachDistance.Value; Vagon closestVagon = null; Vector3 position = Player.m_localPlayer.transform.position + Vector3.up; foreach (Collider collider in Physics.OverlapSphere(position, attachDistance.Value)) { Vagon v = collider.transform.parent.gameObject.GetComponent <Vagon>(); if (collider?.attachedRigidbody && v != null && Vector3.Distance(collider.ClosestPoint(position), position) < closest && (v.IsAttached(Player.m_localPlayer) || !v.InUse())) { Dbgl("Got nearby cart"); closest = Vector3.Distance(collider.ClosestPoint(position), position); closestVagon = collider.transform.parent.gameObject.GetComponent <Vagon>(); } } if (closestVagon != null) { closestVagon.Interact(Player.m_localPlayer, false, false); } } }
static void Prefix(ref Vagon __instance, ref ConfigurableJoint ___m_attachJoin, ref Rigidbody ___m_body) { if (___m_attachJoin != null && ___m_attachJoin.connectedBody == null) { __instance.Detach(); } }
/// <summary> /// Helper method to access the character currently attached to a cart /// </summary> /// <param name="cart"></param> /// <returns>Character currently attached</returns> static Character AttachedCharacter(Vagon cart) { if (cart && cart.IsAttached()) { return(cart.m_attachJoin.connectedBody.gameObject.GetComponent <Character>()); } return(null); }
static bool Prefix(Vagon __instance, GameObject go, ref bool __result) { if (!modEnabled.Value || !allowOutOfPlaceAttach.Value || __instance.transform.up.y < 0.1f || go != Player.m_localPlayer.gameObject) { return(true); } __result = !Player.m_localPlayer.IsTeleporting() && !Player.m_localPlayer.InDodge() && Vector3.Distance(go.transform.position + __instance.m_attachOffset, __instance.m_attachPoint.position) < attachDistance.Value; return(false); }
static bool Prefix(Vagon __instance) { if (!__instance.m_nview.IsValid()) { logger.LogDebug("m_nview invalid"); return(false); } // Attempt to attach the cart __instance.UpdateAudio(Time.fixedDeltaTime); if (__instance.m_nview.IsOwner()) { if ((bool)__instance.m_useRequester) { if (__instance.IsAttached()) { // If attached detach __instance.Detach(); } else { /// Determine if there is a valid animal in range and if so attempt to attach to it. /// If not attempt to attach to player Character closest_tamed = FindClosestAttachableAnimal(__instance); if (closest_tamed != null) { AttachCartTo(closest_tamed, __instance); } else if (__instance.CanAttach(__instance.m_useRequester.gameObject)) { AttachCartTo(__instance.m_useRequester, __instance); } else { __instance.m_useRequester.Message(MessageHud.MessageType.Center, "Not in the right position"); } } __instance.m_useRequester = null; } if (__instance.IsAttached()) { // Update detach distance before check if it should be detached __instance.m_detachDistance = GetCartDetachDistance(AttachedCharacter(__instance)); if (!__instance.CanAttach(((Component)(object)((Joint)__instance.m_attachJoin).connectedBody).gameObject)) { __instance.Detach(); logger.LogDebug("Cart no longer attachable."); } } } else if (__instance.IsAttached()) { __instance.Detach(); } return(false); }
/// <summary> /// Logs the contents of a given cart to the debug logger. /// Used during debugging to easily differentiate between carts. /// </summary> /// <param name="cart"></param> static void LogCartContents(Vagon cart) { Container c = cart.m_container; logger.LogDebug($"Cart contents:"); foreach (ItemDrop.ItemData item in c.GetInventory().GetAllItems()) { logger.LogDebug($"\t * {item.m_shared.m_name}"); } }
public EntidadBase BuildObject(Dictionary <string, object> row) { var vagon = new Vagon { IdVagon = GetIntValue(row, DB_COL_COD_VAGON), CantAsientos = GetIntValue(row, DB_COL_COD_CANT_ASIENTOS), IdTren = GetIntValue(row, DB_COL_COD_TREN) }; return(vagon); }
public void DeleteVagon(Vagon vagon) { if (!string.IsNullOrEmpty(vagon.IdVagon + "")) { _crudFactory.Delete(vagon); gestorAccion.delete(AccionPara); } else { //throw gestor.ControlarExcepcion(new ErpException(ErpException.ExceptionCode.NoHaSeleccionadoCliente)); } }
public void Insertar(Vagon nuevo) { if (first == null) { first = nuevo; } else { last.siguiente = nuevo; } last = nuevo; }
public Vagon Buscar(int n) { Vagon actual = first; while (actual != null) { if (actual.Codigo == n) { return(actual); } actual = actual.siguiente; } return(null); }
static bool Prefix(ref bool __result, ref Vagon __instance) { if ((bool)__instance.m_container && __instance.m_container.IsInUse()) { __result = true; } else if (__instance.IsAttached()) { __result = (bool)__instance.m_attachJoin.connectedBody.gameObject.GetComponent <Player>(); } else { __result = false; } return(false); }
/// <summary> /// Searches nearby animals and finds the closest one to the cart that could be attached. /// </summary> /// <param name="cart"></param> /// <returns>Closest character to the cart that can attach to it, null if no character available</returns> static Character FindClosestAttachableAnimal(Vagon cart) { if (!cart) { logger.LogError("Cart pointer is null"); return(null); } Transform attachPoint = cart.m_attachPoint; Character closest_animal = null; float closest_distance = float.MaxValue; if (!cart.m_attachPoint) { logger.LogError("cart.m_attachPoint is null."); return(null); } foreach (Character currentCharacter in Character.GetAllCharacters()) { if (currentCharacter) { if (!currentCharacter.IsPlayer() && currentCharacter.IsTamed() && IsAttachableCharacter(currentCharacter)) { Vector3 cartOffset = GetCartOffsetVectorForCharacter(currentCharacter); Vector3 animalPosition = currentCharacter.transform.position; float distance = Vector3.Distance(animalPosition + cartOffset, attachPoint.position); float detachDistance = GetCartDetachDistance(currentCharacter); if (distance < detachDistance && distance < closest_distance) { closest_animal = currentCharacter; closest_distance = distance; } } } else { logger.LogWarning("null character returned by Character.GetAllCharacter() in method FindClosestTamedAnimal"); } } if (closest_animal != null) { logger.LogDebug($"Closest animal is {closest_animal.m_name} at a distance of {closest_distance}"); } return(closest_animal); }
public void Mostrar() { if (first != null) { Vagon actual = first; while (actual != null) { Console.Write("\nTren Destino: {0}\n", destino); actual.Mostrar(); actual.MostrarVagon(); actual = actual.siguiente; } } else { Console.WriteLine("\nEl Tren Está Vacío"); } }
public List <EntidadBase> BuildObjects(List <Dictionary <string, object> > lstRows) { var lstResults = new List <EntidadBase>(); foreach (var row in lstRows) { var vagon = new Vagon { IdVagon = GetIntValue(row, DB_COL_COD_VAGON), CantAsientos = GetIntValue(row, DB_COL_COD_CANT_ASIENTOS), IdTren = GetIntValue(row, DB_COL_COD_TREN) }; lstResults.Add(vagon); } return(lstResults); }
public void CreateVagon(Vagon vagon) { if (!string.IsNullOrEmpty(vagon.IdTren + "")) { _crudFactory.Create(vagon); Vagon v = obtenerUltimoVagonRegistrado(); v.crearAsientos(); for (int i = 0; i < vagon.CantAsientos; i++) { _gestorAsiento.CreateAsiento(v.listaAsientos.ElementAt(i)); } gestorAccion.Create(AccionPara); } else { throw new Exception(); } }
static void Prefix(Vagon __instance, ZNetView ___m_nview, ref float mass) { if (!modEnabled.Value || !___m_nview.IsOwner()) { return; } float before = mass; List <Player> players = new List <Player>(); Player.GetPlayersInRange(__instance.gameObject.transform.position, playerRange.Value, players); if (players.Count > (includePuller.Value ? 0 : 1)) { mass = Mathf.Max(0, mass - mass * playerMassReduction.Value * Mathf.Min(maxPlayers.Value, players.Count - (includePuller.Value ? 0 : 1))); } //Dbgl($"mass players {players.Count} distance {Vector3.Distance(__instance.gameObject.transform.position, Player.m_localPlayer.transform.position)} before {before} after {mass} is owner {___m_nview.IsOwner()}"); }
private bool addVagon() { Vagon bs = new Vagon(); bs.Type = (comboBox1.SelectedItem as VihecalType).name; bs.LastCheck = dateTimePicker1.Value; bs.CurrentCond = textBox1.Text; int psg; if (!int.TryParse(textBox2.Text, out psg)) { return(false); } bs.NumOfPassengers = psg; var trs = TransportModel.GetTransport(bs.Type); bs.Transport = new MongoDB.Driver.MongoDBRef("Transport", trs.Id); VehicalModel.AddVehical(bs); return(true); }
public static void InitVehical() { var connectionString = "mongodb://localhost/?safe=true"; var server = MongoServer.Create(connectionString); var db = server.GetDatabase("TransportSystem"); var collectionV = db.GetCollection <TimeTable>("Vehical"); Bus v = new Bus() { CurrentCond = "active", LastCheck = DateTime.Now, NumOfPassengers = 58, Type = "Bus" }; collectionV.Insert(v); Locomotiva v1 = new Locomotiva() { CurrentCond = "active", LastCheck = DateTime.UtcNow, MaximumPulingCapacity = 290.65, Type = "Voz" }; Vagon v2 = new Vagon() { CurrentCond = "active", LastCheck = DateTime.Now, NumOfPassengers = 30, Type = "Voz" }; Vagon v3 = new Vagon() { CurrentCond = "error", LastCheck = DateTime.Now, NumOfPassengers = 40, Type = "Voz" }; collectionV.Insert(v2); collectionV.Insert(v3); v1.Vagons.Add(new MongoDBRef("Vehical", v2.Id)); v1.Vagons.Add(new MongoDBRef("Vehical", v3.Id)); collectionV.Insert(v1); v2.Logomotiva = new MongoDBRef("Vehical", v1.Id); v3.Logomotiva = new MongoDBRef("Vehical", v1.Id); collectionV.Save(v2); collectionV.Save(v1); }
private static Boolean Prefix(ref Vagon __instance) { if (!__instance.m_nview.IsOwner()) { return(false); } if (__instance.m_container == null) { return(false); } float totalWeight = 0; if (Configuration.Current.Wagon.IsEnabled) { totalWeight = Helper.applyModifierValue(__instance.m_container.GetInventory().GetTotalWeight(), Configuration.Current.Wagon.wagonExtraMassFromItems); } else { totalWeight = __instance.m_container.GetInventory().GetTotalWeight(); } if (Configuration.Current.Wagon.IsEnabled) { __instance.m_baseMass = Configuration.Current.Wagon.wagonBaseMass; } else { __instance.m_baseMass = 20; } float mass = __instance.m_baseMass + totalWeight * __instance.m_itemWeightMassFactor; __instance.SetMass(mass); return(false); }
// Token: 0x06000FDE RID: 4062 RVA: 0x0006FAEC File Offset: 0x0006DCEC private void AttachTo(GameObject go) { Vagon.DetachAll(); this.m_attachJoin = base.gameObject.AddComponent <ConfigurableJoint>(); this.m_attachJoin.autoConfigureConnectedAnchor = false; this.m_attachJoin.anchor = this.m_attachPoint.localPosition; this.m_attachJoin.connectedAnchor = this.m_attachOffset; this.m_attachJoin.breakForce = this.m_breakForce; this.m_attachJoin.xMotion = ConfigurableJointMotion.Limited; this.m_attachJoin.yMotion = ConfigurableJointMotion.Limited; this.m_attachJoin.zMotion = ConfigurableJointMotion.Limited; SoftJointLimit linearLimit = default(SoftJointLimit); linearLimit.limit = 0.001f; this.m_attachJoin.linearLimit = linearLimit; SoftJointLimitSpring linearLimitSpring = default(SoftJointLimitSpring); linearLimitSpring.spring = this.m_spring; linearLimitSpring.damper = this.m_springDamping; this.m_attachJoin.linearLimitSpring = linearLimitSpring; this.m_attachJoin.zMotion = ConfigurableJointMotion.Locked; this.m_attachJoin.connectedBody = go.GetComponent <Rigidbody>(); }
/// <summary> /// This method is similar to Vagon.AttachTo except we don't call DetachAll as the first operation. /// </summary> /// <param name="attachTarget"></param> /// <param name="cart"></param> static void AttachCartTo(Character attachTarget, Vagon cart) { cart.m_attachOffset = GetCartOffsetVectorForCharacter(attachTarget); cart.m_attachJoin = cart.gameObject.AddComponent <ConfigurableJoint>(); ((Joint)cart.m_attachJoin).autoConfigureConnectedAnchor = false; ((Joint)cart.m_attachJoin).anchor = cart.m_attachPoint.localPosition; ((Joint)cart.m_attachJoin).connectedAnchor = cart.m_attachOffset; ((Joint)cart.m_attachJoin).breakForce = cart.m_breakForce; cart.m_attachJoin.xMotion = ((ConfigurableJointMotion)1); cart.m_attachJoin.yMotion = ((ConfigurableJointMotion)1); cart.m_attachJoin.zMotion = ((ConfigurableJointMotion)1); SoftJointLimit linearLimit = default(SoftJointLimit); linearLimit.limit = 0.001f; cart.m_attachJoin.linearLimit = linearLimit; SoftJointLimitSpring linearLimitSpring = default(SoftJointLimitSpring); linearLimitSpring.spring = cart.m_spring; linearLimitSpring.damper = cart.m_springDamping; cart.m_attachJoin.linearLimitSpring = linearLimitSpring; cart.m_attachJoin.zMotion = ((ConfigurableJointMotion)0); cart.m_attachJoin.connectedBody = (attachTarget.gameObject.GetComponent <Rigidbody>()); }
private void TimerTick(object sender, EventArgs e) { if (Management.Pohyb) { krok++; Thickness pozice = train.Pohybovani(x, y); //aktualní pozice vlaku se uloží do thickness int cRadku = Convert.ToInt32(pozice.Top) / 50; int cSloupce = Convert.ToInt32(pozice.Left) / 50; kroky.Content = "Kroky: " + krok; Vagon vagony = rozlozeni.precti(cRadku, cSloupce); if (vagony != null) { rozlozeni.precti(cRadku, cSloupce).Seber(x, y, cRadku, cSloupce); rozlozeni.nastav(cRadku, cSloupce, null); mamvagon = true; Management.Skore += 10; Skore.Content = "Skore: " + Management.Skore; if (Management.Sebrano) { Gate.otevrise(); } } else { if (mamvagon) { train.Pripoj(cRadku, cSloupce, x, y); vagonek.prehod(); if (pozice.Top == Brana.brana1.Margin.Top && pozice.Left == Brana.brana1.Margin.Left) //výhra pokud je dodržena podmínka { casvlak.Stop(); vyhra = false; } } } } else { casvlak.Stop(); odpoved = MessageBox.Show("Prohrál jsi! Přeješ znovu začít hru ? ", +level + ".scena", MessageBoxButton.YesNo); switch (odpoved) { case MessageBoxResult.Yes: Zacatek(); break; case MessageBoxResult.No: if (!Management.createditor) { skoreV2 = Management.Skore; } pole.Visibility = Visibility.Hidden; menu.Visibility = Visibility.Visible; start = false; video.Play(); Kurzor(); break; } } }
static void Main(string[] args) { short op; int bol = 0; Estacion e = new Estacion(); Tren t; Vagon v; Persona p; do { Console.WriteLine("\nESTACION DE TREN\n "); Console.WriteLine("1. Ingresar Pasajero"); Console.WriteLine("2. Mostrar Todos Los Pasajeros"); Console.WriteLine("3. Buscar Pasajero"); Console.WriteLine("4. Bajar Pasajero"); Console.WriteLine("5. Salir"); Console.Write("Ingrese Opción: "); op = short.Parse(Console.ReadLine()); switch (op) { case 1: Console.Write("\nIngrese Destino Del Viaje: "); string dv = Console.ReadLine(); t = e.Buscar(dv); if (t == null) { Console.Write("\nTren Inexistente Con Este Destino...\nSe Creara Nuevo Destino - {0}\n", dv); t = new Tren(dv); e.Insertar(t); } Console.Write("\nIngrese Número De Vagon: "); int nv = int.Parse(Console.ReadLine()); v = t.Buscar(nv); if (v == null) { v = new Vagon(nv); t.Insertar(v); } Console.Write("Ingrese Nombre: "); string n = Console.ReadLine(); Console.Write("Ingrese Sexo: "); string s = Console.ReadLine(); p = new Persona(bol, n, s); v.Insertar(p); bol++; break; case 2: e.Mostrar(); break; case 3: Console.Write("\nIngrese Destino Del Tren: "); string d = Console.ReadLine(); t = e.Buscar(d); if (t != null) { Console.Write("Ingrese Codigo de Vagón: "); int c = int.Parse(Console.ReadLine()); v = t.Buscar(c); if (v != null) { Console.Write("Ingrese N° De Boleto: "); int b = int.Parse(Console.ReadLine()); p = v.Buscar(b); if (p != null) { Console.Write("\n"); p.Mostrar(); } else { Console.Write("\nPasajero No Existe\n"); } } else { Console.Write("\nVagón No Existe\n"); } } else { Console.Write("\nTren No Existe\n"); } break; case 4: Console.Write("Ingrese Destino De Tren Para Bajar: "); d = Console.ReadLine(); t = e.Buscar(d); if (t != null) { Console.Write("Ingrese Codigo de Vagón: "); int c = int.Parse(Console.ReadLine()); v = t.Buscar(c); if (v != null) { Console.Write("Ingrese N° De Boleto:"); int b = int.Parse(Console.ReadLine()); p = v.Buscar(b); if (p != null) { Console.Write("\n"); v.Eliminar(b); } else { Console.Write("\nPasajero No Existe\n"); } } else { Console.Write("\nVagón No Existe\n"); } } else { Console.Write("\nTren No Existe\n"); } break; case 5: Console.WriteLine("\nFin del Programa"); Console.ReadLine(); break; default: Console.WriteLine("\nOpción No Valida"); break; } } while (op != 5); }
public Train() { vagonLeft = new Vagon(0); vagonMiddle = new Vagon(1); vagonRight = new Vagon(2); }
protected override void Seed(ProjectDb.EF.ApplicationDbContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // var userManager = new AppUserManager(new UserStore <ApplicationUser>(context)); var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(context)); // создаем две роли var role1 = new IdentityRole { Name = "admin" }; var role2 = new IdentityRole { Name = "user" }; // добавляем роли в бд roleManager.Create(role1); roleManager.Create(role2); // создаем пользователей var admin = new ApplicationUser { Email = "*****@*****.**", UserName = "******" }; string password = "******"; var result = userManager.Create(admin, password); // если создание пользователя прошло успешно if (result.Succeeded) { // добавляем для пользователя роль userManager.AddToRole(admin.Id, role1.Name); userManager.AddToRole(admin.Id, role2.Name); } Station s4 = new Station { Name = "Запорожье", ArrivingTime = new DateTime(2019, 11, 1, 14, 15, 0), DepartureTime = new DateTime(2019, 11, 1, 15, 30, 0) }; Station s1 = new Station { Name = "Харьков", ArrivingTime = new DateTime(2019, 11, 1, 8, 15, 0), DepartureTime = new DateTime(2019, 11, 1, 9, 30, 0) }; Station s3 = new Station { Name = "Павлоград", ArrivingTime = new DateTime(2019, 11, 1, 14, 15, 0), DepartureTime = new DateTime(2019, 11, 1, 14, 20, 0) }; Station s2 = new Station { Name = "Красноград", ArrivingTime = new DateTime(2019, 11, 1, 10, 25, 0), DepartureTime = new DateTime(2019, 11, 1, 10, 30, 0) }; Station s5 = new Station { Name = "Одесса", ArrivingTime = new DateTime(2019, 11, 11, 10, 15, 0), DepartureTime = new DateTime(2019, 11, 11, 11, 30, 0) }; Station s7 = new Station { Name = "Николаев", ArrivingTime = new DateTime(2019, 12, 8, 18, 15, 0), DepartureTime = new DateTime(2019, 12, 8, 18, 30, 0) }; Station s6 = new Station { Name = "Херсон", ArrivingTime = new DateTime(2019, 12, 8, 15, 15, 0), DepartureTime = new DateTime(2019, 12, 8, 16, 30, 0) }; Station s8 = new Station { Name = "Хмельницкий", ArrivingTime = new DateTime(2019, 12, 9, 9, 15, 0), DepartureTime = new DateTime(2019, 12, 9, 10, 30, 0) }; Station s9 = new Station { Name = "Хмельницкий", ArrivingTime = new DateTime(2019, 11, 11, 19, 15, 0), DepartureTime = new DateTime(2019, 11, 11, 19, 30, 0) }; Station s10 = new Station { Name = "Львов", ArrivingTime = new DateTime(2019, 11, 12, 14, 55, 0), DepartureTime = new DateTime(2019, 11, 12, 16, 0, 0) }; context.Stations.AddRange(new List <Station> { s1, s2, s3, s4, s5, s6, s7, s8, s9, s10 }); context.SaveChanges(); Route r1 = new Route { Stations = new List <Station>() }; r1.Stations.AddRange(new List <Station> { s1, s2, s3, s4 }); Route r2 = new Route { Stations = new List <Station>() }; r2.Stations.AddRange(new List <Station> { s6, s7, s8 }); Route r3 = new Route { Stations = new List <Station>() }; r3.Stations.AddRange(new List <Station> { s5, s9, s10 }); context.Routes.AddRange(new List <Route> { r1, r2, r3 }); context.SaveChanges(); Train t1 = new Train { Id = r1.Id, Number = 231, Price = 120m, Route = r1 }; Train t2 = new Train { Id = r2.Id, Number = 501, Price = 90m, Route = r2 }; Train t3 = new Train { Id = r3.Id, Number = 873, Price = 115m, Route = r3 }; context.Trains.AddRange(new List <Train> { t1, t2, t3 }); context.SaveChanges(); Vagon v1 = new Vagon { Number = 1, Places = 100, Type = "Плацкарт", Train = t1, BusyPaces = 100 }; Vagon v2 = new Vagon { Number = 2, Places = 80, Type = "Купе", Train = t1, BusyPaces = 57 }; Vagon v3 = new Vagon { Number = 3, Places = 100, Type = "Плацкарт", Train = t1 }; Vagon v4 = new Vagon { Number = 1, Places = 90, Type = "Общий", Train = t2 }; Vagon v5 = new Vagon { Number = 2, Places = 70, Type = "Купе", Train = t2, BusyPaces = 70 }; Vagon v6 = new Vagon { Number = 3, Places = 76, Type = "Купе", Train = t2 }; Vagon v7 = new Vagon { Number = 1, Places = 87, Type = "Общий", Train = t3, BusyPaces = 50 }; Vagon v8 = new Vagon { Number = 2, Places = 100, Type = "Плацкарт", Train = t3 }; context.Vagons.AddRange(new List <Vagon> { v1, v2, v3, v4, v5, v6, v7, v8, }); context.SaveChanges(); }
public Vagon(int codigo) { this.codigo = codigo; first = last = null; siguiente = null; }
private Vagon obtenerUltimoVagonRegistrado() { Vagon v = _crudFactory.obtenerUltimoVagonRegistrado(); return(v); }
private static void doMeleeAttack(Humanoid ___m_character, ItemDrop.ItemData ___m_weapon, Attack __instance, EffectList ___m_hitEffect, Skills.SkillType ___m_specialHitSkill, DestructibleType ___m_specialHitType, bool ___m_lowerDamagePerHit, float ___m_forceMultiplier, float ___m_staggerMultiplier, float ___m_damageMultiplier, int ___m_attackChainLevels, int ___m_currentAttackCainLevel, DestructibleType ___m_resetChainIfHit, ref int ___m_nextAttackChainLevel, EffectList ___m_hitTerrainEffect, float ___m_attackHitNoise, Vector3 pos, Collider col, Vector3 dir, GameObject ___m_spawnOnTrigger) { Vector3 zero = Vector3.zero; bool flag2 = false; //rename HashSet <Skills.SkillType> skillTypeSet = new HashSet <Skills.SkillType>(); bool hitOccured = false; ___m_weapon.m_shared.m_hitEffect.Create(pos, Quaternion.identity); ___m_hitEffect.Create(pos, Quaternion.identity); GameObject hitObject = Projectile.FindHitObject(col); if (!(hitObject == ___m_character.gameObject)) { Vagon component1 = hitObject.GetComponent <Vagon>(); if (!component1 || !component1.IsAttached(___m_character)) { Character component2 = hitObject.GetComponent <Character>(); if (!(component2 != null) || (___m_character.IsPlayer() || BaseAI.IsEnemy(___m_character, component2)) && (!___m_weapon.m_shared.m_dodgeable || !component2.IsDodgeInvincible())) { hitOccured = true; } } } if (!hitOccured) { return; } IDestructible component = hitObject.GetComponent <IDestructible>(); if (component != null) { DestructibleType destructibleType = component.GetDestructibleType(); Skills.SkillType skill = ___m_weapon.m_shared.m_skillType; if (___m_specialHitSkill != Skills.SkillType.None && (destructibleType & ___m_specialHitType) != DestructibleType.None) { skill = ___m_specialHitSkill; } float randomSkillFactor = ___m_character.GetRandomSkillFactor(skill); if (___m_lowerDamagePerHit) { randomSkillFactor /= 0.75f; } HitData hitData = new HitData(); hitData.m_toolTier = ___m_weapon.m_shared.m_toolTier; hitData.m_statusEffect = ___m_weapon.m_shared.m_attackStatusEffect ? ___m_weapon.m_shared.m_attackStatusEffect.name : ""; hitData.m_pushForce = ___m_weapon.m_shared.m_attackForce * randomSkillFactor * ___m_forceMultiplier; hitData.m_backstabBonus = ___m_weapon.m_shared.m_backstabBonus; hitData.m_staggerMultiplier = ___m_staggerMultiplier; hitData.m_dodgeable = ___m_weapon.m_shared.m_dodgeable; hitData.m_blockable = ___m_weapon.m_shared.m_blockable; hitData.m_skill = skill; hitData.m_damage = ___m_weapon.GetDamage(); hitData.m_point = pos; hitData.m_dir = dir; hitData.m_hitCollider = col; hitData.SetAttacker(___m_character); hitData.m_damage.Modify(___m_damageMultiplier); hitData.m_damage.Modify(randomSkillFactor); hitData.m_damage.Modify((float)getLevelDamageFactorMethod.Invoke(__instance, null)); if (___m_attackChainLevels > 1 && ___m_currentAttackCainLevel == ___m_attackChainLevels - 1) { hitData.m_damage.Modify(2f); hitData.m_pushForce *= 1.2f; } hitData.m_damage.Modify(MeshCooldown.calcDamageMultiplier()); ___m_character.GetSEMan().ModifyAttack(skill, ref hitData); if (component is Character) { flag2 = true; } component.Damage(hitData); if ((destructibleType & ___m_resetChainIfHit) != DestructibleType.None) { ___m_nextAttackChainLevel = 0; } skillTypeSet.Add(skill); } ___m_weapon.m_shared.m_hitTerrainEffect.Create(pos, Quaternion.identity); // Quaternion.identity might need to be replaced ___m_hitTerrainEffect.Create(pos, Quaternion.identity); if (___m_weapon.m_shared.m_spawnOnHitTerrain) { spawnOnHitTerrainMethod.Invoke(__instance, new object[] { pos, ___m_weapon.m_shared.m_spawnOnHitTerrain }); } if (___m_weapon.m_shared.m_useDurability && ___m_character.IsPlayer()) { ___m_weapon.m_durability -= ___m_weapon.m_shared.m_useDurabilityDrain; } ___m_character.AddNoise(___m_attackHitNoise); if (___m_weapon.m_shared.m_spawnOnHit) { Object.Instantiate(___m_weapon.m_shared.m_spawnOnHit, pos, Quaternion.identity).GetComponent <IProjectile>() ?.Setup(___m_character, zero, ___m_attackHitNoise, null, ___m_weapon); } foreach (Skills.SkillType skill in skillTypeSet) { ___m_character.RaiseSkill(skill, flag2 ? 1.5f : 1f); } if (!___m_spawnOnTrigger) { return; } Object.Instantiate(___m_spawnOnTrigger, zero, Quaternion.identity).GetComponent <IProjectile>()?.Setup(___m_character, ___m_character.transform.forward, -1f, null, ___m_weapon); return; }
private void Zacatek() { if (level != 15) { int vlevo = 0; int nahoru = -50; Management.maxskore = 0; Hranice.wall.Clear(); Vagon.SmazVse(); Management.Pohyb = true; mamvagon = false; vyhra = true; pole.Children.Clear(); pole.Children.Add(kroky); pole.Children.Add(Skore); krok = 0; kroky.Content = "Kroky: " + krok; scena.Content = $"Scena " + level; rozlozeni = new Mapa(); //LEVELOVÁNÍ if (!Management.createditor) { if (Management.Skore == 0) //pokud přešel z editoru načte jeho skore zpátky { Management.maxskore += skoreV2; Management.Skore = skoreV2; } else { Management.maxskore += Management.Skore; } cti = new StreamReader(@"../../sceny/level" + level + ".txt"); string name = cti.ReadLine(); jmenolevelu.Content = name; pole.Children.Add(jmenolevelu); pole.Children.Add(scena); } else { Management.Skore = 0; editorG.Visibility = Visibility.Hidden; pole.Visibility = Visibility.Visible; paleta.Visibility = Visibility.Hidden; cti = new StreamReader(@"../../sceny/costumlevl.txt"); } Skore.Content = "Skore: " + Management.Skore; //načítaní z textového souboru for (int i = 0; i < 14; i++) { nahoru += 50; vlevo = 0; string[] objekty = cti.ReadLine().Split(' '); for (int j = 0; j < 21; j++) { switch (objekty[j]) { case "1": vagonek = new Vagon(vlevo, nahoru, "diamond"); rozlozeni.nastav(nahoru / 50, vlevo / 50, vagonek); Management.maxskore += 10; break; case "2": vagonek = new Vagon(vlevo, nahoru, "koruna"); rozlozeni.nastav(nahoru / 50, vlevo / 50, vagonek); Management.maxskore += 10; break; case "3": vagonek = new Vagon(vlevo, nahoru, "strom"); rozlozeni.nastav(nahoru / 50, vlevo / 50, vagonek); Management.maxskore += 10; break; case "j": vagonek = new Vagon(vlevo, nahoru, "jablko"); rozlozeni.nastav(nahoru / 50, vlevo / 50, vagonek); Management.maxskore += 10; break; case "e": vagonek = new Vagon(vlevo, nahoru, "emerald"); rozlozeni.nastav(nahoru / 50, vlevo / 50, vagonek); Management.maxskore += 10; break; case "t": vagonek = new Vagon(vlevo, nahoru, "tresen"); rozlozeni.nastav(nahoru / 50, vlevo / 50, vagonek); Management.maxskore += 10; break; case "r": vagonek = new Vagon(vlevo, nahoru, "redstone"); rozlozeni.nastav(nahoru / 50, vlevo / 50, vagonek); Management.maxskore += 10; break; case "f": vagonek = new Vagon(vlevo, nahoru, "ryba"); rozlozeni.nastav(nahoru / 50, vlevo / 50, vagonek); Management.maxskore += 10; break; case "9": Wall = new Hranice(vlevo, nahoru); break; case "B": Gate = new Brana(pole, vlevo, nahoru); break; case "V": train = new vlak(vlevo, nahoru); break; case "z": vagonek = new Vagon(vlevo, nahoru, "zmrzlina"); rozlozeni.nastav(nahoru / 50, vlevo / 50, vagonek); Management.maxskore += 10; break; case "d": vagonek = new Vagon(vlevo, nahoru, "dort"); rozlozeni.nastav(nahoru / 50, vlevo / 50, vagonek); Management.maxskore += 10; break; case "a": vagonek = new Vagon(vlevo, nahoru, "auto"); rozlozeni.nastav(nahoru / 50, vlevo / 50, vagonek); Management.maxskore += 10; break; case "p": vagonek = new Vagon(vlevo, nahoru, "pc"); rozlozeni.nastav(nahoru / 50, vlevo / 50, vagonek); Management.maxskore += 10; break; } vlevo += 50; } vlevo = 0; int down = 650; for (int k = 0; k < 3; k++) { down += 50; Wall = new Hranice(0, down); Wall = new Hranice(1000, down); } for (int a = 0; a < 19; a++) { vlevo += 50; Wall = new Hranice(vlevo, 800); } } cti.Close(); } else { pole.Visibility = Visibility.Hidden; vyhraG.Visibility = Visibility.Visible; } }
// Token: 0x060002F6 RID: 758 RVA: 0x00018CFC File Offset: 0x00016EFC private void DoMeleeAttack() { Transform transform; Vector3 vector; this.GetMeleeAttackDir(out transform, out vector); Vector3 point = this.m_character.transform.InverseTransformDirection(vector); Quaternion quaternion = Quaternion.LookRotation(vector, Vector3.up); this.m_weapon.m_shared.m_triggerEffect.Create(transform.position, quaternion, transform, 1f); this.m_triggerEffect.Create(transform.position, quaternion, transform, 1f); Vector3 vector2 = transform.position + Vector3.up * this.m_attackHeight + this.m_character.transform.right * this.m_attackOffset; float num = this.m_attackAngle / 2f; float num2 = 4f; float attackRange = this.m_attackRange; List <Attack.HitPoint> list = new List <Attack.HitPoint>(); HashSet <Skills.SkillType> hashSet = new HashSet <Skills.SkillType>(); int layerMask = this.m_hitTerrain ? Attack.m_attackMaskTerrain : Attack.m_attackMask; for (float num3 = -num; num3 <= num; num3 += num2) { Quaternion rotation = Quaternion.identity; if (this.m_attackType == Attack.AttackType.Horizontal) { rotation = Quaternion.Euler(0f, -num3, 0f); } else if (this.m_attackType == Attack.AttackType.Vertical) { rotation = Quaternion.Euler(num3, 0f, 0f); } Vector3 vector3 = this.m_character.transform.TransformDirection(rotation * point); Debug.DrawLine(vector2, vector2 + vector3 * attackRange); RaycastHit[] array; if (this.m_attackRayWidth > 0f) { array = Physics.SphereCastAll(vector2, this.m_attackRayWidth, vector3, Mathf.Max(0f, attackRange - this.m_attackRayWidth), layerMask, QueryTriggerInteraction.Ignore); } else { array = Physics.RaycastAll(vector2, vector3, attackRange, layerMask, QueryTriggerInteraction.Ignore); } Array.Sort <RaycastHit>(array, (RaycastHit x, RaycastHit y) => x.distance.CompareTo(y.distance)); foreach (RaycastHit raycastHit in array) { if (!(raycastHit.collider.gameObject == this.m_character.gameObject)) { Vector3 vector4 = raycastHit.point; if (raycastHit.distance < 1E-45f) { if (raycastHit.collider is MeshCollider) { vector4 = vector2 + vector3 * attackRange; } else { vector4 = raycastHit.collider.ClosestPoint(vector2); } } if (this.m_attackAngle >= 180f || Vector3.Dot(vector4 - vector2, vector) > 0f) { GameObject gameObject = Projectile.FindHitObject(raycastHit.collider); if (!(gameObject == this.m_character.gameObject)) { Vagon component = gameObject.GetComponent <Vagon>(); if (!component || !component.IsAttached(this.m_character)) { Character component2 = gameObject.GetComponent <Character>(); if (!(component2 != null) || ((this.m_character.IsPlayer() || BaseAI.IsEnemy(this.m_character, component2)) && (!this.m_weapon.m_shared.m_dodgeable || !component2.IsDodgeInvincible()))) { this.AddHitPoint(list, gameObject, raycastHit.collider, vector4, raycastHit.distance); if (!this.m_hitThroughWalls) { break; } } } } } } } } int num4 = 0; Vector3 vector5 = Vector3.zero; bool flag = false; bool flag2 = false; foreach (Attack.HitPoint hitPoint in list) { GameObject go = hitPoint.go; Vector3 vector6 = hitPoint.avgPoint / (float)hitPoint.count; Vector3 vector7 = vector6; switch (this.m_hitPointtype) { case Attack.HitPointType.Closest: vector7 = hitPoint.closestPoint; break; case Attack.HitPointType.Average: vector7 = vector6; break; case Attack.HitPointType.First: vector7 = hitPoint.firstPoint; break; } num4++; vector5 += vector6; this.m_weapon.m_shared.m_hitEffect.Create(vector7, Quaternion.identity, null, 1f); this.m_hitEffect.Create(vector7, Quaternion.identity, null, 1f); IDestructible component3 = go.GetComponent <IDestructible>(); if (component3 != null) { DestructibleType destructibleType = component3.GetDestructibleType(); Skills.SkillType skillType = this.m_weapon.m_shared.m_skillType; if (this.m_specialHitSkill != Skills.SkillType.None && (destructibleType & this.m_specialHitType) != DestructibleType.None) { skillType = this.m_specialHitSkill; } float num5 = this.m_character.GetRandomSkillFactor(skillType); if (this.m_lowerDamagePerHit && list.Count > 1) { num5 /= (float)list.Count * 0.75f; } HitData hitData = new HitData(); hitData.m_toolTier = this.m_weapon.m_shared.m_toolTier; hitData.m_statusEffect = (this.m_weapon.m_shared.m_attackStatusEffect ? this.m_weapon.m_shared.m_attackStatusEffect.name : ""); hitData.m_pushForce = this.m_weapon.m_shared.m_attackForce * num5 * this.m_forceMultiplier; hitData.m_backstabBonus = this.m_weapon.m_shared.m_backstabBonus; hitData.m_staggerMultiplier = this.m_staggerMultiplier; hitData.m_dodgeable = this.m_weapon.m_shared.m_dodgeable; hitData.m_blockable = this.m_weapon.m_shared.m_blockable; hitData.m_skill = skillType; hitData.m_damage = this.m_weapon.GetDamage(); hitData.m_point = vector7; hitData.m_dir = (vector7 - vector2).normalized; hitData.m_hitCollider = hitPoint.collider; hitData.SetAttacker(this.m_character); hitData.m_damage.Modify(this.m_damageMultiplier); hitData.m_damage.Modify(num5); hitData.m_damage.Modify(this.GetLevelDamageFactor()); if (this.m_attackChainLevels > 1 && this.m_currentAttackCainLevel == this.m_attackChainLevels - 1) { hitData.m_damage.Modify(2f); hitData.m_pushForce *= 1.2f; } this.m_character.GetSEMan().ModifyAttack(skillType, ref hitData); if (component3 is Character) { flag2 = true; } component3.Damage(hitData); if ((destructibleType & this.m_resetChainIfHit) != DestructibleType.None) { this.m_nextAttackChainLevel = 0; } hashSet.Add(skillType); if (!this.m_multiHit) { break; } } if (go.GetComponent <Heightmap>() != null && !flag) { flag = true; this.m_weapon.m_shared.m_hitTerrainEffect.Create(vector6, quaternion, null, 1f); this.m_hitTerrainEffect.Create(vector6, quaternion, null, 1f); if (this.m_weapon.m_shared.m_spawnOnHitTerrain) { this.SpawnOnHitTerrain(vector6, this.m_weapon.m_shared.m_spawnOnHitTerrain); } if (!this.m_multiHit) { break; } } } if (num4 > 0) { vector5 /= (float)num4; if (this.m_weapon.m_shared.m_useDurability && this.m_character.IsPlayer()) { this.m_weapon.m_durability -= this.m_weapon.m_shared.m_useDurabilityDrain; } this.m_character.AddNoise(this.m_attackHitNoise); this.m_animEvent.FreezeFrame(0.15f); if (this.m_weapon.m_shared.m_spawnOnHit) { IProjectile component4 = UnityEngine.Object.Instantiate <GameObject>(this.m_weapon.m_shared.m_spawnOnHit, vector5, quaternion).GetComponent <IProjectile>(); if (component4 != null) { component4.Setup(this.m_character, Vector3.zero, this.m_attackHitNoise, null, this.m_weapon); } } foreach (Skills.SkillType skill in hashSet) { this.m_character.RaiseSkill(skill, flag2 ? 1.5f : 1f); } } if (this.m_spawnOnTrigger) { IProjectile component5 = UnityEngine.Object.Instantiate <GameObject>(this.m_spawnOnTrigger, vector2, Quaternion.identity).GetComponent <IProjectile>(); if (component5 != null) { component5.Setup(this.m_character, this.m_character.transform.forward, -1f, null, this.m_weapon); } } }