Ejemplo n.º 1
0
    void getPointsToSecure()
    {
        if (buildingUnderSiege == null || buildingUnderSiege.isOutdoors == true)
        {
            //Debug.Log ("Points set for outdoors");
            CivilianAction[] cas = FindObjectsOfType <CivilianAction> ();
            foreach (CivilianAction p in cas)
            {
                Transform t            = p.positionForAction;
                WorldTile nearestPoint = WorldBuilder.me.findNearestWorldTile(t.position);
                pointsToSecure.Add(t);
            }
        }
        else
        {
            pointsToSecure = new List <Transform> ();
            //Debug.Log ("Points set for indoors");

            foreach (Transform t in buildingUnderSiege.entrances)
            {
                WorldTile nearestPoint = WorldBuilder.me.findNearestWorldTile(t.position);
                for (int x = nearestPoint.gridX - 5; x < nearestPoint.gridX + 5; x++)
                {
                    for (int y = nearestPoint.gridY - 5; y < nearestPoint.gridY + 5; y++)
                    {
                        WorldTile wt;
                        wt = WorldBuilder.me.worldTiles [x, y].GetComponent <WorldTile> ();
                        if (wt == null)
                        {
                        }
                        else
                        {
                            if (buildingUnderSiege.isPosInRoom(wt.transform.position) == false && Vector3.Distance(wt.transform.position, t.position) > 3 && wt.walkable == true)
                            {
                                pointsToSecure.Add(wt.transform);
                            }
                        }
                    }
                }
            }
        }
    }