示例#1
0
    public void explodeHazmat(int x, int z)
    {
        int[] key = new int[] { x, z };
        Debug.Log("In ExplodeHazmat");
        if (containsKey(key[0], key[1], placedHazmat))
        {
            Debug.Log("Contains Key");
            Hazmat h = get(key[0], key[1], placedHazmat);
            h.setHazmatStatus(HazmatStatus.HotSpot);
            Remove(key[0], key[1], placedHazmat);
            gm.DestroyObject(get(key[0], key[1], lookUp));
            Remove(key[0], key[1], lookUp);
            placedHotspot.Add(key, h);
            GameObject go = gm.instantiateObject(h.prefab, new Vector3((float)(x * 6 + 1.5), posY, (float)(z * 6 - 1.5)), Quaternion.identity);
            go.transform.Rotate(90, 0, 0);
        }

        if (containsKey(key[0], key[1], movingHazmat))
        {
            Debug.Log("Contains Key");
            this.dropHazmat(x, z);
            gm.StopCarryH(x, z);
            Hazmat h = get(key[0], key[1], placedHazmat);
            h.setHazmatStatus(HazmatStatus.HotSpot);
            Remove(key[0], key[1], placedHazmat);
            gm.DestroyObject(get(key[0], key[1], lookUp));
            Remove(key[0], key[1], lookUp);
            placedHotspot.Add(key, h);
            GameObject go = gm.instantiateObject(h.prefab, new Vector3((float)(x * 6 + 1.5), posY, (float)(z * 6 - 1.5)), Quaternion.identity);
            go.transform.Rotate(90, 0, 0);
        }
    }
示例#2
0
    public void putHazmat(HazmatStatus status = HazmatStatus.Hazmat)
    {
        int randX = rand.Next(1, 9);
        int randZ = rand.Next(1, 7);

        int[] key = new int[] { randX, randZ };

        while (containsKey(key[0], key[1], placedHazmat) || containsKey(key[0], key[1], placedHotspot) || gm.tileMap.tiles[randX, randZ] == 2)
        {
            randX = rand.Next(1, 9);
            randZ = rand.Next(1, 7);

            key = new int[] { randX, randZ };
        }

        Hazmat h = new Hazmat(this, status);

        if ((HazmatStatus)status == HazmatStatus.Hazmat)
        {
            placedHazmat.Add(key, h);
        }
        else
        {
            placedHotspot.Add(key, h);
        }

        GameObject go = gm.instantiateObject(h.prefab, new Vector3((float)(randX * 6 + 1.5), posY, (float)(randZ * 6 - 1.5)), Quaternion.identity);

        go.transform.Rotate(90, 0, 0);
        if (h.status == HazmatStatus.Hazmat)
        {
            lookUp.Add(key, go);
        }
        gm.AddHazmat(randX, randZ, (int)h.status);
    }
示例#3
0
    public void explosion(int x, int z)
    {
        int[]  key = new int[] { x, z };
        Hazmat h   = new Hazmat(this, HazmatStatus.HotSpot);

        placedHotspot.Add(key, h);
        GameObject go = gm.instantiateObject(h.prefab, new Vector3((float)(x * 6 + 1.5), posY, (float)(z * 6 - 1.5)), Quaternion.identity);

        go.transform.Rotate(90, 0, 0);
    }
示例#4
0
    public void dropHazmat(int x, int z)
    {
        if (containsKey(x, z, movingHazmat))
        {
            Hazmat     p   = get(x, z, movingHazmat);
            GameObject obj = get(x, z, movingLookup);
            Remove(x, z, movingHazmat);
            Remove(x, z, movingLookup);

            int[] key = new int[] { x, z };
            placedHazmat.Add(key, p);
            lookUp.Add(key, obj);
            obj.transform.position = new Vector3((float)(x * 6 + 1.5), posY, (float)(z * 6 - 1.5));
        }
    }
示例#5
0
    public void moveHazmat(int origx, int origz, int newx, int newz)
    {
        Hazmat     p   = get(origx, origz, movingHazmat);
        GameObject obj = get(origx, origz, movingLookup);

        if (p != null)
        {
            Remove(origx, origz, movingHazmat);
            Remove(origx, origz, movingLookup);
            obj.transform.position = new Vector3((float)(newx * 6 - 1.5), posY, (float)(newz * 6 - 1.5));
            int[] key = new int[] { newx, newz };
            movingHazmat.Add(key, p);
            movingLookup.Add(key, obj);
        }
    }
示例#6
0
    public void carryHazmat(int x, int z)
    {
        Hazmat     p   = get(x, z, placedHazmat);
        GameObject obj = get(x, z, lookUp);

        if (p != null)
        {
            Remove(x, z, placedHazmat);
            Remove(x, z, lookUp);

            int[] key = new int[] { x, z };
            movingHazmat.Add(key, p);
            movingLookup.Add(key, obj);
            obj.transform.position = new Vector3((float)(x * 6 - 1.5), posY, (float)(z * 6 - 1.5));
        }
    }
示例#7
0
    public void loadHazmat()
    {
        Dictionary <int[], int> HazmatMemo       = StaticInfo.HazmatMemo;
        Dictionary <int[], int> hotSpotMemo      = StaticInfo.hotSpotMemo;
        Dictionary <int[], int> movingHazmatMemo = StaticInfo.movingHazmatMemo;

        foreach (KeyValuePair <int[], int> entry in HazmatMemo)
        {
            var key  = entry.Key;
            var type = entry.Value;

            Hazmat     h  = new Hazmat(this, HazmatStatus.Hazmat);
            GameObject go = gm.instantiateObject(h.prefab, new Vector3((float)(key[0] * 6 + 1.5), posY, (float)(key[1] * 6 - 1.5)), Quaternion.identity);
            go.transform.Rotate(90, 0, 0);

            lookUp.Add(key, go);
            placedHazmat.Add(key, h);
        }

        foreach (KeyValuePair <int[], int> entry in movingHazmatMemo)
        {
            var key  = entry.Key;
            var type = entry.Value;

            Hazmat     h  = new Hazmat(this, HazmatStatus.Hazmat);
            GameObject go = gm.instantiateObject(h.prefab, new Vector3((float)(key[0] * 6 - 1.5), posY, (float)(key[1] * 6 - 1.5)), Quaternion.identity);
            go.transform.Rotate(90, 0, 0);

            movingLookup.Add(key, go);
            movingHazmat.Add(key, h);
        }

        foreach (KeyValuePair <int[], int> entry in hotSpotMemo)
        {
            var key  = entry.Key;
            var type = entry.Value;

            Hazmat     h  = new Hazmat(this, HazmatStatus.HotSpot);
            GameObject go = gm.instantiateObject(h.prefab, new Vector3((float)(key[0] * 6 + 1.5), posY, (float)(key[1] * 6 - 1.5)), Quaternion.identity);
            go.transform.Rotate(90, 0, 0);

            placedHotspot.Add(key, h);
        }
    }
示例#8
0
    public void addHazmat(int x, int z, int status)
    {
        int[]  key = new int[] { x, z };
        Hazmat h   = new Hazmat(this, (HazmatStatus)status);

        if ((HazmatStatus)status == HazmatStatus.Hazmat)
        {
            placedHazmat.Add(key, h);
        }
        else
        {
            placedHotspot.Add(key, h);
        }
        GameObject go = gm.instantiateObject(h.prefab, new Vector3((float)(x * 6 + 1.5), posY, (float)(z * 6 - 1.5)), Quaternion.identity);

        go.transform.Rotate(90, 0, 0);
        if (h.status == HazmatStatus.Hazmat)
        {
            lookUp.Add(key, go);
        }
    }