コード例 #1
0
    void OnExitState(MushroomState state)
    {
        switch (state)
        {
        case MushroomState.Idle:
            OnExitIdle();
            break;

        case MushroomState.Picked:
            OnExitPicked();
            break;

        case MushroomState.Throw:
            OnExitThrow();
            break;

        case MushroomState.OnGround:
            OnExitGround();
            break;

        case MushroomState.InsideEnemy:
            OnExitInsideEnemy();
            break;
        }
    }
コード例 #2
0
    void OnEnterState(MushroomState state)
    {
        switch (state)
        {
        case MushroomState.Idle:
            OnEnterIdle();
            break;

        case MushroomState.Picked:
            OnEnterPicked();
            break;

        case MushroomState.Throw:
            OnEnterThrow();
            break;

        case MushroomState.OnGround:
            OnEnterGround();
            break;

        case MushroomState.InsideEnemy:
            OnEnterInsideEnemy();
            break;
        }
    }
コード例 #3
0
 public void SetState(MushroomState state)
 {
     if (State != state)
     {
         OnExitState(State);
         OnEnterState(state);
         State = state;
     }
 }
コード例 #4
0
 private void Start()
 {
     State           = MushroomState.Idle;
     isEnemyTracking = false;
     m_body          = GetComponent <Rigidbody>();
     defaultMat      = transform.GetComponentInChildren <Renderer>().material;
     slimeHitCounter = 0;
     playerThrew     = false;
     Collider        = GetComponent <BoxCollider>();
 }
コード例 #5
0
    // Start is called before the first frame update
    void Start()
    {
        // Ставим себе тег
        this.tag = "Enemy";
        // Вытягиваем игрока по тегу
        player = GameObject.FindGameObjectWithTag("Player");
        // Запоминаем изначальную позицию
        startY = transform.position.y;
        // Прячемся под землю и говорим что мы готовы к прыжку
        transform.Translate(Vector3.down * ReadyDepth, Space.World);
        state = MushroomState.Ready;
        //particleObject.Stop();

        m_Renderer = GetComponent <Renderer>();
        anim       = GetComponent <DragonBones.UnityArmatureComponent>();
    }
コード例 #6
0
    void FixedUpdate()
    {
        switch (state)
        {
        case MushroomState.Ready:
            anim.animation.Play("statik");
            // Если видим игрока - прыгаем
            if ((player.transform.position - this.transform.position).magnitude < SeeDistance)
            {
                AudioSystem("Mushroom_grow");
                state  = MushroomState.Jump;
                vspeed = JumpSpeed;
            }
            break;

        case MushroomState.Jump:
            // Летим
            anim.animation.Play("ia_tutachki");
            transform.Translate(Vector3.up * vspeed * Time.fixedDeltaTime, Space.World);
            // Если не под землёй - гравитация
            if (transform.position.y > startY)
            {
                vspeed -= 0.5f;
            }
            // Иначе если уже упали под землю - переходим в атаку
            else if (vspeed < 0)
            {
                particleObject.Play();
                // Встаём куда надо
                transform.position.Set(transform.position.x, startY, transform.position.z);
                // Атакуем
                anim.animation.Play("poop");
                AudioSystem("Mushroom_atack");
                state = MushroomState.Attack;

                timer = AttackTimer;
            }
            break;

        case MushroomState.Attack:
            // Ждём время атаки

            if ((player.transform.position - this.transform.position).magnitude < DamageDistance)
            {
                player.GetComponent <MovePlayer>().health -= 3f;
            }

            timer -= Time.fixedDeltaTime;
            // По истечению таймера - прячемся
            if (timer <= 0)
            {
                state = MushroomState.Hiding;
            }
            break;

        case MushroomState.Hiding:
            // Уползаем под землю

            transform.Translate(Vector3.down * HidingSpeed * Time.fixedDeltaTime, Space.World);

            // Когда уползли на нужную глубину - перезарядка
            if (transform.position.y < (startY - HidingDepth))
            {
                anim.animation.Play("poka");
                anim.animation.Play("statik");
                state = MushroomState.Reloading;
                timer = ReloadingTimer;
            }
            break;

        case MushroomState.Reloading:
            // Выжидаем таймер перезарядки
            if (timer > 0)
            {
                timer -= Time.fixedDeltaTime;
                //if (timer > 0)
            }
            else     // Когда истёк - поднимаемся до высоты Ready
            {
                transform.Translate(Vector3.up * HidingSpeed * Time.fixedDeltaTime, Space.World);
                if (transform.position.y > (startY - ReadyDepth))
                {
                    state = MushroomState.Ready;
                }
            }
            break;

        default:
            break;
        }
    }
コード例 #7
0
ファイル: PrettyPrinter.cs プロジェクト: Reve/eveDestiny
 private static void PrintMushroomState(StringBuilder sb, string indention, MushroomState mushroomState)
 {
     sb.AppendLine(indention + "[MushroomState]");
     sb.AppendLine(indention + Indention + "[Unk01: " + mushroomState.Unk01 + "]");
     sb.AppendLine(indention + Indention + "[Unk02: " + mushroomState.Unk02 + "]");
     sb.AppendLine(indention + Indention + "[Unk03: " + mushroomState.Unk03 + "]");
     sb.AppendLine(indention + Indention + "[Unk04: " + mushroomState.Unk04 + "]");
 }