private void PlayerInputOnPrimaryKeyPressed() { if (buildData.ExtractedEssences.Count <= 0) { return; } var handPos = buildData.ConstructorObject.position; var buildSpots = buildData.AttractionSpots.Items.ToArray(); var buildRange = buildData.BuildSpotDetectionRange; var openSpots = RangeTargetScanner.GetTargets(handPos, buildSpots, buildRange).Where(t => !t.GetComponent <AttractionSpot>().IsOccupied).ToArray(); if (openSpots.Length <= 0) { return; } var attractionSpot = ClosestEntityFinder.GetClosestTransform(openSpots, handPos).GetComponent <AttractionSpot>(); var essence = buildData.ExtractedEssences.Last(); attractionSpot.AssignEssence(essence); buildData.ExtractedEssences.Remove(essence); essence.GetComponent <Essence>().Activate(); }
private void PlayerInputOnPrimaryKeyPressed() { var handPos = buildData.ConstructorObject.position; var buildSpots = buildData.AttractionSpots.Items.ToArray(); var buildRange = buildData.BuildSpotDetectionRange; var openSpots = RangeTargetScanner.GetTargets(handPos, buildSpots, buildRange).Where(t => !t.GetComponent <AttractionSpot>().IsOccupied).ToArray(); if (openSpots.Length <= 0) { return; } buildData.TargetAttraction = ClosestEntityFinder.GetClosestTransform(openSpots, handPos).GetComponent <AttractionSpot>(); stateData.ChangeState(PlayerStates.FORGING); }