void Awake() { currentState = State.INITIAL; flockWander = GetComponent <FlockingAround>(); blackboard = GetComponent <SHEEP_Blackboard>(); flockWander.enabled = false; }
void Start() { flockingAround = GetComponent <FlockingAround>(); //flee = GetComponent<FleePlusAvoid>(); blackboard = GetComponent <BIRD_Blackboard>(); flockingAround.enabled = false; //flee.enabled = false; ChangeState(State.INITIAL); }
private float elapsedTime = 0f; // time elapsed since last generation void Update() { if (generated == numInstances) { return; } GameObject clone; if (elapsedTime >= interval) { // spawn creating an instance... clone = Instantiate(sample); clone.transform.position = this.transform.position; KinematicState ks = clone.GetComponent <KinematicState>(); if (ks != null) { ks.maxSpeed = ks.maxSpeed + Utils.binomial() * variationRatio * ks.maxSpeed; ks.maxAcceleration = ks.maxAcceleration + Utils.binomial() * variationRatio * ks.maxAcceleration; } FlockingAround fk = clone.GetComponent <FlockingAround>(); if (fk != null) { fk.cohesionThreshold += Utils.binomial() * variationRatio * fk.cohesionThreshold; fk.repulsionThreshold += Utils.binomial() * variationRatio * fk.repulsionThreshold; fk.wanderRate += Utils.binomial() * variationRatio * fk.wanderRate; fk.seekWeight += Utils.binomial() * variationRatio * fk.seekWeight; fk.wdWeight += Utils.binomial() * variationRatio * fk.wdWeight; fk.rpWeight += Utils.binomial() * variationRatio * fk.rpWeight; fk.coWeight += Utils.binomial() * variationRatio * fk.coWeight; fk.vmWeight += Utils.binomial() * variationRatio * fk.vmWeight; } else { Debug.Log("flocking is null"); } generated++; elapsedTime = 0; } else { elapsedTime += Time.deltaTime; } }
void Start() { flockWander = GetComponent <FlockingAround>(); blackboard = GetComponent <SHEEP_Blackboard>(); flockWander.enabled = false; }