示例#1
0
    public void PlacePerson(GameObject gameObject, float spacing = 0.02f, int gridWidth = 3)
    {
        GridPlacer.Place(gameObject, DropoffArea.transform, spacing, gridWidth);
        gameObject.transform.localScale = Vector3.one;

        GameController.Instance.PersonSaved();
    }
示例#2
0
    // Use this for initialization
    void OnEnable()
    {
        wallCellModel = GameObject.FindGameObjectsWithTag("Cell");
        wallCellGroup = new WallGroup[wallCellModel.Length];
        coordinates   = new int[wallCellModel.Length, 2];
        for (int i = 0; i < wallCellModel.Length; i++)
        {
            string[] nums = wallCellModel[i].name.Split(' ');
            coordinates[i, 0] = int.Parse(nums[0]);
            coordinates[i, 1] = int.Parse(nums[1]);
            wallCellGroup[i]  = new WallGroup(coordinates[i, 0], coordinates[i, 1]);
        }

        ExploreCell(0, 0);


        GridPlacer placer = new GridPlacer(coordinates);
        Pathfinder finder = new Pathfinder(wallCellGroup);

        for (int i = 0; i < 5; i++)
        {
            placer.PlaceDistanceAway(finder, new int[] { 0, 0 }, relic, 3);
        }

        placer.PlaceDistanceAway(finder, new int[] { 0, 0 }, pumpkin, 5);


        GameObject.FindGameObjectWithTag("MainCamera").GetComponent <ScoreTracker>().enabled = true;
        GameObject.Find("HUDCanvas").GetComponent <Animator>().SetTrigger("DisplayScore");
    }
示例#3
0
    private void Spawn()
    {
        var gameObject = Instantiate(Prefab, transform);

        GridPlacer.Place(gameObject, transform);
        SpawnCount++;
    }
    private void SpawnBoulder()
    {
        BoulderManager = Instantiate(Boulder, transform.position + new Vector3(0f, 1f, 0f), new Quaternion()) as GameObject;

        if (Colour != "" && Colour != null)
        {
            GridPlacer.UpdateAllMaterials(BoulderManager, "Colour (Instance)", ColourEventManager.ColourMaterials[Colour]);
        }
    }
示例#5
0
    private void PlaceObject(string name, int x, int y, int z, EDirection direction, string colour)
    {
        grid.CreateGridObject(name, new Vector3Int(x, y, z), direction, out tempObject);

        if (colour != "")
        {
            tempObject.GetComponentInChildren <IGridObject>().Colour = colour;
            GridPlacer.UpdateAllMaterials(tempObject, "Colour (Instance)", ColourEventManager.ColourMaterials[colour]);
        }
    }
    public void Dissapear()
    {
        if (killer)
        {
            return;
        }
        gameObject.name = "pumpkin";
        GridPlacer placer = new GridPlacer(GenerateWalls.coordinates);

        placer.PlaceDistanceAway(finder, ConvertVector3(player), transform, 5);
        GameObject.Instantiate(smoke, transform.position, transform.rotation);
        GameObject.Destroy(gameObject);
    }