Exemplo n.º 1
0
    void generateAgents()
    {
        AgentControl.setStaticParams(myNodes, numMapNode, numAgentNode);
        int        randModelIdx;
        GameObject instancedModel;

        // the map starts from 0-100, agent from 101-150, agent goal from 151-200
        for (int i = startIdxOfAgent; i < startIdxOfAgent + numAgentNode; i++)
        {
            // first agent is always ency
            // the rest can be anything specified within the agent list
            randModelIdx = rand.Next(agentList.Count);
            if (i == startIdxOfAgent)
            {
                randModelIdx = 0;
            }
            instancedModel = Instantiate(agentList[randModelIdx], myNodes[i].position, Quaternion.identity);
            instancedModel.transform.name = "agent" + (i - startIdxOfAgent);
            instancedModel.transform.GetComponent <AgentControl>().setAgentIdx(i, i + this.numAgentNode);
            instancedModel.transform.SetParent(this.transform);
        }
        // set all template model inactivate, cuz template agent are in PRM node list
        for (int i = 0; i < agentList.Count; i++)
        {
            agentList[i].SetActive(false);
        }
    }
Exemplo n.º 2
0
    private void OnParticleCollision(GameObject other)
    {
        AgentControl enemy = other.transform.GetComponent <AgentControl>();

        if (enemy != null)
        {
            enemy.DamageNPC(damage);
        }
    }
Exemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     Controller = GetComponent <AgentControl>();
     //for now, we have the vip request guarding based on random chance.
     Guarded = (Random.value > 0.5f);
     //Add the VIP to the target list.
     GameController.GameManager.Target_Agents.Add(gameObject);
     if (Guarded == true)
     {
         MaxGuardCount = Random.Range(1, 5);
     }
 }
Exemplo n.º 4
0
    void Shoot()
    {
        RaycastHit hit;

        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, float.MaxValue, enemy))
        {
            AgentControl enemy = hit.transform.GetComponent <AgentControl>();

            if (enemy != null)
            {
                Debug.Log("Dying", hit.transform);
                enemy.DamageNPC(damage);
            }
        }
    }
    //The bodyguards role is to remain within the nearby vicinity of their allocated VIP or to safely escort the VIP around the map/protect them from the player.
    //Bodyguards must also be able to designate safe spaces to hide the vip or attempt to escort the vip out of the map.

    //currently, vip's are just normal civillians and will wonder around the map and go to specific locations on chance. VIP's also have master level access and can go anywhere.
    //in the case a VIP doesnt have access to the entire map, we make sure the bodyguards clearance matches that of their VIP.

    // Start is called before the first frame update
    void Start()
    {
        Controller = GetComponent <AgentControl>();
        //pick a vip.
        if (GameController.GameManager.Target_Agents.Count > 0)
        {
            Protect_Client = PickVIP(GameController.GameManager.Target_Agents);
        }
        min_Dist = Random.Range(2, 4);
        max_Dist = Random.Range(5, 7);


        //under normal circumstances, the bodyguard should update their knowledge of the vips whereabouts every so often.
        StartCoroutine(VIP_Track(7.0f));
    }
Exemplo n.º 6
0
        void ManageServerComplex()
        {
            Terminal.Get().SetTerminationHandler(OnTerminate);

            cyan($"Starting server complex");
            ServerComplex.Start(AgentContext).ContinueWith(complex =>
            {
                Complex = complex.Result;
                magenta("Server complex started");
            });

            var control = AgentControl.FromContext(this);

            control.Configure(AgentContext).ContinueWith(_ =>
            {
                inform($"There are {control.SummaryStats.AgentCount.ToString()} agents in play");
            });


            readKey("Press any key to terminate the application");
        }
    private void OnTriggerEnter(Collider other)
    {
        //if the other object is a navagent.
        if (other.gameObject.GetComponent <AgentControl>())
        {
            AgentControl other_agent = other.gameObject.GetComponent <AgentControl>();
            //compare clearance of agent against the access level of this space.
            if (other_agent.clearance_level >= access_required)
            {
                //has clearance, we do nothing.
            }
            else
            {
                //doest have clearance. We tell the agent to go away.
                Debug.Log(other_agent.name + " is not authorised to access : " + Area_Name);
                //spawns an object to show visual feedback that an agent has been denied access.
                Instantiate(AccessDeniedPrefab, new Vector3(other.gameObject.transform.position.x, other.gameObject.transform.position.y + 2.0f, other.gameObject.transform.position.z), Quaternion.identity, other.gameObject.transform);
                other_agent.AgentWander();
            }
        }

        //we want an event for the player as well to display whether or not they are allowed into a specific area. Works into the keycards/disguises to add later.
        //Display on player UI that they are tresspassing if they are by checking the players current credentials
        if (other.gameObject.tag == "Player")
        {
            if (other.gameObject.GetComponent <PlayerManager>().Current_Clearance >= access_required)
            {
                //player has clearance at this moment in time.
                other.gameObject.GetComponent <PlayerManager>().isTrespassing = false;
            }
            else
            {
                //Player is currently trespassing.
                other.gameObject.GetComponent <PlayerManager>().isTrespassing = true;
            }
        }
    }
Exemplo n.º 8
0
    public static bool SetComboStyle(ref DevExpress.Web.ASPxComboBox Combo, EnumDefineStyle DefineStyle,
                                     string DefaultValue = "", string Criteria = "", bool AddEmptyRow = false)
    {
        //return false;
        int[] aryColWidth = null;
        //Combo. = false;
        //Combo.LimitToList = true;
        //Combo.DropMode = C1List.DropModeEnum.Automatic;
        //Combo.AutoCompletion = true;
        //Combo.AutoDropDown = true;
        //Combo.ExtendRightColumn = true;
        //Combo.DropdownPosition = C1List.DropdownPositionEnum.RightDown;
        GeneralControl CountryBase = new GeneralControl();
        AgentControl   objAgent    = new AgentControl();

        Combo.DropDownWidth = 230;
        List <Country_Info> lstCountry  = new List <Country_Info>();
        List <CODEMASTER>   lstOpt      = new List <CODEMASTER>();
        DataTable           dataCountry = new DataTable();

        switch (DefineStyle)
        {
        case EnumDefineStyle.Style1:
            Combo.DropDownWidth = 0;
            //Combo.ColumnHeaders = false;
            //Combo.LimitToList = true;
            //Combo.DropMode = C1List.DropModeEnum.Automatic;
            //Combo.AutoCompletion = true;
            //Combo.AutoDropDown = true;
            //Combo.ExtendRightColumn = true;
            //Combo.DropdownPosition = C1List.DropdownPositionEnum.RightDown;
            return(true);

        case EnumDefineStyle.Country:
            aryColWidth    = new int[2];
            aryColWidth[0] = 30;
            aryColWidth[1] = 0;
            //SetComboProp(Combo, objSelect.CustomSelect(EnumCustomSelect.Country,, EnumTypeOrder.ByDesc), DefaultValue,, EnumComboStyle.DescOnly, aryColWidth);
            lstCountry = CountryBase.GetAllCountry();
            //foreach (GroupBooking.Info.Agent_Info objStock in lstCountry)
            //{
            Combo.Items.Clear();
            Combo.Items.Add("", "");
            Combo.TextField  = "countryName";
            Combo.ValueField = "countrycode";
            Combo.DataSource = lstCountry;
            Combo.DataBind();
            Combo.DropDownWidth = 280;
            Combo.SelectedIndex = 0;
            //aryColWidth = null;
            return(true);

        case EnumDefineStyle.State:
            aryColWidth    = new int[2];
            aryColWidth[0] = 30;
            aryColWidth[1] = 0;
            //SetComboProp(Combo, objSelect.CustomSelect(EnumCustomSelect.Country,, EnumTypeOrder.ByDesc), DefaultValue,, EnumComboStyle.DescOnly, aryColWidth);
            lstCountry = CountryBase.GetAllState(Criteria);
            //foreach (GroupBooking.Info.Agent_Info objStock in lstCountry)
            //{
            Combo.Items.Clear();
            Combo.Items.Add("", "");
            Combo.TextField  = "provinceStateName";
            Combo.ValueField = "provincestatecode";
            Combo.DataSource = lstCountry;
            Combo.DataBind();
            Combo.DropDownWidth = 280;
            Combo.SelectedIndex = 0;
            //aryColWidth = null;
            return(true);

        case EnumDefineStyle.Opt:
            //p(Combo, objSelect.CustomSelect(EnumCustomSelect.State, Criteria, EnumTypeOrder.ByDesc),,, EnumComboStyle.DescOnly);
            //lstOpt = CountryBase.GetAllCODEMASTERFilter();
            Combo.Items.Clear();
            Combo.TextField  = "CodeDesc";
            Combo.ValueField = "Code";
            Combo.DataSource = lstOpt;
            Combo.DataBind();
            Combo.DropDownWidth = 150;
            Combo.SelectedIndex = 0;
            return(true);

        case EnumDefineStyle.CountryCard:
            aryColWidth    = new int[2];
            aryColWidth[0] = 30;
            aryColWidth[1] = 0;
            //SetComboProp(Combo, objSelect.CustomSelect(EnumCustomSelect.Country,, EnumTypeOrder.ByDesc), DefaultValue,, EnumComboStyle.DescOnly, aryColWidth);
            dataCountry = CountryBase.GetAllCountryCard();
            //foreach (GroupBooking.Info.Agent_Info objStock in lstCountry)
            //{
            Combo.Items.Clear();
            Combo.Items.Add("", "");
            Combo.TextField  = "Name";
            Combo.ValueField = "CountryCode";
            Combo.DataSource = dataCountry;
            Combo.DataBind();
            Combo.DropDownWidth = 280;
            Combo.SelectedIndex = 0;
            //aryColWidth = null;
            return(true);

        case EnumDefineStyle.Years:
            Combo.Items.Clear();
            for (int i = 0; i < 20; i++)
            {
                Combo.Items.Add((DateTime.Now.Year - i).ToString());
            }
            Combo.DropDownWidth = 50;
            //aryColWidth = null;
            return(true);

        case EnumDefineStyle.YearsPlus:
            Combo.Items.Clear();
            for (int i = 0; i < 20; i++)
            {
                Combo.Items.Add((DateTime.Now.Year + i).ToString());
            }
            Combo.DropDownWidth = 50;
            //aryColWidth = null;
            return(true);

        case EnumDefineStyle.AgentCategory:
            DataTable dt = objAgent.GetAllAgentCategory();
            //foreach (GroupBooking.Info.Agent_Info objStock in lstCountry)
            //{
            Combo.Items.Clear();
            Combo.TextField  = "AgentCatgDesc";
            Combo.ValueField = "AgentCatgID";
            Combo.DataSource = dt;
            Combo.DataBind();
            Combo.DropDownWidth = 280;

            //aryColWidth = null;
            return(true);

        default:
            return(false);
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     Manager    = FindObjectOfType <AgentManager>();
     Controller = GetComponent <AgentControl>();
 }