public static InputTask SoftObjectFactory(SoftObjectType type, int amount) { return(new InputTask(InputMode.Single, (cells, selected) => { foreach (Cell cell in cells) { SoftObject softObject = new SoftObject(type, amount); cell.World.SpawnSoftObject(softObject, cell, softObject.Count); } }, null)); }
private void AddSoundsForCollisions(SoftObject softObject) { softObject.OnInitializeCompleted = () => { foreach (var joint in softObject.Joints) { var jointSoundHelper = joint.GameObject.AddComponent <SoftObjectSoundHelper>(); jointSoundHelper.InputManager = this; jointSoundHelper.Rigidbody2D = joint.Rigidbody2D; } }; }
protected override void CompleteJob(Pawn worker) { if (!(cell.Structure is Plant)) { throw new InvalidCastException(); } Plant target = (Plant)cell.Structure; SoftObject harvest = target.Harvest; if (harvest == null) { Console.WriteLine("Attempted to harvest plant with no harvest!"); return; } cell.World.SpawnSoftObject(harvest, cell, harvest.Count); cell.Structure = null; }