private void OnEnable()
 {
     _target = (LipSyncTexture)target;
 }
 private void OnEnable()
 {
     _target = (LipSyncTexture) target;
 }
示例#3
0
文件: Char.cs 项目: mcbodge/eidolon
        protected void _Awake()
        {
            if (GetComponent <CharacterController>())
            {
                _characterController = GetComponent <CharacterController>();
                wallRayOrigin = _characterController.center;
                wallRayForward = _characterController.radius;
            }
            else if (GetComponent <CapsuleCollider>())
            {
                CapsuleCollider capsuleCollider = GetComponent <CapsuleCollider>();
                wallRayOrigin = capsuleCollider.center;
                wallRayForward = capsuleCollider.radius;
            }
            else if (GetComponent <CircleCollider2D>())
            {
                CircleCollider2D circleCollider = GetComponent <CircleCollider2D>();
                #if !UNITY_5
                wallRayOrigin = circleCollider.center;
                #else
                wallRayOrigin = circleCollider.offset;
                #endif
                wallRayForward = circleCollider.radius;
            }
            else if (GetComponent <BoxCollider2D>())
            {
                BoxCollider2D boxCollider = GetComponent <BoxCollider2D>();
                wallRayOrigin = boxCollider.bounds.center;
                wallRayForward = boxCollider.bounds.size.x / 2f;
            }

            if (GetComponentInChildren <FollowSortingMap>())
            {
                transform.localScale = Vector3.one;
            }
            originalScale = transform.localScale;
            charState = CharState.Idle;
            shapeable = GetShapeable ();
            if (GetComponent <LipSyncTexture>())
            {
                lipSyncTexture = GetComponent <LipSyncTexture>();
            }

            ResetAnimationEngine ();
            ResetBaseClips ();

            _animator = GetAnimator ();
            _animation = GetAnimation ();
            SetAntiGlideState ();

            if (spriteChild && spriteChild.gameObject.GetComponent <SpriteRenderer>())
            {
                _spriteRenderer = spriteChild.gameObject.GetComponent <SpriteRenderer>();
                if (spriteChild.localPosition.magnitude > 0f)
                {
                    if (!(gameObject.name == "Bird" && spriteChild.gameObject.name == "Bird_Sprite"))
                    {
                        // You found the dirtest hack in AC!
                        ACDebug.LogWarning ("The sprite child of '" + gameObject.name + "' is not positioned at (0,0,0) - is this correct?");
                    }
                }
            }

            if (speechAudioSource == null && GetComponent <AudioSource>())
            {
                speechAudioSource = GetComponent <AudioSource>();
            }

            if (soundChild && soundChild.gameObject.GetComponent <AudioSource>())
            {
                audioSource = soundChild.gameObject.GetComponent <AudioSource>();
            }

            if (GetComponent <Rigidbody>())
            {
                _rigidbody = GetComponent <Rigidbody>();
            }
            else if (GetComponent <Rigidbody2D>())
            {
                _rigidbody2D = GetComponent <Rigidbody2D>();
            }
            PhysicsUpdate ();

            if (GetComponent <Collider>())
            {
                _collider = GetComponent <Collider>();
            }

            AdvGame.AssignMixerGroup (speechAudioSource, SoundType.Speech, true);
            AdvGame.AssignMixerGroup (audioSource, SoundType.SFX);
        }
示例#4
0
        protected void _Awake()
        {
            if (GetComponent <CharacterController>())
            {
                _characterController = GetComponent <CharacterController>();
                wallRayOrigin = _characterController.center;
                wallRayForward = _characterController.radius;
            }
            else if (GetComponent <CapsuleCollider>())
            {
                CapsuleCollider capsuleCollider = GetComponent <CapsuleCollider>();
                wallRayOrigin = capsuleCollider.center;
                wallRayForward = capsuleCollider.radius;
            }

            if (GetComponentInChildren <FollowSortingMap>())
            {
                transform.localScale = Vector3.one;
            }
            originalScale = transform.localScale;
            charState = CharState.Idle;
            shapeable = GetShapeable ();
            if (GetComponent <LipSyncTexture>())
            {
                lipSyncTexture = GetComponent <LipSyncTexture>();
            }

            ResetAnimationEngine ();
            ResetBaseClips ();

            if (spriteChild && spriteChild.GetComponent <Animator>())
            {
                animator = spriteChild.GetComponent <Animator>();
            }

            if (soundChild && soundChild.gameObject.GetComponent <AudioSource>())
            {
                audioSource = soundChild.gameObject.GetComponent <AudioSource>();
            }

            if (GetComponent <Animator>())
            {
                animator = GetComponent <Animator>();
            }

            if (GetComponent <Animation>())
            {
                _animation = GetComponent <Animation>();
            }

            if (GetComponent <Rigidbody>())
            {
                _rigidbody = GetComponent <Rigidbody>();
            }
            else if (GetComponent <Rigidbody2D>())
            {
                _rigidbody2D = GetComponent <Rigidbody2D>();
            }

            if (GetComponent <Collider>())
            {
                _collider = GetComponent <Collider>();
            }

            AdvGame.AssignMixerGroup (GetComponent <AudioSource>(), SoundType.Other, true);
            AdvGame.AssignMixerGroup (audioSource, SoundType.SFX);
        }
示例#5
0
        protected void _Awake()
        {
            if (GetComponent <CharacterController>())
            {
                _characterController = GetComponent <CharacterController>();
                wallRayOrigin = _characterController.center;
                wallRayForward = _characterController.radius;
            }
            else if (GetComponent <CapsuleCollider>())
            {
                CapsuleCollider capsuleCollider = GetComponent <CapsuleCollider>();
                wallRayOrigin = capsuleCollider.center;
                wallRayForward = capsuleCollider.radius;
            }
            else if (GetComponent <CircleCollider2D>())
            {
                CircleCollider2D circleCollider = GetComponent <CircleCollider2D>();
                #if !UNITY_5
                wallRayOrigin = circleCollider.center;
                #else
                wallRayOrigin = circleCollider.offset;
                #endif
                wallRayForward = circleCollider.radius;
            }
            else if (GetComponent <BoxCollider2D>())
            {
                BoxCollider2D boxCollider = GetComponent <BoxCollider2D>();
                wallRayOrigin = boxCollider.bounds.center;
                wallRayForward = boxCollider.bounds.size.x / 2f;
            }

            if (GetComponentInChildren <FollowSortingMap>())
            {
                transform.localScale = Vector3.one;
            }
            originalScale = transform.localScale;
            charState = CharState.Idle;
            shapeable = GetShapeable ();
            if (GetComponent <LipSyncTexture>())
            {
                lipSyncTexture = GetComponent <LipSyncTexture>();
            }

            ResetAnimationEngine ();
            ResetBaseClips ();

            _animator = GetAnimator ();
            _animation = GetAnimation ();
            SetAntiGlideState ();

            if (spriteChild && spriteChild.gameObject.GetComponent <SpriteRenderer>())
            {
                _spriteRenderer = spriteChild.gameObject.GetComponent <SpriteRenderer>();
            }

            if (soundChild && soundChild.gameObject.GetComponent <AudioSource>())
            {
                audioSource = soundChild.gameObject.GetComponent <AudioSource>();
            }

            if (GetComponent <Rigidbody>())
            {
                _rigidbody = GetComponent <Rigidbody>();
            }
            else if (GetComponent <Rigidbody2D>())
            {
                _rigidbody2D = GetComponent <Rigidbody2D>();
            }

            if (GetComponent <Collider>())
            {
                _collider = GetComponent <Collider>();
            }

            AdvGame.AssignMixerGroup (GetComponent <AudioSource>(), SoundType.Other, true);
            AdvGame.AssignMixerGroup (audioSource, SoundType.SFX);
        }