Exemplo n.º 1
0
    public void ActivateForBuggy(BuggyBuddy selectedBuggy)
    {
        buggy = selectedBuggy;

        ClearStartArea();

        GetControllerByBuggy(buggy).resetter.CancelReset(); // cancel reset process in case buggy is in the middle of dying

        buggy.transform.position   = buggyStartPosition.position;
        buggy.transform.rotation   = buggyStartPosition.rotation;
        buggy.body.velocity        = Vector3.zero;
        buggy.body.angularVelocity = Vector3.zero;

        SwitchState(RaceStates.WaitingForRace);
        //StartCoroutine(TeleportPlayerToTransform(playerStandingPosition));
    }
Exemplo n.º 2
0
    void ClearStartArea()
    {
        // find any other buggies in start area and reset them out of the way.

        Collider[]        cols           = Physics.OverlapSphere(buggyStartPosition.position, 5);
        List <BuggyBuddy> buggiesCleared = new List <BuggyBuddy>();

        for (int i = 0; i < cols.Length; i++)
        {
            if (cols[i].attachedRigidbody != null)
            {
                BuggyBuddy b = cols[i].attachedRigidbody.GetComponent <BuggyBuddy>();
                if (b != null)
                {
                    if (!buggiesCleared.Contains(b) && b != buggy)
                    {
                        buggiesCleared.Add(b);
                        GetControllerByBuggy(b).resetter.ResetBuggy();
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
 BuggyControllerMoon GetControllerByBuggy(BuggyBuddy b)
 {
     return(Array.Find(buggies, c => c.buggy == b).controller);
 }
Exemplo n.º 4
0
 public BuggySystem(BuggyControllerMoon controller, BuggyBuddy buggy)
 {
     this.controller = controller;
     this.buggy      = buggy;
 }