Exemplo n.º 1
0
 void InitModules()
 {
     GiraffeSystem.Register(new UIModule());
     GiraffeSystem.Register(new RaceModule());
     GiraffeSystem.Register(new TutorialModule());
     GiraffeSystem.Register(new CreditModule());
 }
Exemplo n.º 2
0
    void Start()
    {
        inputHandler = gameObject.GetComponent <InputHandler>();
        TimeSystem.GetTimeSystem().AddTimer(this);
        uiModule = GiraffeSystem.FindModule <UIModule>();

        playerCamera = gameObject.GetComponentInChildren <RaceCamera>();
        rigidbody    = gameObject.GetComponentInChildren <Rigidbody>();

        var root = GameObject.Find("Root");

        indicator = root.FindChildByName("Billboard").GetComponent <EmoticonIndicator>();
        ghost     = root.FindChildByName("Ghost");

        //inputHandler.OnUpKey = () => { AddForce(Vector3.back); };
        inputHandler.OnDownKey     = () => { AddForce(Vector3.forward); };
        inputHandler.OnLeftKey     = () => { AddForce(Vector3.left); };
        inputHandler.OnRightKey    = () => { AddForce(Vector3.right); };
        inputHandler.OnInputFinish = ProcessForce;
        inputHandler.OnSpaceDown   = TryBooster;

        // audio
        dragging = gameObject.FindChildByName("Dragging").GetComponent <AudioSource>();
        booster  = gameObject.FindChildByName("Booster").GetComponent <AudioSource>();
    }
Exemplo n.º 3
0
    void Init()
    {
        Config.Init();
        GiraffeSystem.Init();

        InitPlugins();
        InitModules();
    }
Exemplo n.º 4
0
 void DoCutscene()
 {
     DOVirtual.DelayedCall(3f, () =>
     {
         new PopupMsg()
         {
             Message = "Wanna replay? It gets harder!",
             OnClick = () =>
             {
                 var raceModule = GiraffeSystem.FindModule <RaceModule>();
                 raceModule.IncreaseDifficulty();
                 new StartRaceMsg().Dispatch();
             },
             ButtonMessage = "Restart",
         }.Dispatch();
     });
 }
Exemplo n.º 5
0
    public void Reset()
    {
        if (trackController == null)
        {
            var raceModule = GiraffeSystem.FindModule <RaceModule>();
            trackController = raceModule.TrackController;
        }

        if (movingTween != null)
        {
            movingTween.Kill();
        }
        currentCheckPointIndex = 0;
        transform.position     = trackController.StartGo.transform.position;
        gameObject.SetActive(false);

        // audio
        crying           = gameObject.FindChildByName("Cry").GetComponent <AudioSource>();
        moving           = gameObject.FindChildByName("Moving").GetComponent <AudioSource>();
        currentSpeedUnit = SpeedPerUnit;
    }
Exemplo n.º 6
0
    void PlayCreditScene()
    {
        var raceModule = GiraffeSystem.FindModule <RaceModule>();
        var player     = raceModule.Player;

        player.indicator.SleepEmote();
        player.StopCar();
        runTime                 = Time.timeSinceLevelLoad - raceModule.Timer;
        timeText.text           = "Run Time : " + runTime.ToString();
        InputHandler.InputBlock = true;

        player.lastEnergy = Vector3.zero;

        player.transform.DOMove(targetPos.transform.position, 5f).OnComplete(() =>
        {
            player.transform.DORotate(targetPos.transform.localEulerAngles, 2f).OnComplete(() =>
            {
                mainCanvas.SetActive(true);
                DoCutscene();
            });
        });
    }
Exemplo n.º 7
0
    void Reset()
    {
        // 이부분도 나중에 플레이어로 옮겨놓기
        Player.transform.position         = startPos.transform.position.OverrideY(0.5f);
        Player.transform.localEulerAngles = new Vector3(0f, 180f, 0f);
        Player.gameObject.SetActive(true);

        ghost.Reset();

        foreach (var pad in TrackController.BoosterPads)
        {
            pad.Reset();
        }

        InputHandler.InputBlock = false;

        var creditModule = GiraffeSystem.FindModule <CreditModule>();

        if (creditModule != null)
        {
            creditModule.Reset();
        }
    }
Exemplo n.º 8
0
 public void Dispatch()
 {
     GiraffeSystem.ProcessMessage(this);
 }