예제 #1
0
 private static void SetUsableMaterial(CustomUsable Usable, Material Material)
 {
     Material = new Material(Material);
     Usable.ImageRenderer.material = Material;
     Usable.ImageMaterial          = Material;
     Usable.OnImageMaterialSet();
 }
예제 #2
0
        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);
        }
예제 #3
0
        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));
        }
예제 #4
0
 public static Console CreateNew(GameObject HolderObject, CustomUsable Usable)
 {
     return(CreateNew(HolderObject, HolderObject.GetComponent <SpriteRenderer>(),
                      Usable));
 }