private static void SetUsableMaterial(CustomUsable Usable, Material Material) { Material = new Material(Material); Usable.ImageRenderer.material = Material; Usable.ImageMaterial = Material; Usable.OnImageMaterialSet(); }
private static Console CreateNew(GameObject HolderObject, SpriteRenderer Renderer, CustomUsable Usable) { var Collider = HolderObject.AddComponent <CircleCollider2D>(); Collider.radius = Usable.UsableDistance; Collider.isTrigger = true; var Console = HolderObject.AddComponent <Console>(); Usable.Console = Console; Usable.ImageRenderer = Renderer; if (ConsoleMaterialPatch.ImageMaterial != null) { SetUsableMaterial(Usable, ConsoleMaterialPatch.ImageMaterial); } Console.Image = Renderer; Map.Add(Usable.ConsoleId, Usable); Console.ConsoleId = Usable.ConsoleId; return(Console); }
public static Console CreateNew(Sprite Sprite, Vector3 Position, CustomUsable Usable) { var HolderObject = new GameObject(); HolderObject.transform.position = Position; var Renderer = HolderObject.AddComponent <SpriteRenderer>(); Renderer.sprite = Sprite; return(CreateNew(HolderObject, Renderer, Usable)); }
public static Console CreateNew(GameObject HolderObject, CustomUsable Usable) { return(CreateNew(HolderObject, HolderObject.GetComponent <SpriteRenderer>(), Usable)); }