Example #1
0
    /// <summary>
    /// We've died, destroy our gameobject
    /// </summary>
    public void Die()
    {
        _aiMood = AiMood.Dead;
        AgentActions actions = gameObject.GetComponent <AgentActions>();

        actions.DropAllItems();
        Destroy(gameObject);
    }
Example #2
0
    // a function that allows the Ai to be able to drop the flag when they are within thier base
    public bool DropItemAtBase(GameObject FriendlyBase, AI TheAi, AgentActions TheActions, bool flag)
    {
        if (TheAi.transform.position.x == FriendlyBase.transform.position.x || TheAi.transform.position.y == FriendlyBase.transform.position.y)
        {
            TheActions.DropAllItems();
        }


        return(true);
    }
    /// <summary>
    /// We've died, destroy our gameobject
    /// </summary>
    public void Die()
    {
        CurrentHitPoints = MaxHitPoints;
        _aiMood          = AiMood.Dead;
        AgentActions actions = gameObject.GetComponent <AgentActions>();

        actions.DropAllItems();
        //Destroy(gameObject);
        gameObject.GetComponent <UnityEngine.AI.NavMeshAgent>().enabled = false;
        //gameObject.GetComponent<AI>().Dead();
        if (FriendlyTeam == Teams.BlueTeam)
        {
            transform.position = new Vector3(100.0f, 100.0f, 100.0f);
        }
        if (FriendlyTeam == Teams.RedTeam)
        {
            transform.position = new Vector3(-100.0f, 100.0f, 100.0f);
        }

        StartCoroutine(WaitForRevive());
    }
Example #4
0
    //a function that allowed the AI to guard their base when they had both of thier flags within the base
    public bool Gaurd(AgentActions actions, Sensing sensing, AgentData data, GameObject HomeBase, GameObject GuardSpotOne, GameObject GuardSpotTwo, int GuardSpotNumber)
    {
        //move home
        MoveHome(actions, HomeBase);

        actions.DropAllItems();

        // if there are any enemies within view then they need to attack the enemy
        Attack(sensing, actions);

        if (GuardSpotNumber == 1)
        {
            //might want to change this so that it move between two spots every time the function is called to act more like a gaurding Ai
            actions.MoveTo(GuardSpotOne);
        }
        else if (GuardSpotNumber == 2)
        {
            actions.MoveTo(GuardSpotTwo);
        }

        return(true);
    }