public Sprite FrameForDirection(OrthoDir facing) { return(FrameBySlot(0, facing)); }
// public abstract // if we moved in this direction, where in screenspace would we end up? public abstract Vector3 CalculateOffsetPositionPx(OrthoDir dir);
private bool TryStep(OrthoDir dir) { Vector2Int vectors = Event.Position; Vector2Int vsd = dir.XY2D(); Vector2Int target = vectors + vsd; Chara.Facing = dir; List <MapEvent> targetEvents = Event.Map.GetEventsAt(target); List <MapEvent> toCollide = new List <MapEvent>(); var passable = vsd.y == 0 && Event.CanPassAt(target); foreach (MapEvent targetEvent in targetEvents) { toCollide.Add(targetEvent); } if (!Event.CanPassAt(target)) { passable = false; } if (passable) { WantsToTrack = true; StartCoroutine(CoUtils.RunParallel(new IEnumerator[] { CoUtils.RunWithCallback(Event.StepRoutine(dir), () => { foreach (var targetEvent in toCollide) { if (targetEvent.IsSwitchEnabled) { targetEvent.GetComponent <Dispatch>().Signal(MapEvent.EventCollide, this); } } foreach (var targetEvent in Event.Map.GetEvents <MapEvent>()) { if (targetEvent.IsSwitchEnabled) { targetEvent.GetComponent <Dispatch>().Signal(MapEvent.EventStep, this); } } if (toCollide.Count == 0) { Global.Instance().Maps.ActiveMap.OnStepEnded(); } }), OnStepStartRoutine(), }, this)); } else { foreach (var targetEvent in toCollide) { if (targetEvent.IsSwitchEnabled) { targetEvent.GetComponent <Dispatch>().Signal(MapEvent.EventCollide, this); } } } return(true); }
public Sprite FrameBySlot(int x, OrthoDir facing) { return(FrameByExplicitSlot(x, facing.Ordinal())); }
public void FaceToward(MapEvent other) { Facing = Parent.DirectionTo(other); }
public void Populate(Unit unit) { Populate(unit.FieldSpriteTag); facing = unit.IsDead ? OrthoDir.North : OrthoDir.South; }
private void AddKey(OrthoDir dir) { downButtons.Add(dir); UpdateHighlight(); }
public override Vector3 CalculateOffsetPositionPx(OrthoDir dir) { return(PositionPx + dir.Px3D()); }
public override Vector2Int OffsetForTiles(OrthoDir dir) { return(dir.XY2D()); }
public void FaceToward(IntVector2 pos) { facing = OrthoDirExtensions.DirectionOf(pos - GetComponent <MapEvent>().positionXY); }
// if this event were to move in a direction, how would that affect coordinates? public abstract Vector2Int OffsetForTiles(OrthoDir dir);