Exemplo n.º 1
0
    public void Enter()
    {
        wanderAround = new WanderAround(agent, agent.speed, animal);

        searchForFood  = new SearchForFood(searchLayer1, animal, searchRadius, "Food", agent, foodConsumingRate);
        searchForWater = new SearchForWater(searchLayer2, animal, searchRadius, "Water", agent, waterConsumingRate);

        //animal.SetBusy(BaseAnimal.BusyType.SearchingForResource);
    }
Exemplo n.º 2
0
    public override void OnStart()
    {
        base.OnStart();

        wanderAround            = gameObject.GetComponent <WanderAround>();
        wanderAround.attractor  = attractor;
        wanderAround.seekWeight = seekWeight;

        wanderAround.enabled = true;
    }
Exemplo n.º 3
0
    void SpawnChicken()
    {
        GameObject clone = Instantiate(chickenPrefab, Spawn, Quaternion.identity);

        clone.transform.parent = chickenFolder.transform;

        clone.transform.position         = Spawn;
        clone.transform.localScale       = new Vector3(45f, 45f, 45f);
        clone.transform.localEulerAngles = new Vector3(0, 0, 0);
        clone.name  = "Chicken";
        clone.layer = LayerMask.NameToLayer("Chickens");

        SphereCollider sphereCollider = clone.AddComponent <SphereCollider>() as SphereCollider;
        Rigidbody      rigidBody      = clone.AddComponent <Rigidbody>() as Rigidbody;

        rigidBody.useGravity = false;
        GravityBody gravityBody = clone.AddComponent <GravityBody>() as GravityBody;

        gravityBody.fixRotation = true;
        WanderAround wanderAround = clone.AddComponent <WanderAround>() as WanderAround;

        wanderAround.speed       = 2f;
        wanderAround.rotation    = 3f;
        wanderAround.maxRotation = 10f;

        GameObject batterySpawner = Instantiate(new GameObject(), new Vector3(0f, 0f, 0f), Quaternion.identity);

        batterySpawner.transform.parent = clone.transform;
        batterySpawner.name             = "BatterySpawner";

        batterySpawner.transform.localPosition    = new Vector3(0f, 0f, 0f);
        batterySpawner.transform.localScale       = new Vector3(1f, 1f, 1f);
        batterySpawner.transform.localEulerAngles = new Vector3(0, 0, 0);

        BatterySource batterySource = batterySpawner.AddComponent <BatterySource>() as BatterySource;

        batterySource.countText            = countText;
        batterySource.batteryPrefab        = batteryPrefab;
        batterySource.batteryScaleX        = 2f;
        batterySource.batteryScaleY        = 4.5f;
        batterySource.batteryScaleZ        = 2f;
        batterySource.batteryTriggerScaleX = 0.4f;
        batterySource.batteryTriggerScaleY = 0.2f;
        batterySource.batteryTriggerScaleZ = 0.4f;
        batterySource.speed            = 2f;
        batterySource.velocity         = 0.5f;
        batterySource.layingPercentage = 0.4f;

        AudioSource audioSource = clone.AddComponent <AudioSource>() as AudioSource;

        audioSource.spatialBlend = 1f;
        audioSource.clip         = chickenAudioCLip;
        audioSource.loop         = true;
        audioSource.Play();
    }
Exemplo n.º 4
0
    void Start()
    {
        blackboard   = GetComponent <HEN_BLACKBOARD>();
        wanderAround = GetComponent <WanderAround>();
        arrive       = GetComponent <Arrive>();
        audioSource  = GetComponent <AudioSource>();

        wanderAround.seekWeight = 0.0f;
        wanderAround.attractor  = blackboard.attractor;

        wanderAround.enabled = false;
        arrive.enabled       = false;
    }
Exemplo n.º 5
0
    // Start is called before the first frame update
    void Start()
    {
        wanderAround = GetComponent <WanderAround>();
        flee         = GetComponent <Flee>();
        ks           = GetComponent <KinematicState>();
        theHen       = GameObject.Find("HEN");
        blackboard   = theHen.GetComponent <HEN_BLACKBOARD>();

        wanderAround.attractor  = theHen;
        wanderAround.seekWeight = 0.4f;
        flee.target             = theHen;
        wanderAround.enabled    = false;
        flee.enabled            = false;
    }
Exemplo n.º 6
0
 public void Enter()
 {
     wanderAround = new WanderAround(agent, agent.speed, animal);
     resting      = new Resting(animal, agent);
 }