public void ServerPerformInteraction(AimApply interaction) { if (reagentContainer.CurrentCapacity >= 5 && !safety) { Vector2 startPos = interaction.Performer.transform .position; //TODO: use registeritem position once picked up items get fixed Vector2 targetPos = new Vector2(Mathf.RoundToInt(interaction.WorldPositionTarget.x), Mathf.RoundToInt(interaction.WorldPositionTarget.y)); List <Vector3Int> positionList = MatrixManager.GetTiles(startPos, targetPos, travelDistance); StartCoroutine(Fire(positionList)); var points = GetParallelPoints(startPos, targetPos, true); positionList = MatrixManager.GetTiles(points[0], points[1], travelDistance); StartCoroutine(Fire(positionList)); points = GetParallelPoints(startPos, targetPos, false); positionList = MatrixManager.GetTiles(points[0], points[1], travelDistance); StartCoroutine(Fire(positionList)); var angle = Mathf.Atan2(targetPos.y - startPos.y, targetPos.x - startPos.x) * 180 / Mathf.PI; particleSync = angle; SoundManager.PlayNetworkedAtPos("Extinguish", startPos, 1); reagentContainer.MoveReagentsTo(5); } }
protected override void ServerPerformInteraction(AimApply interaction) { if (reagentContainer.CurrentCapacity >= 5) { Vector2 startPos = interaction.Performer.transform.position; Vector2 targetPos = new Vector2(Mathf.RoundToInt(interaction.WorldPositionTarget.x), Mathf.RoundToInt(interaction.WorldPositionTarget.y)); List <Vector3Int> positionList = MatrixManager.GetTiles(startPos, targetPos, travelDistance); StartCoroutine(Fire(positionList)); var angle = Mathf.Atan2(targetPos.y - startPos.y, targetPos.x - startPos.x) * 180 / Mathf.PI; particleSync = angle; reagentContainer.MoveReagentsTo(5); SoundManager.PlayNetworkedAtPos("Spray2", startPos, 1); } }