Exemple #1
0
    public void UpdateThrowPreparation()
    {
        Vector3 trueTargetPosition = GetInRangeThrowTargetPosition(currentWorldMouseResult.mouseWorldPosition);
        //Vector3 trueTargetPosition = GetInRangeThrowTargetPosition(GameManager.Instance.GetDebugPos);
        DiscTrajectoryParameters trajectoryParameters =
            DiscTrajectoryFactory.GetTrajectory(throwCompetence, _player.transform.position, trueTargetPosition,
                                                DiscManager.Instance.GetAllThrowedDiscs, DiscManager.Instance.GetInRangeDiscs, aboutToThrowDisc);

        Dictionary <DiscScript, DiscTrajectoryParameters> trajectories = new Dictionary <DiscScript, DiscTrajectoryParameters>();

        trajectories.Add(aboutToThrowDisc, trajectoryParameters);
        PreviewCompetencesManager.Instance.UpdateThrowPreview(trajectories);
    }
Exemple #2
0
    public void StartRecallDisc(DiscScript disc)
    {
        DiscTrajectoryParameters trajectoryParameters =
            DiscTrajectoryFactory.GetTrajectory(recallCompetence,
                                                disc.transform.position, _player.transform.position,
                                                DiscManager.Instance.GetAllThrowedDiscs, DiscManager.Instance.GetInRangeDiscs, disc);

        disc.SetIsBeingRecalled(true);
        disc.StartTrajectory(trajectoryParameters, null);
        currentlyInUseDiscs.Add(disc);
        disc.OnTrajectoryStopped += RemoveDiscFromInUse;

        OnSpecialLaunch?.Invoke();
    }
Exemple #3
0
    public void UpdateRecallPreparation()
    {
        Vector3 playerPos = _player.transform.position;
        Dictionary <DiscScript, DiscTrajectoryParameters> recallTrajectoryParameters = new Dictionary <DiscScript, DiscTrajectoryParameters>();

        List <DiscScript> recallableDiscs = DiscListingFactory.GetSortedRecallableDiscs(recallCompetence, DiscManager.Instance.GetAllThrowedDiscs, DiscManager.Instance.GetInRangeDiscs);

        foreach (DiscScript discInRange in recallableDiscs)
        {
            DiscTrajectoryParameters newParams =
                DiscTrajectoryFactory.GetTrajectory(recallCompetence, discInRange.transform.position, playerPos,
                                                    DiscManager.Instance.GetAllThrowedDiscs, DiscManager.Instance.GetInRangeDiscs, discInRange);
            recallTrajectoryParameters.Add(discInRange, newParams);
        }

        PreviewCompetencesManager.Instance.UpdateRecallPreview(recallTrajectoryParameters, playerPos);
    }
Exemple #4
0
    public static Dictionary <DiscScript, DiscTrajectoryParameters> GetDiscInRangeTrajectory(Vector3 targetPosition, CompetenceRecall recallCompetence)
    {
        List <DiscScript> recallableFromPosition =
            DiscListingFactory.GetSortedRecallableDiscs(recallCompetence,
                                                        DiscManager.Instance.GetAllThrowedDiscs, DiscManager.Instance.GetAllInRangeDiscsFromPosition(targetPosition));

        Dictionary <DiscScript, DiscTrajectoryParameters> allTrajParams = new Dictionary <DiscScript, DiscTrajectoryParameters>();

        foreach (DiscScript disc in recallableFromPosition)
        {
            DiscTrajectoryParameters newTrajParams =
                DiscTrajectoryFactory.GetTrajectory(recallCompetence, disc.transform.position, targetPosition,
                                                    DiscManager.Instance.GetAllThrowedDiscs, DiscManager.Instance.GetInRangeDiscs, disc);

            allTrajParams.Add(disc, newTrajParams);
        }
        return(allTrajParams);
    }
Exemple #5
0
    public void LaunchThrowCompetenceForReal()
    {
        currentlyInUseDiscs = new List <DiscScript>();

        DiscScript newDisc = DiscManager.Instance.TakeFirstDiscFromPossessedDiscs();

        if (newDisc == null)
        {
            //Debug.LogWarning("NO DISK TO THROW");
            return;
        }

        DiscTrajectoryParameters trajectoryParameters =
            DiscTrajectoryFactory.GetTrajectory(throwCompetence,
                                                _player.transform.position, GetInRangeThrowTargetPosition(currentThrowPosition),
                                                DiscManager.Instance.GetAllThrowedDiscs, DiscManager.Instance.GetInRangeDiscs, newDisc);

        newDisc.SetIsBeingRecalled(false);
        newDisc.SetRetreivableByPlayer(false);
        newDisc.StartTrajectory(trajectoryParameters, currentObjLauncher);
        currentlyInUseDiscs.Add(newDisc);
        newDisc.OnTrajectoryStopped    += RemoveDiscFromInUse;
        newDisc.OnReachedTrajectoryEnd += RemoveDiscFromInUse;
    }