예제 #1
0
    public AFStatesController buildHeroAnimation()
    {
        AFStatesController m_heroStates;

        UnityEngine.Debug.Log(AFAssetManager.GetPathTargetPlatformWithResolution() + "/" + "hero_sprites");
        AFTextureAtlas heroAtlas = AFAssetManager.Instance.Load <AFTextureAtlas>(AFAssetManager.GetPathTargetPlatformWithResolution() + "/" + "hero_sprites");

        m_heroStates = AFObject.Create <AFStatesController>("Hero Controller");

        AFMovieClip animation = AFObject.Create <AFMovieClip>("small_walk");

        animation.Init(heroAtlas.GetSprites("small_walk"));
        animation.gameObject.AddComponent <BoxCollider2D>();
        m_heroStates.Add("small_walk", animation, false);

        animation = AFObject.Create <AFMovieClip>("small_stop");
        animation.Init(heroAtlas.GetSprites("small_stop"));
        animation.gameObject.AddComponent <BoxCollider2D>();
        m_heroStates.Add("small_stop", animation, true);

        m_heroStates.gameObject.AddComponent <Rigidbody2D>();

        m_heroStates.transform.localScale = new UnityEngine.Vector3(3, 3, 3);

        return(m_heroStates);
    }
예제 #2
0
        public void Initialize()
        {
            _characterAnimations = AFObject.Create <AFStatesController>();

            string     path      = PathConstants.GetGameScenePath() + "cucaSprites";
            AMovieClip animation = AnimationFactory.Instance.BuildAnimation(path, STATE_HITED);

            _characterAnimations.Add(STATE_HITED, animation, false);

            animation = AnimationFactory.Instance.BuildAnimation(path, STATE_ANGRY);
            _characterAnimations.Add(STATE_ANGRY, animation, false);

            animation = AnimationFactory.Instance.BuildAnimation(path, STATE_IDLE);
            _characterAnimations.Add(STATE_IDLE, animation, true);


            _characterAnimations.gameObject.transform.parent = this.gameObject.transform;
            _sprite = _characterAnimations.GetCurrentState().GetSprite();
            this.gameObject.AddComponent <BoxColliderResizer>().Initialize();

            if (this.gameObject.GetComponent <AnimationController>())
            {
                this.gameObject.GetComponent <AnimationController>().Initialize();
            }
        }
예제 #3
0
        public override void BuildState()
        {
            if (this.gameObject.GetComponent <IndexController>() == false)
            {
                this.gameObject.AddComponent <IndexController>().Start();
            }

            CreateCamera();
            CreateBackground();
            CreatePullOfCharacters();

            _controller = AFObject.Create <GameController>();
            _controller.gameObject.transform.parent = this.gameObject.transform;
            _controller.Initialize();
            _controller.SetAnchorTarget(_cameraGameObject);

            if (this.gameObject.GetComponent <HudController>() == false)
            {
                this.gameObject.AddComponent <HudController>();
            }
            this.gameObject.GetComponent <HudController>().SetAnchorTarget(_cameraGameObject);

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

            CreateParticles();
            base.BuildState();
        }
예제 #4
0
        public override void Initialize()
        {
            AFAssetManager.SetDirectoryOwner("QuebraCuca");

            m_stateManager = AFObject.Create <AFStateManager>();

            m_stateManager.Initialize(new GameStateFactory());

            _resolutionController = ResolutionController.Instance();
            _paths  = PathConstants.Instance();
            _sounds = SoundConstants.Instance();

            GameObject _soundManager = new GameObject();

            _soundManager.name = "SoundManager";
            _soundManager.AddComponent <SoundManager>().Init();
            //SoundManager.PlaySoundByName(SoundConstants.BG_SOUND);

            AFSingleTransition tras = AFObject.Create <AFSingleTransition>();
            SpriteRenderer     sr   = tras.gameObject.AddComponent <SpriteRenderer>();

            sr.transform.position   = new Vector3(0, 0, 6);
            sr.sprite               = AFAssetManager.Instance.CreateSpriteFromTexture("Common/High/loadingscreen");
            sr.transform.localScale = new Vector3(1, 1, 1);
            m_stateManager.AddTransition(tras);

            m_stateManager.GotoState(AState.EGameState.MENU);

            base.Initialize();
        }
예제 #5
0
        public AFMovieClip BuildAnimation(string spritePath, string animationStateName)
        {
            AFMovieClip    L_animation;
            AFTextureAtlas L_heroAtlas = AFAssetManager.Instance.Load <AFTextureAtlas>(spritePath);

            L_animation = AFObject.Create <AFMovieClip>(animationStateName);
            L_animation.Init(L_heroAtlas.GetSprites(animationStateName));
            return(L_animation);
        }
예제 #6
0
    public IState CreateStateByID(AState.EGameState newstateID)
    {
        switch (newstateID)
        {
        case AState.EGameState.GAME:
            return(AFObject.Create <MarioGameState>());
        }


        return(null);
    }
예제 #7
0
        public IState CreateStateByID(AState.EGameState newStateID)
        {
            switch (newStateID)
            {
            case AState.EGameState.MENU:
                return(AFObject.Create <MenuState>());

            case AState.EGameState.GAME:
                return(AFObject.Create <GameState>());
            }
            return(null);
        }
예제 #8
0
    public IState CreateStateByID(AState.EGameState newStateID)
    {
        switch (newStateID)
        {
        case AState.EGameState.MENU:
            StartState loginS = AFObject.Create <StartState>();
            loginS.SetStateID(AState.EGameState.MENU);
            return(loginS);
        }

        return(null);
    }
예제 #9
0
    // Initialize your game
    public override void Initialize()
    {
        // You need create a StateManger
        m_stateManager = AFObject.Create <AFStateManager>();

        // You need a factory of states to initialize your engine, here is where you will declarate all your states.
        m_stateManager.Initialize(new MarioGameStateFactory());

        //Sending the state to game state
        m_stateManager.GotoState(AState.EGameState.GAME);

        //Call the Init of AFEngine
        base.Initialize();
    }
예제 #10
0
        public static AFSound Create(
            string name,
            AudioClip audio,
            Transform emitter    = null,
            float volume         = 1.0f,
            float pitch          = 1.0f,
            bool loop            = false,
            bool playOncePertime = true)
        {
            AFSound L_sound = AFObject.Create <AFSound>(name);

            L_sound.Initialize(name, audio, emitter, volume, pitch, loop, playOncePertime);
            return(L_sound);
        }
예제 #11
0
        public IState CreateStateByID(AState.EGameState newstateID)
        {
            switch (newstateID)
            {
            case AState.EGameState.MENU:
                return(AFObject.Create <BateMenuState>());

            case AState.EGameState.SELECTION:
                return(AFObject.Create <BateSelectionState>());

            case AState.EGameState.GAME:
                return(AFObject.Create <BateGameState>());
            }
            return(null);
        }
예제 #12
0
    public override void Initialize()
    {
        //AFDebug.SetConfigs( AFDebugSettings.OUTPUT_SCREEN | AFDebugSettings.OUTPUT_UNITY );

        AFAssetManager.SetDirectoryOwner("");

        m_stateManager = AFObject.Create <AFStateManager>();
        m_stateManager.Initialize(new StartStateFactory());
        m_stateManager.GotoState(AState.EGameState.MENU);

        base.Initialize();

        AFSingleTransition tras = AFObject.Create <AFSingleTransition>();
        SpriteRenderer     sr   = tras.gameObject.AddComponent <SpriteRenderer>();

        sr.sprite = AFAssetManager.Instance.CreateSpriteFromTexture("Common/High/loadingscreen");
        sr.transform.localScale = new Vector3(1, 1, 1);
        m_stateManager.AddTransition(tras);
    }
예제 #13
0
        public static AFSound Create(
            string path,
            string name          = "",
            Transform emitter    = null,
            float volume         = 1.0f,
            float pitch          = 1.0f,
            bool loop            = false,
            bool playOncePertime = true)
        {
            if (name.Equals(""))
            {
                name = path;
            }

            AFSound   L_sound     = AFObject.Create <AFSound>(name);
            AudioClip L_audioClip = AFAssetManager.Instance.Load <AudioClip>(path);

            L_sound.Initialize(name, L_audioClip, emitter, volume, pitch, loop, playOncePertime);
            return(L_sound);
        }
예제 #14
0
        public AFPool CreatePool <T>(string name, string assetName, uint qtd, uint maxPoolObjects = 0) where T : UnityEngine.Object
        {
            AFPool pool = null;

            if (qtd > 1)
            {
                T obj = GetAsset <T>(assetName);

                if (obj)
                {
                    pool = AFObject.Create <AFPool>(name);
                    pool.Init(name, maxPoolObjects);

                    pool.transform.parent = this.gameObject.transform;

                    if (obj.GetType().IsSubclassOf(typeof(UnityEngine.Object)))
                    {
                        UnityEngine.Debug.Log("Creating a object from a instance");
                        pool.Create((UnityEngine.Object)obj, qtd);
                    }
                    else
                    {
                        UnityEngine.Debug.Log("Creating a object from a Type");
                        pool.Create(obj.GetType(), (int)qtd);
                    }

                    m_pool.Add(name, pool);
                }
                else
                {
                    UnityEngine.Debug.LogError(" The asset not exists " + assetName);
                }
            }
            else
            {
                UnityEngine.Debug.LogError(" The pool should be more than one");
            }

            return(pool);
        }
예제 #15
0
        public Character CreateCharacter()
        {
            try
            {
                Character character = AFObject.Create <Character>();

                character.gameObject.AddComponent <TimeController>();
                character.gameObject.AddComponent <BoxCollider>();
                character.gameObject.AddComponent <AnimationController>();

                //UIEventListener.Get(character.gameObject).onClick += OnClick;
                _numberOfCharacters++;

                return(character);
            }
            catch (Exception ex)
            {
                //AFDebug.LogError("NÃO Criei o personagem.. Por que não quiz... S");
            }

            return(null);
        }
예제 #16
0
        public override void Initialize()
        {
            AFAssetManager.SetDirectoryOwner("BateRebate");
            AFAssetManager.SimulatedDPI     = AFAssetManager.DPI_IPAD_RETINA;
            AFAssetManager.SimulatePlatform = AFAssetManager.EPlataform.IOS;

            m_stateManager = AFObject.Create <AFStateManager>();
            m_stateManager.Initialize(new BateStateFactory());

            //AFSingleTransition tras = AFObject.Create<AFSingleTransition>();
            //SpriteRenderer sr = tras.gameObject.AddComponent<SpriteRenderer>();
            //sr.sprite = AFAssetManager.Instance.CreateSpriteFromTexture("Common/High/loadingscreen");
            //sr.transform.localScale = new Vector3(1, 1, 1);
            //m_stateManager.AddTransition(tras);
            //m_stateManager.GotoState(AState.EGameState.MENU);

            BateRebateMain.Instance.GetStateManger().GotoState(AState.EGameState.MENU);
            //BateRebateMain.Instance.GetStateManger().GotoState(AState.EGameState.SELECTION);
            //BateRebateMain.Instance.GetStateManger().GotoState(AState.EGameState.GAME);

            base.Initialize();
        }