Example #1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        EditorGUILayout.HelpBox("Specify how many textures your script should affect. Then you specify for each texture the plant strength that it will generate (Default: 0 {no plants}).", MessageType.Info);
        PlantPlacement pp = (PlantPlacement)target;

        if (GUILayout.Button("Run plant generator"))
        {
            pp.RunPlantGenerator();
        }
    }
    /// <summary>
    /// Places a new Plant onto the map, using supplied PlantPlacement info,
    /// and the _plants objects
    /// </summary>
    /// <param name="placement">The Plant placement information</param>
    public void Place(PlantPlacement placement)
    {
        _placements.Add(placement.Position, placement);

        var newPlant = Instantiate(
            _plants[placement.PlantType],
            new Vector2(placement.Position.X * 3, placement.Position.Y * 3),
            Quaternion.identity
            ).GetComponent <PlantGrowth>();

        newPlant.SetPlantStartTime(placement.TimeToComplete);
    }
Example #3
0
 public PlacePlantState(StateMachine source) : base(source)
 {
     gameManager    = source as GameManager;
     plantPlacement = source.GetComponent <PlantPlacement>();
 }