public MatchWrestler InstantiateWrester(WrestlerData wrestlerData, int teamNumber, int positionInTeam, Match matchManager, InMatchWrestlingTargetDeterminator targetDeterminator, Ring ring) { MatchWrestler matchWrestler = Instantiate(wrestlerPrefab); RingPosition startingPosition = null; switch (teamNumber) { case 0: startingPosition = GetStartingRingPosition(_teamOne, positionInTeam); break; case 1: startingPosition = GetStartingRingPosition(_teamTwo, positionInTeam); break; case 2: startingPosition = GetStartingRingPosition(_teamThree, positionInTeam); break; case 3: startingPosition = GetStartingRingPosition(_teamFour, positionInTeam); break; default: break; } //TODO: Set wrestlers position in the world here. matchWrestler.InitializeWrestler(matchManager, wrestlerData, targetDeterminator, ring, startingPosition); ; return(matchWrestler); }
public List <RingPosition> GetRingPositionsInRadius(int radius, RingPosition centerPosition) { List <RingPosition> newRingPositions = new List <RingPosition>(); Vector2 centerVector = centerPosition.Position; RingPosition north = null; RingPosition east = null; RingPosition south = null; RingPosition west = null; for (int i = 1; i <= radius; i++) { if (ringPositions.ContainsKey(new Vector2(centerVector.x, centerVector.y + i))) { north = ringPositions[new Vector2(centerVector.x, centerVector.y + i)]; newRingPositions.Add(north); } if (ringPositions.ContainsKey(new Vector2(centerVector.x + i, centerVector.y))) { east = ringPositions[new Vector2(centerVector.x + i, centerVector.y)]; newRingPositions.Add(east); } if (ringPositions.ContainsKey(new Vector2(centerVector.x, centerVector.y - i))) { south = ringPositions[new Vector2(centerVector.x, centerVector.y - i)]; newRingPositions.Add(south); } if (ringPositions.ContainsKey(new Vector2(centerVector.x - i, centerVector.y))) { west = ringPositions[new Vector2(centerVector.x - i, centerVector.y)]; newRingPositions.Add(west); } if (radius > 1) { for (int x = 1; x <= radius - 1; x++) { // Future Joe: There is a issure here. if a Direction is gone there can still be points on the line. need to work aroudn that. if (north != null) { newRingPositions.Add(GetRingPositionInDirection(x, north, new Vector2(1, -1))); } if (east != null) { newRingPositions.Add(GetRingPositionInDirection(x, east, new Vector2(-1, -1))); } if (south != null) { newRingPositions.Add(GetRingPositionInDirection(x, south, new Vector2(-1, 1))); } if (west != null) { newRingPositions.Add(GetRingPositionInDirection(x, west, new Vector2(1, 1))); } } } } return(newRingPositions); }
public RingPosition SetStartingPosition(Vector2 ringPosition) { RingPosition startingRingPosition = _ring.GetRingPosition(ringPosition); _playerRoot.position = startingRingPosition.Transform.position; _currentRingPosition = startingRingPosition; return(startingRingPosition); }
public void TurnInPosition(RingPosition ringPosition, int ringOrder) { if (ringPosition == null) { return; } ringPosition.ResetClaim(); _ringPositionQueues[ringOrder].Enqueue(ringPosition); }
private void SetWayPoint(RingPosition wayPoint) { if (wayPoint == null) { return; } _currentWayPoint = wayPoint; _currentWayPoint.Claim(_enemyUnit); }
private void HandleMoveToDestinationVector(Vector2 destinationVector) { RingPosition destanation = _ring.GetRingPosition(destinationVector); if (destanation != null) { _playerRoot.position = destanation.Transform.position; _currentRingPosition = destanation; } else { CheckCurrentPosition(); } }
{/// <summary> /// Convert from source to UI /// </summary> /// <param name="value"></param> /// <param name="targetType"></param> /// <param name="parameter"></param> /// <param name="language"></param> /// <returns></returns> public object Convert(object value, Type targetType, object parameter, string language) { RingPosition r = (RingPosition)value; Thickness t; if (r == RingPosition.Top) { t = new Thickness(5, 10, 5, 5); } else { t = new Thickness(5, 5, 5, 10); } return(t); }
private void Update() { if (Keyboard.current.spaceKey.wasPressedThisFrame) { _targetRing = RingManager.Instance.SwapPositions(_targetRing, _order); _path = null; while (_targetRing == null || !_targetRing.RingNode.IsWalkable()) { _targetRing = RingManager.Instance.GetRingPositionFromRingOrder(_order); } var startingRing = RingManager.Instance.FindBestStartingRing(_start.position, _order); _path = RingPathFinder.Path(null, startingRing.RingNode, _targetRing.RingNode); } }
{ /// <summary> /// Convert from source to UI /// </summary> /// <param name="value"></param> /// <param name="targetType"></param> /// <param name="parameter"></param> /// <param name="language"></param> /// <returns></returns> public object Convert(object value, Type targetType, object parameter, string language) { string s = parameter as string; RingPosition r = (RingPosition)value; Visibility result = Visibility.Collapsed; if (r == RingPosition.Top && s == "Top") { result = Visibility.Visible; } else if (r == RingPosition.Bottom && s == "Bottom") { result = Visibility.Visible; } return(result); }
public RingPosition SwapPositions(RingPosition previousPosition, int order) { var ringQueue = _ringPositionQueues[order]; var nextAvailable = ringQueue.Count > 0 ? ringQueue.Dequeue() : null; // Debug.Log($"Previous {previousPosition} : Next available {nextAvailable}: Order {order}: Count: {ringQueue.Count}"); var ringToReturn = nextAvailable == null ? previousPosition : nextAvailable; if (nextAvailable != null) { if (previousPosition != null) { // Debug.Log($"Enqueuing {previousPosition}"); ringQueue.Enqueue(previousPosition); } } return(ringToReturn); }
public RingNode(RingPosition ringPosition) { _ringPosition = ringPosition; }
private RingPosition GetRingPositionInDirection(int distance, RingPosition position, Vector2 directionVector) { return(ringPositions[new Vector2(position.Position.x + (distance * directionVector.x), position.Position.y + (distance * directionVector.y))]); }
public void InitializeWrestler(Match matchManager, WrestlerData wrestlerData, InMatchWrestlingTargetDeterminator targetDeterminator, Ring ring, RingPosition startingPosition) { matchManager.UpdateSpeed += HandleSpeedUpdated; _baseWrestlerData = wrestlerData; _targetDeterminator = targetDeterminator; //actions need to be handled by an action handler that gets init here. _playerMovementAction = new PlayerMovementAction(transform, ring); _agilityHandler = new MatchWrestlerAgilityHandler(wrestlerData.Agility); _speedPoolHandler = new MatchWrestlerSpeedPoolHandler(_agilityHandler, this); WrestlerInitialized?.Invoke(this, new MatchWresterGenericEventArgs() { wrestler = this }); }
public void TurnInRingPosition(RingPosition ringPosition) { RingManager.Instance.TurnInPosition(ringPosition, _ringOrder); }
private void Start() { _targetRing = RingManager.Instance.GetRingPositionFromRingOrder(_order); }