//! This class contains all functions called by the input manager. public ActionManager(PlayerController playerController) { this.playerController = playerController; hotbar = playerController.gameObject.GetComponent <HotBar>(); meshManager = playerController.gameManager.meshManager; }
//! Called by unity engine on start up to initialize variables. public void Start() { // Get a reference to the player. player = GameObject.Find("Player").GetComponent <PlayerController>(); // Get a reference to the rocket. rocketScript = rocketObject.GetComponent <Rocket>(); // Initiate meteor shower location list. meteorShowerLocationList = new List <Vector3>(); // Create the hazard manager. hazardManager = new HazardManager(this); // Create the combined mesh manager. meshManager = new CombinedMeshManager(this); // Create an object list to hold the player's most recently built objects for the 'undo' function. undoBlocks = new List <Block>(); // Create mod block name list. modBlockNames = new List <string>(); modBlockHolders = new List <GameObject[]>(); // Load chunk size setting. int cs = PlayerPrefs.GetInt("chunkSize"); chunkSize = cs > 0 ? cs : 40; // Load chunk size setting. float simSpeed = PlayerPrefs.GetFloat("simulationSpeed"); simulationSpeed = simSpeed > 0 ? simSpeed : 0.02f; // Create initial iron block holder for mesh manager. GameObject ironInit = Instantiate(ironHolder, transform.position, transform.rotation); ironInit.transform.parent = builtObjects.transform; ironInit.GetComponent <MeshPainter>().ID = 0; ironInit.SetActive(false); ironHolders = new GameObject[] { ironInit }; // Create initial iron block holder for mesh manager. GameObject glassInit = Instantiate(glassHolder, transform.position, transform.rotation); glassInit.transform.parent = builtObjects.transform; glassInit.GetComponent <MeshPainter>().ID = 0; glassInit.SetActive(false); glassHolders = new GameObject[] { glassInit }; // Create initial iron block holder for mesh manager. GameObject steelInit = Instantiate(steelHolder, transform.position, transform.rotation); steelInit.transform.parent = builtObjects.transform; steelInit.GetComponent <MeshPainter>().ID = 0; steelInit.SetActive(false); steelHolders = new GameObject[] { steelInit }; // Create initial iron block holder for mesh manager. GameObject brickInit = Instantiate(brickHolder, transform.position, transform.rotation); brickInit.transform.parent = builtObjects.transform; brickInit.GetComponent <MeshPainter>().ID = 0; brickInit.SetActive(false); brickHolders = new GameObject[] { brickInit }; }