/// <summary> /// /// </summary> private TypeCollision gestionCollision() { TypeCollision Etatcollision = TypeCollision.RAS; switch (Grille[serpent.Last()[0], serpent.Last()[1]].Etat) { case Case.TypeCase.vide: break; case Case.TypeCase.fruit: QteFruitManger++; formJeu.actualiseScoreAffichage(); gestionFruit(null, null); if (formMenu.Difficulte.TempsDisparitionFruit > 0) { TimerFruit.Stop(); TimerFruit.Start(); } Etatcollision = TypeCollision.Fruit; break; case Case.TypeCase.bordure: case Case.TypeCase.serpent: Etatcollision = TypeCollision.Fin; break; } return(Etatcollision); }
public void ReplaceCollision(TypeCollision newType, GameEntity newHandler, GameEntity newCollider) { var index = InputComponentsLookup.Collision; var component = (CollisionComponent)CreateComponent(index, typeof(CollisionComponent)); component.type = newType; component.handler = newHandler; component.collider = newCollider; ReplaceComponent(index, component); }
protected void CreateCollisionInputEntity(TypeCollision type, GameObject handler, GameObject collider) { var handlerLink = handler.GetEntityLink(); var colliderLink = collider.GetEntityLink(); if (handlerLink == null) { throw new Exception($"Handler link is null. Object - {handler.ToString()}"); } if (colliderLink == null) { throw new Exception($"Collider link is null. Object - {collider.ToString()}"); } Contexts.sharedInstance.input.CreateEntity() .AddCollision(type, handlerLink.entity, colliderLink.entity); }
internal void SaveType(Type type) { string name = GetCoreTypeName(type); object existingType; // if there's no collisions we just save the type if (!__dict__.TryGetValue(SymbolTable.StringToId(name), out existingType)) { __dict__[SymbolTable.StringToId(name)] = Ops.GetDynamicTypeFromType(type); return; } // two types w/ the same name. Good examples are: // System.Nullable and System.Nullable<T> // System.IComparable vs System.IComparable<T> // In this case we need to allow the user to disambiguate the two. // // Or we could have a recompile & reload cycle (or a really bad // collision). In those cases the new type wins. TypeCollision tc = existingType as TypeCollision; if (tc != null) { // we've collided before... if (!type.ContainsGenericParameters) { // we're replacing the existing non generic type // or moving some random generic type from the "base" // reflected type into the list of generics. __dict__[SymbolTable.StringToId(name)] = tc.CloneWithNewBase(type); } else { // we're a generic type. we just need to add // ourselves to the list or replace an existing type // of the same arity. tc.UpdateType(type); } } else { // first time collision on this name, provide // the type collision to disambiguate. The non-generic // is exposed by default, and the generic gets added // to the list to disambiguate. ReflectedType rt = existingType as ReflectedType; Debug.Assert(rt != null); if (rt.type.ContainsGenericParameters) { // existing type has generics, append it. tc = new TypeCollision(type); __dict__[SymbolTable.StringToId(name)] = tc; tc.UpdateType(rt.type); } else if (type.ContainsGenericParameters) { // new type has generics, append it. tc = new TypeCollision(rt.type); __dict__[SymbolTable.StringToId(name)] = tc; tc.UpdateType(type); } else { // neither type has generics, replace the old // non-generic type w/ the new non-generic type. __dict__[SymbolTable.StringToId(name)] = Ops.GetDynamicTypeFromType(type); } } }