Пример #1
0
    void Update()
    {
        m_TeamMinions.RemoveAll(m => m == null);

        transform.position += m_Velocity * Time.deltaTime;

        Vector3 walkSpeed = m_TeamIndication.WalkingDirection;

        if (walkSpeed.sqrMagnitude > 0.01f)
        {
            transform.forward = walkSpeed;

            walkSpeed *= 4;

            if (m_hasSpeedModifier >= Time.time)
            {
                walkSpeed *= m_speedModifier;
            }

            switch (m_Action)
            {
            case Action.Unknown:
                // Determine what to do next
                m_Action = Action.Walking;
                break;

            case Action.Walking:
                m_Animator.PlayAnimation("minion_melee_run", false, false);

                transform.position += walkSpeed * Time.deltaTime;
                break;

            case Action.Atacking:
                m_Animator.PlayAnimation("minion_melee_attack5", false, false);
                break;

            case Action.Dying:
                break;
            }
        }

        transform.position = new Vector3(transform.position.x, 0.0f, transform.position.z);
    }