Exemple #1
0
    public void DEFAULT_SETTINGS()
    {
        fs = FindObjectOfType <FireSim>();

        // Water
        fs.splashRadius            = 4;
        fs.coolingStrength         = 2;
        fs.coolingStrength_falloff = 4f;
        fs.totalBuckets            = 20;
        fs.bucketCapacity          = 3f;
        fs.bucketFillRate          = 0.1f;
        fs.bucketSize_EMPTY        = 0.2f;
        fs.bucketSize_FULL         = 0.4f;

        // FIRE
        fs.startingFireCount = 10;
        fs.maxFlameHeight    = 1;
        fs.cellSize          = 0.3f;
        fs.rows             = 50;
        fs.columns          = 50;
        fs.flashpoint       = 0.2f;
        fs.heatRadius       = 2;
        fs.heatTransferRate = 0.0001f;

        // Bots

        fs.botSpeed            = 0.075f;
        fs.waterCarryAffect    = 0.5f;
        fs.total_OMNIBOTS      = 0;
        fs.bucketChain_Configs = new List <BucketChain_Config>();
    }
Exemple #2
0
    void Start()
    {
        INSTANCE = this;

        Setup_Water();
        Setup_Fire();
        Setup_Buckets();
        Setup_OMNI_Bots();
        Setup_BucketChains();
    }
Exemple #3
0
    public void Init(int _ID, float _x, float _y){
        t = transform;
        mat = GetComponent<Renderer>().material;
        fireSim = FireSim.INSTANCE;
        volume = 0;
        t.position = new Vector3(_x, t.localScale.y * 0.5f, _y);
        bucketFull = false;
        bucketActive = false;

        UpdateBucket();
    }
Exemple #4
0
    public void Init(BotType _botType, int _botID, float _x, float _y)
    {
        t               = transform;
        mat             = GetComponent <Renderer>().material;
        fireSim         = FireSim.INSTANCE;
        arriveThreshold = t.localScale.x * 1f;
        t.position      = new Vector3(_x, t.localScale.y * 0.5f, _y);
        decisionTimer   = decisionRate;

        botID           = _botID;
        carrying        = null;
        targetBucket    = null;
        isFillingBucket = false;
        Setup_BotType(_botType);
        name = _botType.ToString();
    }
Exemple #5
0
    public void Init(Transform _parent, int _index, int _rowIndex, int _columnIndex, float _size, float _maxHeight, Color _col)
    {
        t           = transform;
        t.parent    = _parent;
        index       = _index;
        flameHeight = _maxHeight;
        mat         = GetComponent <Renderer>().material;
        fireSim     = FireSim.INSTANCE;

        // scaling
        t.localScale = new Vector3(_size, _maxHeight, _size);

        // position
        t.position = new Vector3(_size * _rowIndex, -(_maxHeight * 0.5f) + Random.Range(0.01f, 0.02f), _columnIndex * _size);
        mat.color  = _col;
    }
Exemple #6
0
    void Setup_BotType(BotType _botType)
    {
        botType      = _botType;
        mat.color    = FireSim.GetBotTypeColour(botType);
        commandQueue = new Queue <BotCommand>();
        // Create command lists for each bot type
        switch (botType)
        {
        default:
            break;

        case BotType.SCOOP:
            // pickup empty bucket
            commandQueue.Enqueue(new BotCommand(BotAction.GET_BUCKET, true));
            // goto filling location
            commandQueue.Enqueue(new BotCommand(BotAction.GOTO_PICKUP_LOCATION, true));
            // fill bucket
            commandQueue.Enqueue(new BotCommand(BotAction.FILL_BUCKET, true));
            // goto bucket store location
            commandQueue.Enqueue(new BotCommand(BotAction.GOTO_DROPOFF_LOCATION, true));
            // put full bucket down in direction of fire
            commandQueue.Enqueue(new BotCommand(BotAction.DROP_BUCKET, true));
            break;

        case BotType.PASS_FULL:
            // pickup nearest inactive bucket to station
            commandQueue.Enqueue(new BotCommand(BotAction.GET_BUCKET, true));
            // goto next station in chain and DROP bucket
            commandQueue.Enqueue(new BotCommand(BotAction.PASS_BUCKET, true));
            break;

        case BotType.PASS_EMPTY:
            // pickup nearest inactive bucket to station
            commandQueue.Enqueue(new BotCommand(BotAction.GET_BUCKET, true));
            // goto next station in chain and DROP bucket
            commandQueue.Enqueue(new BotCommand(BotAction.PASS_BUCKET, true));
            break;

        case BotType.THROW:
            // look for nearest WAITING full bucket closest to your station
            commandQueue.Enqueue(new BotCommand(BotAction.GET_BUCKET, true));
            // goto fire location
            commandQueue.Enqueue(new BotCommand(BotAction.GOTO_DROPOFF_LOCATION, true));
            // throw water
            commandQueue.Enqueue(new BotCommand(BotAction.THROW_BUCKET, true));
            // go to end of chain and drop off empty bucket location
            commandQueue.Enqueue(new BotCommand(BotAction.GOTO_PICKUP_LOCATION, true));
            // go back to station, put empty bucket down
            commandQueue.Enqueue(new BotCommand(BotAction.DROP_BUCKET, true));
            break;

        case BotType.OMNIBOT:
            // pick up empty bucket
            commandQueue.Enqueue(new BotCommand(BotAction.GET_BUCKET, false));
            // Choose fill point
            commandQueue.Enqueue(new BotCommand(BotAction.GOTO_WATER, true));
            // fill bucket
            commandQueue.Enqueue(new BotCommand(BotAction.FILL_BUCKET, true));
            // walk to nearest fire point
            commandQueue.Enqueue(new BotCommand(BotAction.GOTO_FIRE, true));
            // throw water
            commandQueue.Enqueue(new BotCommand(BotAction.THROW_BUCKET, true));
            // repeat from command two
            break;
        }
        BeginCommand(commandQueue.Peek());
    }
Exemple #7
0
 void Start()
 {
     fireSim = FindObjectOfType <FireSim>();
 }