Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (!player.clear)
        {
            cooldown();
            checkFacing();
            checkTurn();

            eMoveState   = ElementalMoveState.Idle;
            eActionState = ElementalActionState.Idle;

            if (attackTimer <= 0.0f)
            {
                //Recheck this Logic!!
                if (moveTimer >= moveSpeed)
                {
                    chooseTargetLocation();
                    moveTimer = 0.0f;
                }
                else
                {
                    //moveTimer += moveRate * Time.deltaTime;
                    //Debug.Log("Move Timer: " + moveTimer);
                    moveTimer += Time.deltaTime;
                    move();

                    if (moveTimer >= moveSpeed)
                    {
                        attack();
                        resetTimer();
                    }
                }
            }
        }
    }
Пример #2
0
    void attack()
    {
        int randInt = Random.Range(1, 100);

        if (lastAttack == 0)
        {
            if (randInt <= 50)
            {
                eActionState = ElementalActionState.Throwing;
                fireBall();
            }
            else
            {
                eActionState = ElementalActionState.SummoningPillars;
                firePillar();
            }
        }
        else if (lastAttack == 1)
        {
            if (randInt <= 25)
            {
                eActionState = ElementalActionState.Throwing;
                fireBall();
            }
            else
            {
                eActionState = ElementalActionState.SummoningPillars;
                firePillar();
            }
        }
        else
        {
            if (randInt <= 75)
            {
                eActionState = ElementalActionState.Throwing;
                fireBall();
            }
            else
            {
                eActionState = ElementalActionState.SummoningPillars;
                firePillar();
            }
        }
    }