Ejemplo n.º 1
0
        public void SetCharacterType(GameInfoManager.CharacterType characterType)
        {
            if (characterType == GameInfoManager.CharacterType.None)
            {
                return;
            }

            // animation controller
            {
                var filePath            = GameInfoManager.CalcCharacterAnimationControllerFilePath(characterType);
                var animationController = ResourceManager.LoadRuntimeAnimatorController(filePath);
                _characterAnimator.runtimeAnimatorController = animationController;
            }

            if (characterType == GameInfoManager.CharacterType.Heroine)
            {
                _characterAnimator.gameObject.DescendantsAndSelf().OfComponent <SpriteRenderer>().FirstOrDefault().flipX = true;
                transform.localScale = Vector3.one;
                transform.position   = new Vector3(4.5f, 0, 0);
            }
            else
            {
                _characterAnimator.gameObject.DescendantsAndSelf().OfComponent <SpriteRenderer>().FirstOrDefault().flipX = false;
                transform.localScale = Vector3.one * 8.0f;
                transform.position   = new Vector3(4.5f, -3.2f, 0);
            }
        }
Ejemplo n.º 2
0
        protected void SetCharacterParameter(GameInfoManager.CharacterType type)
        {
            characterType = type;

            switch (characterType)
            {
            case GameInfoManager.CharacterType.Kohaku:
            {
                speed      = 7;
                _jumpPower = 900;
                _hpMax     = 50;
            }
            break;

            case GameInfoManager.CharacterType.Heroine:
            {
                speed      = 10;
                _jumpPower = 800;
                _hpMax     = 100;
            }
            break;
            }

            // Hp設定
            {
                _hp           = _hpMax;
                _hpGaugeValue = _hpMax;
                _hpFace.UpdateHpFace(_hp, _hpMax);
            }
        }
Ejemplo n.º 3
0
    public void Init(GameInfoManager.CharacterType characterType, int damage)
    {
        var spriteRenderer = GetComponent <SpriteRenderer>();

        // pos & scale
        {
            transform.localPosition += new Vector3(0, 0.4f, 0);

            var scale = 1.0f;

            switch (damage)
            {
            case 20: scale = 1.2f; break;

            case 30: scale = 1.5f; break;

            case 100: scale = 2.0f; break;
            }

            transform.localScale *= scale;
        }

        // sprite
        {
            spriteRenderer.sprite = characterType == GameInfoManager.CharacterType.Kohaku ? _playerDamageEffectSprite : _enemyDamageEffectSprite;
        }

        // action
        {
            var seq = DOTween.Sequence();
            {
                seq.Append(spriteRenderer.DOFade(1.0f, 0.2f));
                seq.Append(spriteRenderer.DOFade(0.0f, 0.2f));
                seq.AppendCallback(() =>
                {
                    Destroy(gameObject);
                });
            }
        }
    }