Ejemplo n.º 1
0
    public override void Initialize()
    {
        base.Initialize();

#if UNITY_EDITOR
        AFAssetManager.SimulatedDPI     = AFAssetManager.DPI_IPAD_3;
        AFAssetManager.SimulatePlatform = AFAssetManager.EPlataform.IOS;
#endif

        m_interface    = GameObject.Find("ButtonsCanvas");
        m_btBateRebate = GameObject.Find("BateRebateButton");
        m_btCataBalao  = GameObject.Find("CataBalaoButton");
        m_btQuebraCuca = GameObject.Find("QuebraCucaButton");
        m_background   = GameObject.Find("Background");

        m_bateRebateButton = m_btBateRebate.GetComponent <Button>();
        m_quebraCucaButton = m_btQuebraCuca.GetComponent <Button>();
        m_cataBalaoButton  = m_btCataBalao.GetComponent <Button>();

        SetButtonView(m_btBateRebate.GetComponent <Image>(), "Scenes/StartScene/BateRebate");
        SetButtonView(m_btCataBalao.GetComponent <Image>(), "Scenes/StartScene/Button_CataBalao");
        SetButtonView(m_btQuebraCuca.GetComponent <Image>(), "Scenes/StartScene/QuebraCuca");
        SetButtonView(m_background.GetComponent <Image>(), "Scenes/StartScene/Background");

        m_bateRebateButton.onClick.AddListener(() => { OnBaterebateButtonCLickHandler(); });
        m_quebraCucaButton.onClick.AddListener(() => { OnQuebraCucaButtonCLickHandler(); });
        m_cataBalaoButton.onClick.AddListener(() => { OnCataBalaoButtonCLickHandler(); });

        AFDebug.Log(AFAssetManager.GetDirectoryOwner("Sound/sfxWrongHit"));
        AFSoundManager.Instance.Add(AFAssetManager.GetDirectoryOwner("Sounds/sfxWrongHit"), null, 1.0f, 1.0f, false, false);
    }
Ejemplo n.º 2
0
        private void CreateUI()
        {
            pauseScene      = AFAssetManager.Instance.Instantiate <GameObject>(AFAssetManager.GetDirectoryOwner(pauseScenePreFabUrl));
            pauseScene.name = "pauseTela";
            pauseScene.AddComponent <BatePauseState>().StartScene(this);
            pauseScene.SetActive(false);
            Add(pauseScene);

            scoreLeftOver  = GameObject.Find("scoreLeftOver");
            scoreRightOver = GameObject.Find("scoreRightOver");
            Font typographyofcoop = Resources.Load <Font>(AFAssetManager.GetDirectoryOwner("Fonts/TypographyofCoop-Black"));

            scoreLeftOver.GetComponent <Text>().font            = typographyofcoop;
            scoreLeftOver.GetComponent <Text>().fontSize        = 230;
            scoreLeftOver.GetComponent <Text>().supportRichText = true;

            scoreRightOver.GetComponent <Text>().font            = typographyofcoop;
            scoreRightOver.GetComponent <Text>().fontSize        = 230;
            scoreRightOver.GetComponent <Text>().supportRichText = true;

            pauseBtn = GameObject.Find("pausebtn");
            pauseBtn.GetComponent <Image>().sprite         = AFAssetManager.Instance.Instantiate <Sprite>(pauseBtnAssetUrl);
            pauseBtn.GetComponent <Image>().preserveAspect = true;
            pauseBtn.GetComponent <Button>().onClick.AddListener(OnClickPause);
        }
Ejemplo n.º 3
0
        public override void BuildState()
        {
            main = BateController.Instance;

            m_selectionScene = AFAssetManager.Instance.Instantiate <GameObject>(AFAssetManager.GetDirectoryOwner("preFabs/PreFabSelectionScene"));

            background = GameObject.Find("BG");
            bgAssetUrl = main.AddPlatformAndQualityToUrl(bgAssetUrl);
            background.GetComponent <Image>().sprite         = AFAssetManager.Instance.Instantiate <Sprite>(bgAssetUrl);
            background.GetComponent <Image>().preserveAspect = true;

            btP1       = GameObject.Find("onePBtn");
            p1AssetUrl = main.AddPlatformAndQualityToUrl(p1AssetUrl);
            btP1.GetComponent <Image>().sprite = AFAssetManager.Instance.Instantiate <Sprite>(p1AssetUrl);
            btP1.GetComponent <Button>().onClick.AddListener(OnClickP1);
            btP1.GetComponent <Image>().preserveAspect = true;

            btP2       = GameObject.Find("twoPBtn");
            p2AssetUrl = main.AddPlatformAndQualityToUrl(p2AssetUrl);
            btP2.GetComponent <Image>().sprite = AFAssetManager.Instance.Instantiate <Sprite>(p2AssetUrl);
            btP2.GetComponent <Button>().onClick.AddListener(OnClickP2);
            btP2.GetComponent <Image>().preserveAspect = true;

            Add(m_selectionScene);

            base.BuildState();
        }
Ejemplo n.º 4
0
        public override void BuildState()
        {
            main              = BateController.Instance;
            main.IsPaused     = false;
            main.IsSounding   = true;
            main.PlayerNumber = 1;

            bgAssetUrl       = main.AddPlatformAndQualityToUrl(bgAssetUrl);
            titleAssetUrl    = main.AddPlatformAndQualityToUrl(titleAssetUrl);
            btJogarAssetUrl  = main.AddPlatformAndQualityToUrl(btJogarAssetUrl);
            btVoltarAssetUrl = main.AddPlatformAndQualityToUrl(btVoltarAssetUrl);

            m_menuScene = AFAssetManager.Instance.Instantiate <GameObject>(AFAssetManager.GetDirectoryOwner("preFabs/PreFabMenuScene"));

            background      = GameObject.Find("menuBg");
            backgroundTitle = GameObject.Find("menuTitle");
            btJogar         = GameObject.Find("menuBtJogar");
            btVoltar        = GameObject.Find("menuBtVoltar");

            background.transform.localScale      = Vector3.one;
            backgroundTitle.transform.localScale = Vector3.one;
            btJogar.transform.localScale         = Vector3.one;
            btVoltar.transform.localScale        = Vector3.one;

            background.GetComponent <Image>().sprite         = AFAssetManager.Instance.Instantiate <Sprite>(bgAssetUrl);
            background.GetComponent <Image>().preserveAspect = true;

            backgroundTitle.GetComponent <Image>().sprite         = AFAssetManager.Instance.Instantiate <Sprite>(titleAssetUrl);
            backgroundTitle.GetComponent <Image>().preserveAspect = true;

            btJogar.GetComponent <Image>().sprite         = AFAssetManager.Instance.Instantiate <Sprite>(btJogarAssetUrl);
            btJogar.GetComponent <Image>().preserveAspect = true;

            btVoltar.GetComponent <Image>().sprite         = AFAssetManager.Instance.Instantiate <Sprite>(btVoltarAssetUrl);
            btVoltar.GetComponent <Image>().preserveAspect = true;

            btJogar.GetComponent <Button>().onClick.AddListener(OnBtJogarClick);
            btVoltar.GetComponent <Button>().onClick.AddListener(OnBtVoltarClick);

            Add(m_menuScene);

            AddSounds();

            base.BuildState();
        }
Ejemplo n.º 5
0
        public override void BuildState()
        {
            main         = BateController.Instance;
            gameScene    = AFAssetManager.Instance.Instantiate <GameObject>(AFAssetManager.GetDirectoryOwner("preFabs/PreFabGameScene"));
            playerNumber = main.PlayerNumber;

            VerifyScreenRes();
            CreateBackGround();
            CreateWalls();
            CreateUI();
            CreateBall();
            CreatePaddles();
            CreateTouches();
            touchLeft.GetComponent <PaddleBehaviour>().AwakenPaddle();
            touchRight.GetComponent <PaddleBehaviour>().AwakenPaddle();
            ball.GetComponent <BallBehaviour>().AwakeBall();

            Add(gameScene);

            base.BuildState();
        }
Ejemplo n.º 6
0
 private void OnBaterebateButtonCLickHandler()
 {
     AFSoundManager.Instance.Play(AFAssetManager.GetDirectoryOwner("Sounds/sfxWrongHit"));
     //m_bateRebateButton.onClick.RemoveAllListeners();
     //Application.LoadLevel(GAME_BATE_RETATE);
 }
Ejemplo n.º 7
0
 private void CreateBall()
 {
     ball      = new GameObject();
     ball.name = "ball";
     ball.AddComponent <SpriteRenderer>().sprite = AFAssetManager.Instance.Instantiate <Sprite>(ballAsset);
     ball.AddComponent <CircleCollider2D>();
     ball.AddComponent <Rigidbody2D>().mass         = 0.00001f;
     ball.GetComponent <Rigidbody2D>().gravityScale = 0f;
     ball.collider2D.sharedMaterial = AFAssetManager.Instance.Instantiate <PhysicsMaterial2D>(AFAssetManager.GetDirectoryOwner("Materials/ballMaterial"));
     ball.transform.position        = new Vector3(GetPos().x, GetPos().y, 0);
     ball.AddComponent <BallBehaviour>();
     ball.GetComponent <BallBehaviour>().scoreLeftOver  = scoreLeftOver;
     ball.GetComponent <BallBehaviour>().scoreRightOver = scoreRightOver;
     Add(ball);
 }