private void GetMeleePosition(Grid p_grid, Party p_party, List <GridSlot> p_slots) { EDirection oppositeDir = EDirectionFunctions.GetOppositeDir(p_party.Direction); EDirection p_dir = EDirectionFunctions.Add(p_party.Direction, 3); EDirection p_dir2 = EDirectionFunctions.Add(p_party.Direction, 1); EDirection direction = p_party.Direction; Int32 num = Random.Range(0, 13); GridSlot neighborSlot; if (num >= 5) { neighborSlot = p_grid.GetSlot(p_party.Position).GetNeighborSlot(p_grid, oppositeDir); } else if (num >= 3) { neighborSlot = p_grid.GetSlot(p_party.Position).GetNeighborSlot(p_grid, p_dir); } else if (num >= 1) { neighborSlot = p_grid.GetSlot(p_party.Position).GetNeighborSlot(p_grid, p_dir2); } else { neighborSlot = p_grid.GetSlot(p_party.Position).GetNeighborSlot(p_grid, direction); } if (neighborSlot.IsPassable(m_owner, false)) { m_targetSlot = neighborSlot; } else { m_targetSlot = p_slots[Random.Range(0, p_slots.Count)]; } }
private Boolean AddViewWithPreviousSlot(IMoveable go, ESize size, out Vector3 localPosition, Int32 p_comeFrom, EntityPositioning p_oldPositioning) { Boolean searchNearestSlot = false; if (p_oldPositioning != null) { EDirection direction = EDirectionFunctions.GetDirection(p_oldPositioning.Position, m_gridSlot.Position); if (direction != m_direction && direction != EDirectionFunctions.Add(m_direction, 2)) { searchNearestSlot = true; } } Boolean flag; if (size == ESize.MEDIUM) { flag = AddViewWithPreviousSlotMedium(go, out localPosition, p_comeFrom, p_oldPositioning, searchNearestSlot); } else if (size == ESize.BIG) { flag = AddViewWithPreviousSlotBig(go, out localPosition, p_comeFrom); } else { flag = AddViewWithPreviousSlotSmall(go, out localPosition, p_comeFrom, p_oldPositioning, searchNearestSlot); } return(!flag); }
private void ShowHitEffect(Monster mob) { if (mob != null) { Party party = LegacyLogic.Instance.WorldManager.Party; EDirection lineOfSightDirection = EDirectionFunctions.GetLineOfSightDirection(party.Position, mob.Position); if (lineOfSightDirection != party.Direction) { if (EDirectionFunctions.Add(lineOfSightDirection, 2) == party.Direction) { m_bottomEffect.Stop(); m_bottomEffect.Play(); } if (EDirectionFunctions.Add(lineOfSightDirection, 1) == party.Direction) { m_leftEffect.Stop(); m_leftEffect.Play(); } if (EDirectionFunctions.Add(lineOfSightDirection, -1) == party.Direction) { m_rightEffect.Stop(); m_rightEffect.Play(); } } } }
private Int32 GetNearestSlotByDirection(EntityPositioning p_otherPositioning, Int32 p_fromSlot) { if (p_otherPositioning.Direction == m_direction) { Position position = p_otherPositioning.Position; Position position2 = Position; EDirection edirection = EDirectionFunctions.Add(m_direction, -(Int32)EDirectionFunctions.GetDirection(ref position2, ref position)); if (edirection == EDirection.EAST) { return(2); } if (edirection == EDirection.WEST) { return(0); } } else if (p_otherPositioning.Direction == EDirectionFunctions.Add(m_direction, 2)) { return(p_fromSlot); } return(0); }