예제 #1
0
    void Start()
    {
        aiFollow = GetComponent <AIFollow_07>();


        wanderWaypoints = new List <Vector3>();

        while (wanderWaypoints.Count < wanderListSize)
        {
            wanderWaypoints.Add(new Vector3(Random.Range(0, 160), 0, Random.Range(0, 120)));
        }

        workWaypointIndex   = 0;
        wanderWaypointIndex = 0;

        assignedTarget = false;


        //When an agent spawns, he should start by wandering
        aState = agentState.Wandering;
    }
예제 #2
0
    void Start()
    {
        aiFollow = GetComponent<AIFollow_07>();

        wanderWaypoints = new List<Vector3>();

        while (wanderWaypoints.Count < wanderListSize) {
            wanderWaypoints.Add(new Vector3(Random.Range(0, 160), 0, Random.Range(0, 120)));
        }

        workWaypointIndex = 0;
        wanderWaypointIndex = 0;

        assignedTarget = false;

        //When an agent spawns, he should start by wandering
        aState = agentState.Wandering;
    }
예제 #3
0
    void Start()
    {
        _audioController = FindObjectOfType<AudioController> ().gameObject.GetComponent<AudioController> ();
        //_GUIController_SettlerInfo = GameObject.Find ("Folk_Female_Agent").GetComponent<GUIController_SettlerInfo> ();
        if (newAgent) {

            Debug.Log("NEW AGENT AS BEEN Triggered");

            malePortraitIndex = UnityEngine.Random.Range (0, 12);
            femalePortraitIndex = UnityEngine.Random.Range (0, 6);

            //Gender
            genderArray = new string[2] {
                "Male",
                "Female"
            };

            //Name
            maleFirstNameArray = new string[32] {
                "Daron",
                "Bernardo",
                "Grady",
                "Willie",
                "Malcolm",
                "Trevor",
                "Ken",
                "Todd",
                "Rand",
                "Jeff",
                "Kurt",
                "Alexis",
                "Vishesh",
                "Luigi",
                "Jake",
                "Reggie",
                "Loyd",
                "Darron",
                "Tyler",
                "Zachary",
                "Roderick",
                "Raiden",
                "Miguel",
                "Ender",
                "Colm",
                "Phil",
                "Niko",
                "Tyson",
                "Sacha",
                "Tariq",
                "Zeph",
                "Ram"
            };

            femaleFirstNameArray = new string[32] {
                "Joye",
                "Argelia",
                "Sheryll",
                "Carma",
                "Sheri",
                "Anita",
                "Xuan",
                "Robyn",
                "Allie",
                "Darcie",
                "Sari",
                "Shayna",
                "Thea",
                "Christie",
                "Sanora",
                "Laryssa",
                "Weri",
                "Elicia",
                "Wanda",
                "Creola",
                "Heidi",
                "Irene",
                "Helene",
                "Elora",
                "Joselyn",
                "Margery",
                "Oona",
                "Clair",
                "Freya",
                "Yvonne",
                "Sue",
                "Miley"
            };

            lastNameArray = new string[35] {
                "Slate",
                "Hazlewood",
                "Beckett",
                "Polo",
                "Mordecai",
                "McKnight",
                "Kerrigan",
                "Kellerman",
                "Stone",
                "Drake",
                "Richards",
                "Allard",
                "Black",
                "Steele",
                "Sparks",
                "Quan",
                "Sparrow",
                "Poehler",
                "Carnes",
                "Vivek",
                "Cumberbatch",
                "Weaver",
                "Clay",
                "Yu",
                "Keyes",
                "Baird",
                "Crane",
                "Gould",
                "Valentine",
                "Frost",
                "Stark",
                "McDonald",
                "Willis",
                "Kirby",
                "Goldblum"
            };

            //Create Random Variables
            randomFirstName = UnityEngine.Random.Range (0, 32);
            randomLastName = UnityEngine.Random.Range (0, 35);
            randomGender = Random.Range (0, (genderArray.Length));

            wait = Random.Range(1.0f, 3.0f);

            //Assigns random names and photos according to gender
            //Variable firstLastName outputs first and last name. variable settlerNameAndRole outputs name, what settler is currently doing, and their assigned role
            if (gender == "Male"){
                firstLastName = (maleFirstNameArray[randomFirstName] + " " + lastNameArray[randomLastName]);
                portraitIndex = malePortraitIndex;
            }
            else {
                firstLastName = (femaleFirstNameArray[randomFirstName] + " " + lastNameArray[randomLastName]);
                portraitIndex = femalePortraitIndex;
            }

            //Init the agent's hunger value to 0 when spawned (they shouldnt be hungry at start)
            hungerValue = 0;
            //Init the agent's health to 100 when spawned (they should be perfectly healthy)
            health = 100;
            //Init the agent's happyness to 100 when spawned (they should be perfectly happy)
            moraleLevel = 100;
            //Init the agent's perception to 10% when spawned (this is the standard starting value for all agents)
            perception = 10;

            //When the agent spawns, there is a 50% chance to spawn idle or wander
            WanderOrIdle(50.0f);
        }

        aiFollow = GetComponent<AIFollow_07> ();
        wanderWaypoints = new List<Vector3> ();

        //Populate the following waypoints when an agent is spawned
        while (wanderWaypoints.Count < wanderListSize) {
            wanderWaypoints.Add (new Vector3 (Random.Range (-30, 35), 0, Random.Range (-40, 10)));
        }

        //Get all storage waypoints when the agent is spawned, agent should know a known food source at spawn
        storageWaypoints = new List<GameObject> (GameObject.FindGameObjectsWithTag ("StorageWaypoint"));

        agentAnim = GetComponent<Animator>();

        gameController = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();

        //init all waypoint index's to 0 and set the storage waypoint indext to a random value within the scope of the storage list
        workWaypointIndex = 0;
        wanderWaypointIndex = 0;
        storageWaypointIndex = Random.Range (0, storageWaypoints.Count);

        //Agent should  have no current assigned target
        assignedTarget = false;

        //Agent should not have populated any worker lists
        populateList = false;

        if (aState == null){
            //When an agent spawns, he should start by wandering if there is no starting state
            aState = agentState.Wandering;
        }

        if(aState != agentState.Working) {
        //if (jobState == jobSubState.Default) {
            //When the agent spawns, there is a 50% chance to spawn idle or wander
            WanderOrIdle(50.0f);
        }

        //Once everything has been set, begin consuming resources
        BeginFeeding();
    }