Esempio n. 1
0
    private void Attack(SkillData data)
    {
        if (data == null)
        {
            return;
        }
        if (state == State.Wait)
        {
            inputManager.SetElement(data.element);
            EffectManager.Instance.Show(data);
            Score.UseMagic(data.rare);
            SoundManager.Instance.PlayEffectSEByName(data.effectName);

            EnemyController enemyObject = enemyGenerator.GetCurrentEnemy();
            if (enemyObject == null)
            {
                Debug.LogError("attack is failed");
                return;
            }
            Damage.Type type = Damage.GetType(data.element, enemyObject.data.element);
            enemyObject.OnAttacked(Damage.Get(data.rare, type), type, data.delayAttack);
            state      = State.Attack;
            stateTimer = 0.7f;
        }
    }