Esempio n. 1
0
    IEnumerator EachTurn(OperationBluehole.Content.TurnInfo turnInfo)
    {
        if (turnInfo.skillId == OperationBluehole.Content.SkillId.None)
        {
            yield break;
        }

        // Do source job
        GameObject source = (turnInfo.srcType == OperationBluehole.Content.PartyType.MOB)?
                            BattleManager.Instance.EnemyInstanceList[turnInfo.srcIdx] :
                            BattleManager.Instance.heroStatus[turnInfo.srcIdx];

        // Warning!!! We could be make base class(like character or something) for making Mob and Hero derived class
        // Warning!!! For now, we only use just attack skill, which skill used
        switch (turnInfo.srcType)
        {
        case OperationBluehole.Content.PartyType.MOB:
            Debug.Log("turn start");
            yield return(StartCoroutine(source.GetComponent <Mob>().Attack(turnInfo)));

            Debug.Log("turn end");
            break;

        case OperationBluehole.Content.PartyType.PLAYER:
            yield return(StartCoroutine(source.GetComponent <Hero>().Attack()));

            break;
        }

        // Do target job
        ApplyDamage(turnInfo.targets);
    }
Esempio n. 2
0
    public IEnumerator Attack(OperationBluehole.Content.TurnInfo turnInfo)
    {
        // play attack animation
        //animatable.PlayWalk();
        yield return(new WaitForSeconds(GameConfig.MOB_ATTACKMOVING_TIME));

        //animatable.PlayAttack();
//		Debug.Log( "   mob Action start " + turnInfo.srcIdx );

        // if target is one enemy, use melee skills
        if (turnInfo.targets.Count == 1 && turnInfo.srcType != turnInfo.targets[0].targetType)
        {
            actionSkill[(int)turnInfo.skillId % actionSkill.Length]();
        }
        else
        {
            buffSkill[(int)turnInfo.skillId % actionSkill.Length]();
        }


        // after animation over, accept damage to hero
        while (IsAnimationPlaying())
        {
//			Debug.Log( "      mob Action ~ing " + turnInfo.srcIdx );
            yield return(null);
        }
//		Debug.Log( "   mob Action end " + turnInfo.srcIdx );
        animatable.PlayIdle();
    }