public iAreaRange GetAreaRange(eAreaType areaType)
        {
            WeatherArea area  = m_script.Area;
            iAreaRange  range = area.GetAreaRange(areaType);

            if (range == null)
            {
                switch (areaType)
                {
                case eAreaType.Cube:
                    range = new CubeRange();
                    break;

                case eAreaType.Cylinder:
                    range = new CylinderRange();
                    break;

                case eAreaType.Sphere:
                    range = new SphereRange();
                    break;
                }
                area.SetAreaRange(areaType, range);
            }

            return(range);
        }
Beispiel #2
0
        public void SetAreaRange(eAreaType areaType, iAreaRange range)
        {
            switch (areaType)
            {
            case eAreaType.Global:
                m_globalRange = range as GlobalRange;
                break;

            case eAreaType.Cube:
                m_cubeRange = range as CubeRange;
                break;

            case eAreaType.Cylinder:
                m_cylinderRange = range as CylinderRange;
                break;

            case eAreaType.Sphere:
                m_sphereRange = range as SphereRange;
                break;
            }
        }
Beispiel #3
0
    public GameArea(Transform t)
    {
        //Debug.Log("GameZone " + t.name + " starting");
        areaHolder = t;
        areaName   = t.name;

        switch (areaName.Substring(4, 1))
        {
        case "P":
            areaType = eAreaType.PLAYER;
            break;

        case "M":
            areaType = eAreaType.MARKET;
            break;

        default:
            areaType = eAreaType.OTHER;
            break;
        }

        //Debug.Log("GameArea " + t.name + " created");
        createZones();
    }
Beispiel #4
0
        public iAreaRange GetAreaRange(eAreaType areaType)
        {
            iAreaRange range = null;

            switch (areaType)
            {
            case eAreaType.Global:
                range = m_globalRange;
                break;

            case eAreaType.Cube:
                range = m_cubeRange;
                break;

            case eAreaType.Cylinder:
                range = m_cylinderRange;
                break;

            case eAreaType.Sphere:
                range = m_sphereRange;
                break;
            }
            return(range);
        }
    public static HashSet <GridCell> GetAoE(GridCell target, GridCell start, eAreaType aoe, int size)
    {
        HashSet <GridCell> area = new HashSet <GridCell> ();

        GetGridCells();

        string facing = start.GetFacing(target);

        switch (aoe)
        {
        case eAreaType.SINGLE:
            area.Add(target);
            return(area);

        case eAreaType.CIRCLE:
            for (int x = -size; x <= size; x++)
            {
                for (int y = -size; y <= size; y++)
                {
                    GridPos p = new GridPos(target.gridPos.x - x, target.gridPos.y - y);
                    if (cells.ContainsKey(p))
                    {
                        if (target.CalcDistance(cells [p]) <= size)
                        {
                            if (!area.Contains(cells[p]))
                            {
                                area.Add(cells [p]);
                            }
                        }
                    }
                }
            }
            return(area);

        case eAreaType.CROSS:
            for (int x = -size; x <= size; x++)
            {
                GridPos p = new GridPos(target.gridPos.x - x, target.gridPos.y);
                if (cells.ContainsKey(p))
                {
                    if (!area.Contains(cells [p]))
                    {
                        area.Add(cells [p]);
                    }
                }
            }
            for (int y = -size; y <= size; y++)
            {
                GridPos p = new GridPos(target.gridPos.x, target.gridPos.y - y);
                if (cells.ContainsKey(p))
                {
                    if (!area.Contains(cells [p]))
                    {
                        area.Add(cells [p]);
                    }
                }
            }
            return(area);

        case eAreaType.V_LINE:
            if (facing == "NE")
            {
                for (int y = 0; y <= size; y++)
                {
                    GridPos p = new GridPos(target.gridPos.x, target.gridPos.y + y);
                    if (cells.ContainsKey(p))
                    {
                        if (!area.Contains(cells [p]))
                        {
                            area.Add(cells [p]);
                        }
                    }
                }
            }
            else if (facing == "SE")
            {
                for (int x = 0; x <= size; x++)
                {
                    GridPos p = new GridPos(target.gridPos.x + x, target.gridPos.y);
                    if (cells.ContainsKey(p))
                    {
                        if (!area.Contains(cells [p]))
                        {
                            area.Add(cells [p]);
                        }
                    }
                }
            }
            else if (facing == "SW")
            {
                for (int y = 0; y <= size; y++)
                {
                    GridPos p = new GridPos(target.gridPos.x, target.gridPos.y - y);
                    if (cells.ContainsKey(p))
                    {
                        if (!area.Contains(cells [p]))
                        {
                            area.Add(cells [p]);
                        }
                    }
                }
            }
            else if (facing == "NW")
            {
                for (int x = 0; x <= size; x++)
                {
                    GridPos p = new GridPos(target.gridPos.x - x, target.gridPos.y);
                    if (cells.ContainsKey(p))
                    {
                        if (!area.Contains(cells [p]))
                        {
                            area.Add(cells [p]);
                        }
                    }
                }
            }
            return(area);

        case eAreaType.H_LINE:

            return(area);
        }

        return(area);
    }
Beispiel #6
0
    public GameArea(Transform t)
    {
        //Debug.Log("GameZone " + t.name + " starting");
        areaHolder = t;
        areaName = t.name;

        switch (areaName.Substring(4, 1))
        {
            case "P":
                areaType = eAreaType.PLAYER;
                break;
            case "M":
                areaType = eAreaType.MARKET;
                break;
            default:
                areaType = eAreaType.OTHER;
                break;
        }

        //Debug.Log("GameArea " + t.name + " created");
        createZones();
    }