Inheritance: BaseController, IPointerClickHandler, IDragHandler
 // Start is called before the first frame update
 void Start()
 {
     currentStage     = Stages.WaitingForStart;
     doubleTapGesture = GameObject.Find("DoubleTapGesture");
     tapController    = GameObject.Find("Controller").GetComponent <TapController>();
     doubleTapGesture.SetActive(false);
 }
示例#2
0
 void _MakeInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
    public int GetFutureRealityIndex()
    {
        TapController tapController = GameObject.FindGameObjectWithTag(Tag.GameController)
                                      .GetComponent <TapController>();

        return(tapController.CountWaterTapsOff() + 1);
    }
    /* // Activate when debugging
     * void OnGUI()
     * {
     *  if(GUI.Button(new Rect(100,100, 300,100), "GUARDAR DATOS")) {
     *      SaveDataToDisk();
     *  }
     *
     *
     *  if(GUI.Button(new Rect(100,200, 300,100), "CARGAR DATOS")) {
     *      _LoadDataFromDisk();
     *  }
     * }
     */



    public static void SaveDataToDisk( )
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/" + FileName);

        GameObject            gc               = GameObject.FindGameObjectWithTag(SuriAlFuturo.Tag.GameController);
        DialogueController    dialogCtrl       = gc.GetComponent <DialogueController>();
        PersistenceController persistenceCtrl  = gc.GetComponent <PersistenceController>();
        CollectionSystem      collectionSystem = gc.GetComponent <CollectionSystem>();
        TapController         tapCtrl          = gc.GetComponent <TapController>();
        TimeTravelController  timeTravelCtrl   = gc.GetComponent <TimeTravelController>();
        EventController       eventCtrl        = gc.GetComponent <EventController>();

        SavedGame savedGame = new SavedGame();

        savedGame.Talkables       = dialogCtrl.SavedTalkableStates;
        savedGame.GameObjects     = persistenceCtrl.SavedGameObjects;
        savedGame.Collectables    = collectionSystem.SavedCollectables;
        savedGame.Blockers        = collectionSystem.SavedBlockers;
        savedGame.Inventory       = collectionSystem.Inventory;
        savedGame.Taps            = tapCtrl.SavedTaps;
        savedGame.CurrentReality  = timeTravelCtrl.CurrentReality;
        savedGame.TouchTriggers   = eventCtrl.SavedTouchTriggers;
        savedGame.TriggeredEvents = eventCtrl.TriggeredEvents;

        bf.Serialize(file, savedGame);
        file.Close();
    }
示例#5
0
 // Start is called before the first frame update
 void Start()
 {
     sun             = GameObject.Find("Sun");
     camera          = GetComponent <Camera>();
     tapController   = GameObject.Find("Controller").GetComponent <TapController>();
     pinchController = GameObject.Find("Controller").GetComponent <PinchController>();
     swipeController = GameObject.Find("Controller").GetComponent <SwipesController>();
 }
示例#6
0
 public void TapGC()
 {
     once = true;
     TapController.SetTrigger("Hide");
     InGamePanel.SetActive(true);
     audioS.volume = 0.8f;
     audioS.clip   = fondo;
     audioS.Play();
 }
示例#7
0
 // Start is called before the first frame update
 void Start()
 {
     mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraScript>();
     tapImage   = GameObject.Find("TapImage");
     tapImage.SetActive(false);
     tapController = GameObject.Find("Controller").GetComponent <TapController>();
     onClick       = () =>
     {
         StartNextStep();
     };
 }
示例#8
0
    // Start is called before the first frame update
    void Start()
    {
        tutorial                = GameObject.Find("Tutorial").GetComponent <TutorialScript>();
        loadGameScene           = GameObject.FindGameObjectWithTag("LoadSceneTag").GetComponent <LoadGameScene>();
        titleText               = GameObject.Find("3dPuzzleText");
        playButton              = GameObject.Find("PlayButton");
        settingsButton          = GameObject.Find("SettingsButton");
        settingsMenu            = GameObject.Find("SettingsMenu");
        htpButton               = GameObject.Find("HowToPlayButton");
        exitButton              = GameObject.Find("ExitButton");
        btmButton               = GameObject.Find("BackToMenuButton");
        solveButton             = GameObject.Find("SolveButton");
        planetNameInGame        = GameObject.Find("PlanetNameInGame");
        planetIsDoneText        = GameObject.Find("PlanetIsDoneText");
        pauseMenuBG             = GameObject.Find("PauseMenuBG");
        pauseMenuCanvas         = GameObject.Find("PauseMenuCanvas");
        pauseSettingsButton     = GameObject.Find("PauseSettingsButton");
        pauseMainMenuButton     = GameObject.Find("PauseMainMenuButton");
        dificultySwitcherScript = GameObject.Find("DificultySwitch").GetComponent <DificultySwitcherScript>();
        saveManager             = GameObject.FindGameObjectWithTag("LoadSceneTag").GetComponent <SaveManager>();
        tutorialCompleteText    = GameObject.Find("TutorialCompleteText");
        //difButtons[0] = GameObject.Find("NextDifButton");
        //difButtons[1] = GameObject.Find("PrevDifButton");
        settingsSwitcher = settingsMenu.GetComponent <ConfirmSettingsScript>();
        //playButton.GetComponent<Button>().onClick.AddListener(PlayTask);
        settingsButton.GetComponent <Button>().onClick.AddListener(SettingsTask);
        //btmButton.GetComponent<Button>().onClick.AddListener(BackTask);
        //exitButton.GetComponent<Button>().onClick.AddListener(ExitTask);
        //htpButton.GetComponent<Button>().onClick.AddListener(HowToPlayTask);
        //solveButton.GetComponent<Button>().onClick.AddListener(SolveTask);
        //pauseSettingsButton.GetComponent<Button>().onClick.AddListener(SettingFromPauseTask);
        //pauseMainMenuButton.GetComponent<Button>().onClick.AddListener(MainMenuButtonTask);
        tapController = GameObject.Find("Controller").GetComponent <TapController>();

        btmButton.SetActive(false);
        solveButton.SetActive(false);
        settingsMenu.SetActive(false);
        planetNameInGame.SetActive(false);
        pauseMenuBG.SetActive(false);
        pauseMenuCanvas.SetActive(false);
        planetIsDoneText.SetActive(false);
        solarSystem = GameObject.FindGameObjectWithTag("Sun").GetComponent <SolarSystem>();
        mainCamera  = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraScript>();

        planetInfoPanels = GameObject.FindGameObjectsWithTag("InfoPanel");
        foreach (GameObject infoPanel in planetInfoPanels)
        {
            infoPanel.SetActive(false);
        }

        currentPhase = UI_Phase.MainMenu;
    }
    void Start()
    {
        SpotlightInterval = ReadFloat(GeneralProperties.SPOTLIGHT_INTERVAL);
        SpotlightMinDelay = ReadFloat(GeneralProperties.SPOTLIGHT_MIN_DELAY);
        SpotlightMaxDelay = ReadFloat(GeneralProperties.SPOTLIGHT_MAX_DELAY);
        SpotlightTapMultiplier = ReadFloat(GeneralProperties.SPOTLIGHT_TAP_MULTIPLIER);

        initSpotlightCountdown = CalculateAliveTime();

        spotlightUI.aliveTime = SpotlightInterval;

        tapController = FindObjectOfType<TapController>();
        tapController.SpotlightTapMultiplier = SpotlightTapMultiplier;
    }
示例#10
0
 public void Setup()
 {
     GM       = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/FlappyXO/Main Camera")).GetComponent <GameManager>();
     canvas   = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/FlappyXO/Canvas"));
     X        = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/FlappyXO/x"));
     O        = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/FlappyXO/o"));
     start    = canvas.transform.GetChild(2).gameObject;
     GameOver = canvas.transform.GetChild(3).gameObject;
     XTap     = X.GetComponent <TapController>();
     OTap     = O.GetComponent <TapController>();
     GM.SetStartPage(start);
     GM.gameOverPage = GameOver;
     environment     = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/FlappyXO/Environment"));
 }
示例#11
0
    void Start()
    {
        _isOn          = true;
        _isUsable      = GetComponent <Collider>().enabled;
        PersistenceKey = this.transform.position;

        _fountain       = GetComponentInChildren <ParticleSystem>();
        _gameController = GameObject.FindGameObjectWithTag(Tag.GameController)
                          .GetComponent <GameController>();
        _timeTravelController = _gameController.GetComponent <TimeTravelController>();
        _tapController        = _gameController.GetComponent <TapController>();

        _tapController.Taps.Add(this);
        _tapController.Load(this);
    }
 protected override void Start()
 {
     try
     {
         if (_started) return;
         base.Start();
         var parent = transform.parent;
         MouseController = parent.GetComponent<MouseController>();
         TapController = parent.GetComponent<TapController>();
         CurrentEffect = DamageEffect.None;
         damageAnimation.renderer.enabled = false;
         damageAnimation.Stop();
         _started = true;
     }
     catch (Exception e)
     {
         LogHandler.Handle(e);
     }
 }
示例#13
0
    //TODO: Get scaleData from remote
    void Start()
    {
        goldController = GoldController.Instance;
        goldController.SetGoldView(goldView);
        goldgeneratorControllers = new List <GoldGeneratorController>();
        circleControllers        = new List <CircleController>(CircleViews.Length);

        for (int i = 0; i < CircleViews.Length; i++)
        {
            CircleController controller = new CircleController(CircleViews[i], scaleData, goldController.ChangeGoldValue);
            controller.OnPurchased += OnCirclePurchased;
            circleControllers.Add(controller);
        }

        goldgeneratorControllers.AddRange(circleControllers);

        tapController = new TapController(tapView, blockView, scaleData, goldController.ChangeGoldValue);

        goldgeneratorControllers.Add(tapController);
    }
    private static void _LoadDataFromDisk()
    {
        string nombreArch = Application.persistentDataPath + "/" + FileName;

        GameObject            gc               = GameObject.FindGameObjectWithTag(SuriAlFuturo.Tag.GameController);
        DialogueController    dialogCtrl       = gc.GetComponent <DialogueController>();
        PersistenceController persistenceCtrl  = gc.GetComponent <PersistenceController>();
        CollectionSystem      collectionSystem = gc.GetComponent <CollectionSystem>();
        TapController         tapCtrl          = gc.GetComponent <TapController>();
        TimeTravelController  timeTravelCtrl   = gc.GetComponent <TimeTravelController>();
        EventController       eventCtrl        = gc.GetComponent <EventController>();

        if (File.Exists(nombreArch))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(nombreArch, FileMode.Open);

            SavedGame savedGame = (SavedGame)bf.Deserialize(file);

            file.Close();

            dialogCtrl.SavedTalkableStates     = savedGame.Talkables;
            persistenceCtrl.SavedGameObjects   = savedGame.GameObjects;
            collectionSystem.SavedCollectables = savedGame.Collectables;
            collectionSystem.SavedBlockers     = savedGame.Blockers;
            collectionSystem.Inventory         = savedGame.Inventory;
            tapCtrl.SavedTaps             = savedGame.Taps;
            timeTravelCtrl.CurrentReality = savedGame.CurrentReality;
            eventCtrl.SavedTouchTriggers  = savedGame.TouchTriggers;
            eventCtrl.TriggeredEvents     = savedGame.TriggeredEvents;
        }
        else
        {
            SaveDataToDisk();
        }
    }
示例#15
0
 void Awake()
 {
     hudUI = (HudUI)FindObjectOfType(typeof(HudUI));
     tapController = (TapController)FindObjectOfType(typeof(TapController));
     tourController = (TourController)FindObjectOfType(typeof(TourController));
 }
示例#16
0
 public void Awake()
 {
     Instance = this;
 }
示例#17
0
 private void Start()
 {
     tapController = GameObject.Find("Controller").GetComponent <TapController>();
 }
示例#18
0
 void Start()
 {
     tapController         = GameObject.Find("Controller").GetComponent <TapController>();
     doubleTapSubscription = tapController.SubscribeToTap(TapController.Tap.DoubleTap, _DoubleTapHandler);
     tapSubscription       = tapController.SubscribeToTap(TapController.Tap.Tap, _TapHandler);
 }
示例#19
0
    //----------------------GAME REGION END---------------------

    private void Start()
    {
        //------------------UI REGION START--------------------------------------
        mainMenuScreen   = GameObject.Find("MainMenuUI").GetComponent <UIDocument>().rootVisualElement;
        settingScreen    = GameObject.Find("SettingsMenuUI").GetComponent <UIDocument>().rootVisualElement;
        pauseScreen      = GameObject.Find("PauseMenuUI").GetComponent <UIDocument>().rootVisualElement;
        areYouSureScreen = GameObject.Find("AreYouSureMenuUI").GetComponent <UIDocument>().rootVisualElement;
        backButtonScreen = GameObject.Find("BackUI").GetComponent <UIDocument>().rootVisualElement;
        planetInfoScreen = GameObject.Find("PlanetInfoUI").GetComponent <UIDocument>().rootVisualElement;
        endScreen        = GameObject.Find("EndUI").GetComponent <UIDocument>().rootVisualElement;

        settingScreen.style.display    = DisplayStyle.None;
        pauseScreen.style.display      = DisplayStyle.None;
        areYouSureScreen.style.display = DisplayStyle.None;
        backButtonScreen.style.display = DisplayStyle.None;
        planetInfoScreen.style.display = DisplayStyle.None;
        endScreen.style.display        = DisplayStyle.None;

        mainMenuScreen?.Q("settings-button")?.RegisterCallback <ClickEvent>(ev => SettingsScreen());
        mainMenuScreen?.Q("play-button")?.RegisterCallback <ClickEvent>(ev => PlayTask());
        mainMenuScreen?.Q("how-to-play-button")?.RegisterCallback <ClickEvent>(ev => HowToPlay());

        settingScreen?.Q("close-button")?.RegisterCallback <ClickEvent>(ev => SettingsBack());
        settingScreen?.Q("sound-button")?.RegisterCallback <ClickEvent>(ev => SettingsSound());
        settingScreen?.Q("difficulty-button")?.RegisterCallback <ClickEvent>(ev => SettingsDifficulty());

        pauseScreen?.Q("settings-button")?.RegisterCallback <ClickEvent>(ev => SettingsScreen());
        pauseScreen?.Q("close-button")?.RegisterCallback <ClickEvent>(ev => BackTask());
        pauseScreen?.Q("mainmenu-button")?.RegisterCallback <ClickEvent>(ev => MainMenuTask());

        areYouSureScreen?.Q("agree-button")?.RegisterCallback <ClickEvent>(ev => AgreeTask());
        areYouSureScreen?.Q("disagree-button")?.RegisterCallback <ClickEvent>(ev => DisagreeTask());

        backButtonScreen?.Q("back-button")?.RegisterCallback <ClickEvent>(ev => BackTask());

        planetInfoScreen?.Q("solve-button")?.RegisterCallback <ClickEvent>(ev => SolveTask());

        endScreen?.Q("exit-button")?.RegisterCallback <ClickEvent>(ev => { PuzzleSolvedHide(); AgreeTask(); });
        endScreen?.Q("next-button")?.RegisterCallback <ClickEvent>(ev =>
        {
            difficulty = (difficulty == Difficulty.Hard) ? Difficulty.Easy : difficulty + 1;
            SolveTask();
            endScreen.style.display = DisplayStyle.None;
        });

        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        //------------------UI REGION END--------------------------------------


        //------------------GAME REGION START-----------------------------------------------
        planetIsDoneText = GameObject.Find("PlanetIsDoneText");
        planetIsDoneText.SetActive(false);
        audioSource   = GameObject.Find("AudioSource").GetComponent <AudioSource>();
        tutorial      = GameObject.Find("Tutorial").GetComponent <TutorialScript>();
        solarSystem   = GameObject.FindGameObjectWithTag("Sun").GetComponent <SolarSystem>();
        mainCamera    = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraScript>();
        loadGameScene = GameObject.FindGameObjectWithTag("LoadSceneTag").GetComponent <LoadGameScene>();
        saveManager   = GameObject.FindGameObjectWithTag("LoadSceneTag").GetComponent <SaveManager>();
        tapController = GameObject.Find("Controller").GetComponent <TapController>();
        //------------------GAME REGION END-----------------------------------------------
    }
示例#20
0
    public void SetValues()
    {
        //Deal with Camera's and render textures
        mainCam     = GameObject.Find("Main Camera").GetComponent <Camera>();
        uiCam       = GameObject.Find("ViewUICam").GetComponent <Camera>();
        dinoCam     = GameObject.Find("ViewDinoCam").GetComponent <Camera>();
        uiRendTex   = GameObject.Find("ViewUIRendTex").GetComponent <RenderTexture>();
        dinoRendTex = GameObject.Find("ViewDinoRendTex").GetComponent <RenderTexture>();
        if (dinoRendTex != null && uiRendTex != null)
        {
            uiCam.targetTexture = uiRendTex; dinoCam.targetTexture = dinoRendTex;
        }

        //Deal with Scripts
        NewGameOverScreen ngo = FindObjectOfType <NewGameOverScreen>();

        gameOverScreen = ngo; tapController = FindObjectOfType <TapController>();

        NewGameValues gv = FindObjectOfType <NewGameValues>();

        gameValues = gv; gv.TimeGO = GameObject.Find("Time Display");
        if (gv.TimeGO != false)
        {
            gv.TimeTXT = gv.TimeGO.GetComponent <Text>();
        }
        gameValues.ScoreTXT       = GameObject.Find("YourScore").GetComponent <Text>();
        gameValues.GameOverScreen = ngo.transform.gameObject;
        gameOverScreen.GV         = gameValues; if (music != null)
        {
            gameOverScreen.Music = music;
        }
        ngo.GV = gv; gv.NGOS = ngo;

        SpecialMeter sm = FindObjectOfType <SpecialMeter>();

        specialMeter        = sm; sm.AS = music.GetComponent <AudioSource>();
        sm.MultiPlyUI       = GameObject.Find("ScoreMultiplied");
        scoreMultiplied     = sm.MultiPlyUI; sm.GV = gameValues;
        sm.NormalTrailRend  = GameObject.Find("TR1");
        sm.SpecialTrailRend = GameObject.Find("TR2");
        specialMeter.GM     = this; specialMeter.GV = gameValues;
        if (gv.boostr != null)
        {
            gv.boostr.SM = specialMeter;
        }
        gv.boostr.GV = gv;

        //Complex dealings
        NewDeliveryPointManager dpm = FindObjectOfType <NewDeliveryPointManager>();

        if (dpm != null)
        {
            dpManager = dpm; dpManager.SM = specialMeter; sm.DPmanager = dpManager;
        }

        SlotManager slot = FindObjectOfType <SlotManager>();

        slotManager = slot; gv.SM = slotManager; slot.GV = gameValues;

        foreach (Transform child in dpManager.transform)
        {
            NewDeliveryPoint dp = child.GetComponent <NewDeliveryPoint>();
            dp.SlotMgr = slot;
        }

        Image img = GameObject.Find("DinoImage").GetComponent <Image>();

        dinoImage = img; gameValues.CharImg = img;

        specialMeter.Indicators.Clear();
        foreach (Transform child in indicatorParent)
        {
            specialMeter.Indicators.Add(child.gameObject.GetComponent <Image>());
        }

        gameValues.SDelGO = GameObject.Find("Successful Deliveries");
        foreach (Transform t in gameValues.SDelGO.transform)
        {
            if (t.name == "SDel_Txt")
            {
                successfulDisplay  = t.gameObject.GetComponent <Text>();
                gameValues.SDelTXT = successfulDisplay;
            }
        }
        gameValues.FDelGO = GameObject.Find("Failed Deliveries");
        foreach (Transform t in gameValues.FDelGO.transform)
        {
            if (t.name == "FDel_Txt")
            {
                failedDisplay      = t.gameObject.GetComponent <Text>();
                gameValues.FDelTXT = failedDisplay;
            }
        }//Pterodactyls
        GameObject ptero = GameObject.Find("Pterodactyls");

        if (ptero != false)
        {
            pteros.Clear();
            foreach (Transform child in ptero.transform)
            {
                pteros.Add(child.GetComponent <PteroDactyl>());
            }
            GameObject stolenUI = GameObject.Find("PostStolen"); GameObject shakeUI = GameObject.Find("ShakePrompt");
            Image      shake = GameObject.Find("ShakeMeter").GetComponent <Image>(); GameObject pteroNice = GameObject.Find("Nice");
            foreach (PteroDactyl pt in pteros)
            {
                pt.DPmanager  = dpManager; pt.SManager = slotManager; pt.StolenUI = stolenUI; pt.ShakePrompt = shakeUI;
                pt.ShakeMeter = shake; pt.Nice = pteroNice;
            }
        }
    }