Esempio n. 1
0
    IEnumerator ApplyEffect(KartMovement kart)
    {
        kart.AddKartModifier(boostStats);
        yield return(new WaitForSeconds(time));

        kart.RemoveKartModifier(boostStats);
    }
 void Awake()
 {
     trackManager = FindObjectOfType <TrackManager>();
     racer        = GetComponent <IRacer>();
     kart         = GetComponent <KartMovement>();
     startingPos  = this.transform.position;
     startingRot  = this.transform.rotation;
 }
Esempio n. 3
0
    /// <summary>
    ///   Instantiates the correct kart every level.
    /// </summary>
    public void InitLevel(string sceneName)
    {
        //print("InitLevel");
        GameObject trackManagerGO = GameObject.Find("TrackManager");
        GameObject displayGO      = GameObject.Find("TimeDisplayCanvas");


        GameObject kartGO  = null;
        Vector3    kartPos = Vector3.zero;

        if (sceneName == "Level1")
        {
            kartPos = sceneData.level1KartPos;
        }
        else if (sceneName == "Level2")
        {
            kartPos = sceneData.level2KartPos;
        }

        if (isVR)
        {
            kartGO = Instantiate(VRKart, kartPos, Quaternion.identity);
        }
        else
        {
            GameObject kartParent = Instantiate(mobileKart, Vector3.zero, Quaternion.identity);
            // Get the kart gameobject
            kartGO = kartParent.transform.GetChild(1).gameObject;
            kartGO.transform.position = kartPos;
        }


        // Add kart references to classes that require it
        KartMovement          movement     = kartGO.GetComponent <KartMovement>();
        Racer                 racer        = kartGO.GetComponent <Racer>();
        KartRepositionTrigger kartRepoTrig = trackManagerGO.GetComponent <KartRepositionTrigger>();
        TimeDisplay           display      = displayGO.GetComponent <TimeDisplay>();
        AudioSource           audio        = GameObject.Find("BackgroundMusic").GetComponent <AudioSource>();

        audio.enabled = true;
        audio.Play();

        kartRepoTrig.SetMovable(movement);
        display.SetRacer(racer);


        display.enabled      = true;
        kartRepoTrig.enabled = true;

        trackManagerGO.GetComponent <TrackManager>().StartTrackManager();
        display.StartDisplay();
        // Set the Racer for EndController
        endController             = GameObject.Find("EndGameController").GetComponent <EndController>();
        endController.playerRacer = racer;
    }
Esempio n. 4
0
    /// <summary>
    /// Initialize the agent
    /// </summary>
    public override void Initialize()
    {
        kartMovement = GetComponent <KartMovement>();
        checkpointHandler.checkpointReached += OnCheckpointReached;

        // If not training mode, no max step, play forever
        if (!trainingMode)
        {
            MaxStep = 0;
        }
    }
Esempio n. 5
0
        void Start()
        {
            rBody          = GetComponent <Rigidbody>();
            m_movable      = (KartMovement)movable;
            m_trackManager = trackManager.GetComponent <TrackManager>();
            racer          = GetComponent <IRacer>();

            // IInput relevant Params
            m_Acceleration = 0;
            m_Steering     = 0;
            m_BoostPressed = false;
            m_FirePressed  = false;
            isFirst        = true;
        }
Esempio n. 6
0
 public void StartOnTire(KartMovement car)
 {
     car.AddTire(this, degradeInterval, degradeValue);
 }
Esempio n. 7
0
 private void Awake()
 {
     movement = GetComponentInChildren <KartMovement>();
     pulse    = GetComponentInChildren <KartPulse>();
 }
Esempio n. 8
0
 public override void Trigger(KartMovement kart)
 {
     Instantiate(Spawn, kart.spawnPoint.transform.position, kart.spawnPoint.transform.rotation);
 }
Esempio n. 9
0
 public override void Trigger(KartMovement kart)
 {
     InstancedAction.DoRoutine(ApplyEffect(kart));
 }
Esempio n. 10
0
 public virtual void Trigger(KartMovement kart)
 {
 }