Example #1
0
    // Update is called once per frame
    void Update()
    {
        if ((transform.position.y > -1) != overground)
        {
            inOutSoundFx.Play();
            overground = transform.position.y > -1;
        }

        if (currentState != null)
        {
            if (bb.aboveAttackCurrentCooldownTime < bb.AboveAttackSettingsPhase.cooldownTime)
            {
                bb.aboveAttackCurrentCooldownTime += Time.deltaTime;
            }

            if (bb.spawningMinionsCurrentCooldownTime < bb.SpawningMinionsSettingsPhase.cooldownTime)
            {
                bb.spawningMinionsCurrentCooldownTime += Time.deltaTime;
            }

            currentState.UpdateBodyMovement();

            WormAIBaseState newState = currentState.Update();

            if (newState != null)
            {
                ChangeState(newState);
            }
        }
    }
Example #2
0
 protected void ChangeState(WormAIBaseState newState)
 {
     if (currentState != null)
     {
         //Debug.Log(this.GetType().Name + " Exiting: " + currentState.GetType().Name);
         currentState.OnStateExit();
     }
     currentState = newState;
     if (currentState != null)
     {
         //Debug.Log(this.GetType().Name + " Entering: " + currentState.GetType().Name);
         currentState.OnStateEnter();
     }
 }
Example #3
0
    public void ImpactedBySpecial(float damage, PlayerController player)
    {
        if (headState != HeadSubState.KNOCKED_OUT || invulnerable)
        {
            return;
        }

        if (currentState != null)
        {
            WormAIBaseState newState = currentState.ImpactedBySpecial(damage, player);

            if (newState != null)
            {
                ChangeState(newState);
            }
        }
    }
Example #4
0
    public void ImpactedByShot(ChromaColor shotColor, float damage, PlayerController player)
    {
        if (headState != HeadSubState.ACTIVATED || invulnerable)
        {
            return;
        }

        if (currentState != null)
        {
            WormAIBaseState newState = currentState.ImpactedByShot(shotColor, damage, player);

            if (newState != null)
            {
                ChangeState(newState);
            }
        }
    }