public void Reset()
    {
        CurrentBehaviour.OnActionFinished();
        SetAction(((int)AIToadController.Action.None));
        SetDecidedAction(((int)AIToadController.Action.None));
        SetBehaviour(((int)AIToadController.Behaviour.Passive));

        m_MakeDecision = false;
        m_AiActive     = false;
        EnableColliders(true);

        m_NumberOfAttacks = 0;
        m_HitPlayer       = false;
        m_GoToPillar      = false;

        m_ToadBoss.TargetForComboFront.SetActive(true);
        m_ToadBoss.TargetForComboFront.GetComponent <ComboTarget>().Reset();
        m_ToadBoss.TargetForComboLeft.SetActive(true);
        m_ToadBoss.TargetForComboLeft.GetComponent <ComboTarget>().Reset();
        m_ToadBoss.TargetForComboRight.SetActive(true);
        m_ToadBoss.TargetForComboRight.GetComponent <ComboTarget>().Reset();

        m_ToadBoss.m_Marked = false;

        transform.position     = m_JumpPosition[3].transform.position;
        m_ToadBoss.m_MaxHealth = 500.0f;
        m_ToadBoss.SetCurrentHealthAsMaxHealth();
        m_MaxHealth        = Constants.ToadMaxHealth;
        m_CurrentHealth    = m_MaxHealth;
        transform.rotation = initalRotaton;
    }
예제 #2
0
    public void CurrentActionFinished()
    {
        // Set the Action Before Last as the previous action
        ActionBeforeLast = PreviousAction;

        // Set Previous action as current action
        PreviousAction = CurrentAction;

        CurrentBehaviour.OnActionFinished();
    }
예제 #3
0
    protected override void Update()
    {
        base.Update();

        //m_NavMeshAgent.destination = m_Player.transform.position;

        if (m_KingBoss.m_ShieldUp == true)
        {
            //  m_Shield.SetActive(true);
        }
        if (m_KingBoss.m_ShieldUp == false)
        {
            // m_Shield.SetActive(false);
        }

        ShowDebugStuff();

        // Enable the AI if the plater gets close
        if (GetDistanceToPlayer() < 50.0f && m_AiActive == false)
        {
            Services.GameManager.KingTriggered = true;
            m_AiActive = true;
            SetBehaviour((int)AIKingController.Behaviour.Offensive);
            SetAction((int)AIKingController.Action.None);
            m_MakeDecision = true;
        }

        // Enable the AI with button press
        if (Input.GetKeyDown("n"))
        {
            m_AiActive = true;
            SetBehaviour((int)AIKingController.Behaviour.Passive);
            SetAction((int)AIKingController.Action.Dodge);
            //SetNextAction((int)AIKingController.Action.DuelMove);
            // m_MakeDecision = true;
            //m_Animator.SetTrigger("t_Vertical_Swing");
        }

        // If the AI is active
        if (m_AiActive == true)
        {
            // If the player enters the pillars and the current beahviour isint pillar
            //if (m_LeftPillars.m_IsPlayerinside == true || m_RightPillars.m_IsPlayerinside == true && !IsCurrentAction((int)AIKingController.Behaviour.Pillar))
            //{
            //      // Change the behaviour to pillar
            //      SetBehaviour((int)AIKingController.Behaviour.Pillar);
            //}

            // If the Duel Behaviour is true and the behaviour isin't dueling
            if (m_IsDueling == true && !IsCurrentBehaviour((int)Behaviour.Dueling))
            {
                // Set Dueling to false and restart the Fire Circle cooldown
                m_IsDueling = false;
                FireCirlceCooldownTimer.Restart();
            }

            if (IsCurrentBehaviour((int)AIKingController.Behaviour.Offensive))
            {
                // If the king is walking
                if (IsCurrentAction((int)AIKingController.Action.Walk))
                {
                    // If the boss reaches melee range
                    if (GetDistanceToPlayer() < Constants.MeleeRange)
                    {
                        // Reset the walk and finish the action so the behaviour will choose the melee attack or continue walking
                        CurrentAction.Start();
                        CurrentBehaviour.OnActionFinished();
                    }
                }
            }

            // If the player and the king are in the center of the room
            if (m_RoomCenter.m_IsKingInside == true && m_RoomCenter.m_IsPlayerinside == true && m_IsDueling == false && FireCirlceCooldownTimer.IsFinished() && IsCurrentAction((int)AIKingController.Action.Walk))
            {
                // If the player is within range to start the duel
                if (GetDistanceToPlayer() < 15.0f && GetDistanceToPlayer() > 8.0f)
                {
                    // Set the action to summon fire circle and switch behaviour to dueling
                    SetBehaviour((int)AIKingController.Behaviour.Dueling);
                    SetAction((int)AIKingController.Action.FireCircle);
                    m_IsDueling = true;
                    FireCircleLengthTimer.Restart();
                }
            }
        }

        //// If the boss hit the player
        //if (m_HitPlayer == true)
        //{
        //    // Set hit to false so it only will be true for one frame
        //    m_HitPlayer = false;
        //}
    }