示例#1
0
            /// <summary>
            /// are you sure you want to construct your own CharacterManager? You may want to use
            /// SceneManager.GetInstance().GetCharacterManager() instead
            /// </summary>
            /// <param name="characterComponent">a character component which houses the relevant prefab
            /// and UI elements</param>
            public CharacterManager(CharacterComponent characterComponent)
            {
                m_characterComponent = characterComponent;

                // assign references to all the relevant character elements
                m_characterPrefab = characterComponent.GetCharacterPrefab();
                m_backgroundPanel = characterComponent.GetBackgroundPanel();
                m_foregroundPanel = characterComponent.GetForegroundPanel();

                // create character transformer for scaling/translation
                m_characterTransformer = new CharacterTransformer();
                m_characters           = new List <GameObject>(); // initialise list of characters
            }
示例#2
0
            /// <summary>
            ///
            /// </summary>
            public void ProcessCharacterTransform()
            {
                // get CharacterTransformer
                CharacterTransformer characterTransformer = m_characterManager.GetCharacterTransformer();

                Debug.Assert(characterTransformer != null, "DEVN: CharacterTransformer does not exist!");

                if (m_currentNode is CharacterScaleNode)
                {
                    ScaleCharacter(characterTransformer);
                }
                else if (m_currentNode is CharacterTranslateNode)
                {
                    TranslateCharacter(characterTransformer);
                }
            }
示例#3
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="characterTransformer"></param>
            private void TranslateCharacter(CharacterTransformer characterTransformer)
            {
                CharacterTranslateNode translateNode = m_currentNode as CharacterTranslateNode;
                GameObject             character     = m_characterManager.TryGetCharacter(translateNode.GetCharacter());
                Vector2 position = new Vector2(translateNode.GetXPosition(), 0);

                if (translateNode.GetIsLerp())
                {
                    m_sceneManager.StartCoroutine(characterTransformer.LerpCharacterPosition(character, position, translateNode.GetLerpTime()));
                }
                else
                {
                    characterTransformer.SetCharacterPosition(character, position);
                }

                m_sceneManager.NextNode();
            }
示例#4
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="characterTransformer"></param>
            private void ScaleCharacter(CharacterTransformer characterTransformer)
            {
                CharacterScaleNode scaleNode = m_currentNode as CharacterScaleNode;
                GameObject         character = m_characterManager.TryGetCharacter(scaleNode.GetCharacter());
                Vector2            scale     = scaleNode.GetScale();

                if (scaleNode.GetIsLerp())
                {
                    m_sceneManager.StartCoroutine(characterTransformer.LerpCharacterScale(character, scale, scaleNode.GetLerpTime()));
                }
                else
                {
                    characterTransformer.SetCharacterScale(character, scale);
                }

                m_sceneManager.NextNode();
            }
示例#5
0
 public void SetUp()
 {
     _testSubject = new CharacterTransformer<Character, string>(_ParseByJustCreatingCharWithFilenameAsName, _GenerateBySelectingNameSeveralTimes);
 }
示例#6
0
 public void SetUp()
 {
     _testSubject = new CharacterTransformer <Character, string>(_ParseByJustCreatingCharWithFilenameAsName, _GenerateBySelectingNameSeveralTimes);
 }