コード例 #1
0
    //External calls used by the other developers, I include may overloads for ease of use.

    /// <summary>
    /// Creates a random monster at random location
    /// </summary>
    public Monster CreateMonster()
    {
        string  monsterName = GV.GetRandomElemFromArr <string>(monsterNames);
        Vector2 location    = GV.GetRandomSpotInMap();

        return(CreateMonster(monsterName, location, Ingredient.RandomIngredient()));
    }
コード例 #2
0
    public void Initialize()
    {
        vrCam = GameObject.FindObjectOfType <Cinemachine.CinemachineVirtualCamera>();
        Vector2 playerpos = GV.GetRandomSpotInMap();

        SpawnPlayerAtLoc(playerpos);
        SetupCauldron(playerpos);
    }
コード例 #3
0
ファイル: Monolith.cs プロジェクト: brosseaualex/GoupSoup
    public static Monolith SpawnRandomMonolith()
    {
        GameObject monoObj = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/Monolith/Monolith"));
        Monolith   toRet   = monoObj.GetComponent <Monolith>();

        toRet.Initialize();
        monoObj.transform.position = GV.GetRandomSpotInMap();
        return(toRet);
    }
コード例 #4
0
    private Vector2 GetValidPlantLocation(Vector2 plantSize)
    {
        int attempts = 0;

        while (attempts < 100)
        {
            Vector2 randPlace = GV.GetRandomSpotInMap();
            randPlace = new Vector2((int)randPlace.x, (int)randPlace.y); //making the map more like a grid
            RaycastHit2D rh = Physics2D.BoxCast(randPlace, plantSize, 0, new Vector2(), 0, plantPlacementLayerCheck);
            if (!rh)
            {
                return(randPlace);
            }
            attempts++;
        }
        Debug.Log("No place found for plant, returning null");
        return(new Vector2(-1, -1));
    }
コード例 #5
0
    /// <summary>
    /// Creates named monster at random location
    /// </summary>
    public Monster CreateMonster(string monsterName, Ingredient ingr)
    {
        Vector2 location = GV.GetRandomSpotInMap();

        return(CreateMonster(monsterName, location, ingr));
    }
コード例 #6
0
 public void PlayerDied()
 {
     SpawnPlayerAtLoc(GV.GetRandomSpotInMap());
 }