void OnDragConsumable(Vector2 position) { if (useType == Executable.ExecatableUseType.DRAG_DROP_PLASE && Squad.playerSquadInstance != null && canCast) { if (currentConsumable.ConsumableStats is ISkillRadiusable) { ISkillRadiusable t = currentConsumable.ConsumableStats as ISkillRadiusable; CreatePoints(Camera.main.ScreenToWorldPoint(position), t.Radius); lineRenderer.positionCount = rHitCirclreSegmentCount; lineRenderer.SetPositions(rHitCirclreSegments); } } else if (useType == Executable.ExecatableUseType.DRAG_DIRECTION && Squad.playerSquadInstance != null && canCast) { if (currentConsumable.ConsumableStats is ISkillDirectionable) { ISkillDirectionable t = currentConsumable.ConsumableStats as ISkillDirectionable; lineRenderer.positionCount = 2; var pos = new Vector3[] { Squad.playerSquadInstance.CenterSquad, ((Vector2)Camera.main.ScreenToWorldPoint(position) - Squad.playerSquadInstance.CenterSquad).normalized * t.Distance + Squad.playerSquadInstance.CenterSquad }; for (int i = 0; i < pos.Length; i++) { pos[i].z = -9; } lineRenderer.SetPositions(pos); } } }
void OnEndDragConsumable(Vector2 position) { if (useType == Executable.ExecatableUseType.DRAG_DROP_PLASE && Squad.playerSquadInstance != null && canCast) { currentConsumable.Consumable.Init( Squad.playerSquadInstance, (Vector2)Camera.main.ScreenToWorldPoint(position), playerSquadTransform.rotation, currentConsumable.Count ); DoConsumable(); lineRenderer.positionCount = 0; } else if (useType == Executable.ExecatableUseType.DRAG_DIRECTION && Squad.playerSquadInstance != null && canCast) { if (currentConsumable.ConsumableStats is ISkillDirectionable) { ISkillDirectionable t = currentConsumable.ConsumableStats as ISkillDirectionable; currentConsumable.Consumable.Init( Squad.playerSquadInstance, ((Vector2)Camera.main.ScreenToWorldPoint(position) - Squad.playerSquadInstance.CenterSquad).normalized * t.Distance + Squad.playerSquadInstance.CenterSquad, currentConsumable.Count ); DoConsumable(); lineRenderer.positionCount = 0; } } }