Quantum-Engineering/ModMachine.cs

33 lines
1.0 KiB
C#
Raw Normal View History

2020-09-13 02:45:50 -04:00
using UnityEngine;
public class ModMachine : BasicMachine
{
private Material material;
public string machineName;
2020-09-16 21:40:25 -05:00
//! Called by unity engine on start up to initialize variables.
2020-09-13 02:45:50 -04:00
public new void Start()
{
base.Start();
material = new Material(Shader.Find("Standard"));
}
2020-09-16 21:40:25 -05:00
//! Called once per frame by unity engine.
2020-09-13 02:45:50 -04:00
public new void Update()
{
base.Update();
2020-09-19 20:29:43 -05:00
if (!stateManager.Busy())
{
2020-09-19 20:29:43 -05:00
TextureDictionary textureDictionary = GameObject.Find("Player").GetComponent<TextureDictionary>();
if (textureDictionary.dictionary.ContainsKey(machineName))
{
material.mainTexture = GameObject.Find("Player").GetComponent<TextureDictionary>().dictionary[machineName];
}
GetComponent<Renderer>().material = material;
if (recipes == null)
{
recipes = GameObject.Find("Player").GetComponent<BuildController>().blockDictionary.GetMachineRecipes(machineName);
}
2020-09-13 02:45:50 -04:00
}
}
}