コード例 #1
0
ファイル: GenerateMap.cs プロジェクト: PinKunGg/GameProject
 private void Awake()
 {
     if (GenMapInstanse == null)
     {
         GenMapInstanse = this;
     }
 }
コード例 #2
0
    void Start()
    {
        m_Player = GameObject.Find("Player");
        GameObject manager = GameObject.Find("LevelManager");

        m_ScreenSize = manager.GetComponent <GenerateMap> ();
    }
コード例 #3
0
 private void Awake()
 {
     map        = GetComponent <GenerateMap>();
     jsonLoader = GetComponent <LoadJsonData>();
     controls   = GetComponent <MapControls>();
     nodeData   = jsonLoader.ReadNodeData();
 }
コード例 #4
0
ファイル: MapEdit.cs プロジェクト: pr00thmatic/dont-get-lost
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        GenerateMap map = target as GenerateMap;

        map.GenMap();
    }
コード例 #5
0
ファイル: GenerateMap.cs プロジェクト: SaracenOne/uQuake1
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();
            GenerateMap script = (GenerateMap)target;

            if (GUILayout.Button("Generate"))
            {
                script.PopulateLevel();
#if UNITY_EDITOR
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
#endif
            }

            if (GUILayout.Button("Clear"))
            {
                if (script.gameObject.transform.childCount > 0)
                {
                    var children = new List <GameObject>();
                    foreach (Transform child in script.gameObject.transform)
                    {
                        children.Add(child.gameObject);
                    }
                    children.ForEach(child => DestroyImmediate(child));

#if UNITY_EDITOR
                    EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
#endif
                }
            }
        }
コード例 #6
0
    private void Awake()
    {
        map      = GetComponent <GenerateMap>();
        controls = GetComponent <MapControls>();

        SetNeighborArrays();
    }
コード例 #7
0
	// Use this for initialization
	void Start () {
		Map = GameObject.Find ("Generate Map");
		GenerateMapScript = Map.GetComponent<GenerateMap> ();

		bombCount = 3;
		explodeRange = 5;
	}
コード例 #8
0
ファイル: frmPathFinding.cs プロジェクト: samsmithnz/OpenTile
        private void btnGenerateMap_Click(object sender, EventArgs e)
        {
            txtMap.Text = "";

            // Start with a clear map (don't add any obstacles)
            InitializeMap(7, 5, Point.Empty, Point.Empty, true);
            PathFinding       pathFinder = new PathFinding(searchParameters);
            PathFindingResult pathResult = pathFinder.FindPath();

            //txtMap.Text += ShowRoute("The algorithm should find a direct path without obstacles:", path);
            //txtMap.Text += Environment.NewLine;

            //// Now add an obstacle
            //InitializeMap(7, 5, Point.Empty, Point.Empty);
            //AddWallWithGap();
            //pathFinder = new PathFinding(searchParameters);
            //path = pathFinder.FindPath();
            //txtMap.Text += ShowRoute("The algorithm should find a route around the obstacle:", path);
            //txtMap.Text += Environment.NewLine;


            //// Create a barrier between the start and end points
            //InitializeMap(7, 5, Point.Empty, Point.Empty);
            //AddWallWithoutGap();
            //pathFinder = new PathFinding(searchParameters);
            //path = pathFinder.FindPath();
            //txtMap.Text += ShowRoute("The algorithm should not be able to find a route around the barrier:", path);
            //txtMap.Text += Environment.NewLine;


            //// Create a maze with custom start and end points
            //InitializeMap(7, 5, new Point(0, 4), new Point(6, 4));
            //AddWallWithMaze();
            //pathFinder = new PathFinding(searchParameters);
            //path = pathFinder.FindPath();
            //txtMap.Text += ShowRoute("The algorithm should be able to find a long route around the barrier:", path);
            //txtMap.Text += Environment.NewLine;


            //// Create a maze with custom start and end points
            //InitializeMap(7, 5, new Point(0, 4), new Point(4, 2));
            //AddWallWithSpinningMaze();
            //pathFinder = new PathFinding(searchParameters);
            //path = pathFinder.FindPath();
            //txtMap.Text += ShowRoute("The algorithm should be able to find a long route around the barrier:", path);
            //txtMap.Text += Environment.NewLine;


            // Create a larger maze with custom start and end points
            InitializeMap(70, 40, new Point(0, 0), new Point(69, 39), false);
            this.map     = GenerateMap.GenerateRandomMap(this.map, 70, 40, 40);
            pathFinder   = new PathFinding(searchParameters);
            pathResult   = pathFinder.FindPath();
            txtMap.Text += ShowRoute("The algorithm should be able to find a long route around the random blocks:", pathResult.Path);
            txtMap.Text += Environment.NewLine;

            //Console.WriteLine("Press any key to exit...");
            //Console.ReadKey();
        }
コード例 #9
0
    void Start()
    {
        GameObject manager = GameObject.Find("LevelManager");
        GameObject player  = GameObject.Find("Player");

        m_Maps  = manager.GetComponent <GenerateMap> ();
        m_Items = player.GetComponent <PlayerEQ> ();
    }
コード例 #10
0
    private void Awake()
    {
        map         = GetComponent <GenerateMap>();
        gameManager = GetComponent <GameManager>();
        controls    = GetComponent <MapControls>();

        instructionAmount = instruction[0].Length;
    }
コード例 #11
0
    void Awake()
    {
        _genericFunctions = FindObjectOfType <GenericFunctions>();
        _generateMap      = FindObjectOfType <GenerateMap>();
        _architect        = FindObjectOfType <Architect>();

        _rb  = GetComponent <Rigidbody2D>();
        _cam = Camera.main;
    }
コード例 #12
0
    // generates a new terrain with random seeds
    public void NewGeneration()
    {
        newGenerations = Random.Range(0, 10000);
        generations    = newGenerations;
        Random.InitState(generations);
        GenerateMap map = new GenerateMap();

        Create();
    }
コード例 #13
0
    private void Start()
    {
        mapGenerator    = FindObjectOfType <GenerateMap>();
        meshWorldSize   = mapGenerator.meshSettings.meshWorldSize;
        maxViewDistance = detailLevels[detailLevels.Length - 1].visibleDistanceThreshold;
        chunksVisible   = Mathf.RoundToInt(maxViewDistance / meshWorldSize);

        UpdateVisibleChunks();
    }
コード例 #14
0
    //Initializing map chunks
    void Start()
    {
        maxViewDist = detailLevels[detailLevels.Length - 1].visibleDistanceThreshold;

        mapGenerator            = FindObjectOfType <GenerateMap>();
        chunkSize               = GenerateMap.mapChunkSize - 1;
        chunksVisibleInViewDist = Mathf.RoundToInt(maxViewDist / chunkSize);

        UpdateVisibleChunks();
    }
コード例 #15
0
 public void InstantiateObject(float y, GenerateMap _generateMap)
 {
     for (int i = 0; i < _blocks.Length; i++)
     {
         GameObject b = Instantiate(_blocks [i].gameObject, new Vector2((2 * _generateMap.Blocks.Count), y), Quaternion.identity) as GameObject;
         _generateMap.BlockCount++;
         b.transform.parent = _generateMap.transform;
         _generateMap.Blocks.Add(b);
     }
 }
コード例 #16
0
    void Start()
    {
        GameObject manager = GameObject.Find("LevelManager");
        GameObject player  = GameObject.Find("Player");

        m_Map      = manager.GetComponent <GenerateMap> ();
        m_PlayerEQ = player.GetComponent <PlayerEQ> ();
        m_xPos     = (int)transform.position.x;
        m_yPos     = (int)transform.position.y;
    }
コード例 #17
0
 public void setup(List <string[]> data, int gridWidth, int gridHeight, GenerateMap map)
 {
     for (int i = 0; i < prefab.Length; i++)
     {
         prefabMap[prefabSymbols[i]] = prefab[i];
     }
     gridMap = map;
     unitMap = new Transform[gridHeight, gridWidth];
     spawnUnits(data);
 }
コード例 #18
0
    /***************************************************/
    /***  METHODS               ************************/
    /***************************************************/

    /********  UNITY MESSAGES   ************************/

    // Use this for initialization
    private void Start()
    {
        Vector3 polar = GenerateMap.CartesianToPolar(transform.position);

        SetColor(Color.HSVToRGB(
                     polar.y / Mathf.PI,
                     1 - (polar.x / SettingsManager.Inst.m_rayonSphere) * 0.5f,
                     1 - (polar.z / 2 * Mathf.PI) * 0.5f
                     ));
    }
コード例 #19
0
ファイル: MapGenerator.cs プロジェクト: Sta-ces/GlobalGameJam
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        GenerateMap map = target as GenerateMap;

        if (map.m_ChangeOnScene)
        {
            map.MapGenerator();
        }
    }
コード例 #20
0
 public PlayerStateMachine(GenerateMap m, Transform canvas)
 {
     this.map      = m;
     this.canvas   = canvas;
     moveState     = new MoveState(this);
     attackState   = new AttackState(this);
     waitState     = new WaitState(this);
     selectedState = new SelectedState(this);
     endTurn       = new EndTurnState(this);
     pathFinding   = new Pathfinding(map.tiles);
 }
コード例 #21
0
ファイル: GenerateMap.cs プロジェクト: vinhui/uQuake3
    private static void ClearChildren(GenerateMap script)
    {
// http://forum.unity3d.com/threads/deleting-all-chidlren-of-an-object.92827/
        List <GameObject> children = new List <GameObject>();

        foreach (Transform child in script.gameObject.transform)
        {
            children.Add(child.gameObject);
        }
        children.ForEach(child => DestroyImmediate(child));
    }
コード例 #22
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        GenerateMap gen = (GenerateMap)target;

        if (GUILayout.Button("Generate!"))
        {
            gen.createMap();
        }
    }
コード例 #23
0
ファイル: BombTimer.cs プロジェクト: ericjeffers/Bomber-Royal
	// Use this for initialization
	void Start () {
		Object1 = GameObject.Find ("Generate Map");;
		GenerateMapScript = Object1.GetComponent<GenerateMap> ();
		//PlayerBehaviorScript = Object1.GetComponent<PlayerBehavior> ();

		player = GenerateMapScript.players[0];
		//x = (player.GetComponent("PlayerBehavior") as PlayerBehavior).x;
		//y = (player.GetComponent("PlayerBehavior") as PlayerBehavior).y;

		//Debug.Log ((player.GetComponent("PlayerBehavior") as PlayerBehavior).bombs.Count);
	}
コード例 #24
0
 void Start()
 {
     generateMap   = this;
     map           = Resources.Load("map") as Texture2D;
     map           = GameObject.Instantiate(map);
     image.texture = map;
     image.SetNativeSize();
     mapSizeX = map.width;
     mapSizeY = map.height;
     StartCoroutine(GetCitys());
 }
コード例 #25
0
    public event System.Action OnDeath; //событие которое срабатывает при смерти

    // Use this for initialization
    void Start()
    {
        nextTime = Time.time + timeBetweenClicks;
        map      = FindObjectOfType <GenerateMap>();
        gameUI   = FindObjectOfType <GameUI>();
        lhd      = FindObjectOfType <LeftHandDetector>();
        rhd      = FindObjectOfType <RightHandDetector>();

        score    = 0;
        rotate   = true;
        OnDeath += DissbaleRotation;
    }
コード例 #26
0
ファイル: MapEditor.cs プロジェクト: ArthurCurry/PCGDemo
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        //EditorGUILayout.LabelField("宽度");
        //mapWidth = EditorGUILayout.IntSlider(mapWidth, 10, 200);

        //EditorGUILayout.LabelField("长度");
        //mapHeight = EditorGUILayout.IntSlider(mapHeight, 10, 200);
        mapGenerator.seed = mapGenerator.mapSetting.seed;


        if (GUILayout.Button("清空地图"))
        {
            mapGenerator.ClearMap();
        }
        using (var check = new EditorGUI.ChangeCheckScope())
        {
            generationType = (MapType)EditorGUILayout.EnumPopup("生成地图类型", generationType);
            Editor editor = CreateEditor(mapGenerator.mapSetting);
            editor.OnInspectorGUI();
            if (check.changed || GUILayout.Button("预览地图"))
            {
                generateMethod = new GenerateMap(GenerateMapType(generationType));
                generateMethod();
                //Debug.Log(generationType);
            }
        }
        if (GUILayout.Button("铺瓦片"))
        {
            mapGenerator.GenerateBinaryMap();
        }
        if (GUILayout.Button("获取瓦片资源"))
        {
            TileManager.Instance.InitData();
            RoomManager.Instance.InitData();
        }
        pos = EditorGUILayout.Vector2IntField("坐标", pos);
        if (GUILayout.Button("击打障碍物 hp 20/次"))
        {
            Debug.Log("button down");
            Vector3Int   targetPos = new Vector3Int(pos.x, pos.y, 0);
            ObstacleTile tile      = (ObstacleTile)mapGenerator.tilemap.GetTile(targetPos);
            tile.hps[targetPos] -= 20;
            //mapGenerator.tilemap.RefreshAllTiles();
            mapGenerator.tilemap.RefreshTile(targetPos);
        }
        if (GUILayout.Button("刷新地图"))
        {
            mapGenerator.tilemap.RefreshAllTiles();
        }
    }
コード例 #27
0
    private void CreateFog(EnemiesDataManager.EvilFogGenerationData p_data)
    {
        GameObject fog = Instantiate(m_prefabFog,
                                     GenerateMap.PolarToCartesian(GenerateMap.GenerateRandomPolarCoordinates(SettingsManager.Inst.m_rayonExternalSphere, SettingsManager.Inst.m_rayonExternalSphere)),
                                     Quaternion.identity);

        fog.GetComponent <EvilFog>().m_availableEnemies.Clear();
        foreach (int index in p_data.m_availableEnemies)
        {
            fog.GetComponent <EvilFog>().m_availableEnemies.Add(m_availableEnemies[index]);
        }
        fog.GetComponent <EvilFog>().m_numberOfEnemies = p_data.m_numberOfEnemies;
    }
コード例 #28
0
    private void Start()
    {
        randomMoveCounter = 0;
        map     = GameObject.FindGameObjectWithTag("GameManager");
        mapInfo = map.GetComponent <GenerateMap>();

        rnd = new System.Random();
        if (unitType == "Melee")
        {
            unitSpeed = 4;
            health    = 1300;
            maxHealth = 1300;
        }
    }
コード例 #29
0
        public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
        {
            int len    = _size.x * _size.y;
            var buffer = dstManager.AddBuffer <MapTilesBuffer>(entity);

            buffer.ResizeUninitialized(len);
            unsafe
            {
                UnsafeUtility.MemClear(buffer.GetUnsafePtr(), buffer.Length *
                                       UnsafeUtility.SizeOf <MapTilesBuffer>());
            }

            dstManager.AddComponent <Map>(entity);
            dstManager.AddComponentData <MapSize>(entity, _size);

            var playerPrefab = _playerPrefab == null ? Entity.Null :
                               conversionSystem.GetPrimaryEntity(_playerPrefab);

            var monsterPrefabs = new NativeList <Entity>(Allocator.Temp);
            var itemPrefabs    = new NativeList <Entity>(Allocator.Temp);

            foreach (var goPrefab in _monsterPrefabs)
            {
                monsterPrefabs.Add(
                    conversionSystem.GetPrimaryEntity(goPrefab));
            }
            foreach (var item in _itemPrefabs)
            {
                itemPrefabs.Add(conversionSystem.GetPrimaryEntity(item));
            }

            if (_genSettings.Seed == 0)
            {
                _genSettings.Seed = (uint)UnityEngine.Random.Range(1, int.MaxValue);
            }

            var tiles = dstManager.AddBuffer <MapTileAssetsBuffer>(entity);

            // Each index of the buffer should map to it's corresponding "tile type"
            /// <seealso cref="MapTileType"/>
            tiles.Add(_wallTile.ToTerminalTile());
            tiles.Add(_floorTile.ToTerminalTile());

            GenerateMap.AddToEntity(dstManager, entity,
                                    _genSettings,
                                    playerPrefab,
                                    monsterPrefabs,
                                    itemPrefabs);
        }
コード例 #30
0
ファイル: ProceduralMap.cs プロジェクト: springmouse/Lighting
    public void GenerateMap()
    {
        float[,] noiseMap = Noise.GeneratNoiseMap(mapWidth, mapHeight, seed, noiseScale, octives, persistance, lacunarity, offset);

        GenerateMap display = FindObjectOfType <GenerateMap>();

        if (drawMode == DrawState.NOISEMAP)
        {
            display.DrawNoiseMap(noiseMap);
        }
        else if (drawMode == DrawState.MESH)
        {
            display.DrawMesh(MeshGenerator.GenerateTerrainMesh(noiseMap, meshHeightMultiplyer));
        }
    }
コード例 #31
0
    void Start()
    {
        mapGen = FindObjectOfType <GenerateMap>();
        if (mapGen == null)
        {
            Debug.LogError("Networked Manager: No map generator found.");
        }

        legendScoreText   = GameObject.Find("LegendScore").GetComponent <TextMeshProUGUI>();
        survivorScoreText = GameObject.Find("SurvivorScore").GetComponent <TextMeshProUGUI>();
        if (legendScoreText == null || survivorScoreText == null)
        {
            Debug.LogError("Text object not found");
        }
    }
コード例 #32
0
    public void setup()
    {
        StreamReader stream = new StreamReader(@"Assets\Maps\" + map_filename);

        mapData   = MapParser.getMapData(stream);
        stream    = new StreamReader(@"Assets\Maps\" + units_filename);
        unitsData = MapParser.getMapData(stream);
        stream.Close();

        grid  = GetComponentInChildren <GenerateMap>();
        units = GetComponentInChildren <GenerateUnit>();

        grid.setup(mapData);
        units.setup(unitsData, grid.getWidth(), grid.getHeight(), grid);
    }
コード例 #33
0
	void Start() {
		if (map == null) {
			map = GetComponent<GenerateMap>();
			if (map.mapName == "custom") {
				lowerBound = 8f;
				Vector3 pos = transform.position;
				pos.y = 12.5f;
				pos.x = 16.5f;
				transform.position = pos;
				Camera.main.orthographicSize = 12.5f;
				RightPreviewBoarder = 17.5f;
				LeftPreviewBoarder = 16.5f;
				//previewSpeed = 0.3f;
			}
			if (map.mapName == "1") {
				lowerBound = transform.position.y;
			}
		}

	}
コード例 #34
0
	protected void Start() {
		map = Camera.main.GetComponent<GenerateMap> ();
	}
コード例 #35
0
ファイル: GenerateMap.cs プロジェクト: Fierfek/MapGenerater
 void Awake()
 {
     instance = this;
 }
コード例 #36
0
	// Use this for initialization
	void Start () {
		Object1 = GameObject.Find ("Generate Map");
		Script1 = Object1.GetComponent<GenerateMap> ();
	}
コード例 #37
0
ファイル: PlayerMovement.cs プロジェクト: Siksjuh/Blocker
 // Use this for initialization
 void Start()
 {
     layout = GameObject.Find ("GameHandler").GetComponent<GenerateMap> ();
     turnSignaler = GameObject.Find ("GameHandler").GetComponent<TurnHandler> ();
     targetPositions = new GameObject[0];
     layout.showingTargets = false;
     moveTo = transform.position;
     timer = 0;
     computerTurn = true;
     moving = false;
 }