public Selection(IMovableObject drawable, SelectionPosition selpos, double accuracy=0) { Drawable = drawable; Position = selpos; Accuracy = accuracy; }
public bool TryMoveUp(IMovableObject movable) { movable.Position.IncrementOrdinata(); return(Collide(movable)); }
public override IEnumerator UpdateView(FightStatus fightStatus) { int fightId = fightStatus.fightId; if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entity)) { IsoObject isoObject = entity.view; if (null != isoObject) { switch (movementType) { case 1: { IObjectWithMovement objectWithMovement6; if ((objectWithMovement6 = (isoObject as IObjectWithMovement)) != null) { yield return(objectWithMovement6.Move(GetPath())); } else { Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithMovement>(entity), 71, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityAreaMovedEvent.cs"); } break; } case 3: { IMovableObject movableObject; IMovableObject objectWithMovement3 = movableObject = (isoObject as IMovableObject); if (movableObject != null) { FightContext fightContext = fightStatus.context; yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.TeleportationStart, fightId, parentEventId, isoObject, fightContext)); objectWithMovement3.Teleport(GetDestination()); yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.TeleportationEnd, fightId, parentEventId, isoObject, fightContext)); } else { Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithMovement>(entity), 88, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityAreaMovedEvent.cs"); } break; } case 6: { IMovableObject movableObject; IMovableObject objectWithMovement3 = movableObject = (isoObject as IMovableObject); if (movableObject != null) { Vector2Int[] path2 = GetPath(); Quaternion pathRotation2 = GetPathRotation(path2); Transform transform2 = isoObject.cellObject.get_transform(); ITimelineContextProvider contextProvider2 = isoObject as ITimelineContextProvider; yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.Push, fightId, parentEventId, transform2, pathRotation2, Vector3.get_one(), fightStatus.context, contextProvider2)); yield return(objectWithMovement3.Push(path2)); } else { Log.Error(FightEventErrors.EntityHasIncompatibleView <IMovableObject>(entity), 108, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityAreaMovedEvent.cs"); } break; } case 7: { IMovableObject movableObject; IMovableObject objectWithMovement3 = movableObject = (isoObject as IMovableObject); if (movableObject != null) { Vector2Int[] path2 = GetPath(); Quaternion pathRotation = GetPathRotation(path2); Transform transform = isoObject.cellObject.get_transform(); ITimelineContextProvider contextProvider = isoObject as ITimelineContextProvider; yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.Pull, fightId, parentEventId, transform, pathRotation, Vector3.get_one(), fightStatus.context, contextProvider)); yield return(objectWithMovement3.Pull(path2)); } else { Log.Error(FightEventErrors.EntityHasIncompatibleView <IMovableObject>(entity), 128, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityAreaMovedEvent.cs"); } break; } case 2: case 4: { IObjectWithMovement objectWithMovement5; if ((objectWithMovement5 = (isoObject as IObjectWithMovement)) != null) { Direction direction2 = (Direction)this.direction; yield return(objectWithMovement5.MoveToAction(GetPath(), direction2)); } else { Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithMovement>(entity), 143, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityAreaMovedEvent.cs"); } break; } case 8: { IObjectWithMovement objectWithMovement4; if ((objectWithMovement4 = (isoObject as IObjectWithMovement)) != null) { Direction direction = (Direction)this.direction; yield return(objectWithMovement4.MoveToAction(GetPath(), direction, hasFollowUpAnimation: false)); } else { Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithMovement>(entity), 157, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityAreaMovedEvent.cs"); } break; } default: throw new ArgumentOutOfRangeException(); } if (IsMovementAction()) { IObjectWithAction objectWithAction; if ((objectWithAction = (isoObject as IObjectWithAction)) != null) { objectWithAction.SetActionUsed(actionUsed: true, turnEnded: false); } else { Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithAction>(entity), 174, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityAreaMovedEvent.cs"); } } ICharacterObject characterObject; if ((characterObject = (isoObject as ICharacterObject)) != null) { characterObject.CheckParentCellIndicator(); } } else { Log.Error(FightEventErrors.EntityHasNoView(entity), 185, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityAreaMovedEvent.cs"); } } else { Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 190, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\EntityAreaMovedEvent.cs"); } FightLogicExecutor.FireUpdateView(fightId, EventCategory.EntityMoved); }
/// <summary> /// Determine if an object can move from its current location to dir /// </summary> public static bool CanMoveFromTo(IMovableObject living, Direction dir) { var env = living.Environment; var src = living.Location; var dst = living.Location + dir; return CanMoveFrom(env, src, dir) && CanMoveTo(env, dst, dir); }
public bool TryMoveRight(IMovableObject movable) { movable.Position.IncrementAbscissa(); return(Collide(movable)); }
private void Initialize(IGameplayProps gameplayProps, IMovableObject movableObject) { _gameplayProps = gameplayProps; _movableObject = movableObject; }
public Collision(IMovableObject objectA, IMovableObject objectB) { ObjectA = objectA; ObjectB = objectB; }
private T AmIOnsomething <T>(IMovableObject obj, IEnumerable <T> collection) where T : class, IGameObject => AmIOnsomething <T>(obj, collection, t => true);
public bool AmIFalling(IMovableObject obj) => DirectionAccesable(obj, Direction.down);
public IInteractiveItem AmIOnInteractiveItem(IMovableObject obj) => AmIOnsomething(obj, InteractiveItems);
private T AmIOnAliveLife <T>(IMovableObject obj, IEnumerable <T> collection) where T : Life => AmIOnsomething(obj, collection, t => t.Alive);
/// <summary> /// Determines what alive enemy is the object touching by any part. /// </summary> public Enemy AmIOnEnemy(IMovableObject obj) => AmIOnAliveLife(obj, Enemies);
/// <summary> /// Determines what alive player is the object touching by any part. /// </summary> public PlayerCharacter AmIOnPlayer(IMovableObject obj) => AmIOnAliveLife(obj, Players);
public void ReDraw(IMovableObject drawable) { /* FIXME: get region from drawable */ ReDraw (); }
public void ReDraw(IMovableObject drawable) { /* FIXME: get region from drawable */ ReDraw(); }
public bool DirectionAccesable(IMovableObject obj, Direction dir) => new DirectionAccesor(this).DirectionAccesable(obj, dir);
public void Move(ICollisionEngineContext context, IMovableObject movingObj, IntVector offset) { MoveHorizontal(context, movingObj, offset.X); MoveVertical(context, movingObj, offset.Y); }
bool CanGoDown(IMovableObject obj) => CanGoSomewhere(obj.Width, OneTileWidth, i => obj.Location.x + i, i => obj.Location.y + obj.Height + obj.Movement.ExampleLoc.y);
public Selection(IMovableObject drawable, SelectionPosition selpos, double accuracy = 0) { Drawable = drawable; Position = selpos; Accuracy = accuracy; }
bool CanGoRight(IMovableObject obj) => CanGoSomewhere(obj.Height, OneTileHeight, i => obj.Location.x + obj.Width + obj.Movement.ExampleLoc.x, i => obj.Location.y + i);
private void ApplyDrag(IMovableObject obj, TimeSpan elapsedTime) { var dragFactor = Math.Min(1, 0.05f * elapsedTime.TotalSeconds); obj.Velocity = obj.Velocity - obj.Velocity * dragFactor; }
private void Initialize(IMovableObject movableObject, IObstaclesSpawner obstaclesSpawner, IObstacle obstacle) { _movableObject = movableObject; _obstaclesSpawner = obstaclesSpawner; _obstacle = obstacle; }