private MarbleManager m; // A pointer to the manager (not needed here, but potentially useful in general). // The Start function is good for initializing objects, but doesn't allow you to pass in parameters. // For any initialization that requires input, you'll probably want your own init function. public void init(int gemType, MarbleManager m) { this.gemType = gemType; this.m = m; var modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); // Create a quad object for holding the gem texture. model = modelObject.AddComponent <GemModel>(); //Rigidbody gemBody = gameObject.AddComponent<Rigidbody>(); model.init(gemType, this); }
// Use this for initialization public void init(int dir, Tile start, MarbleManager m) { manager = m; speed = 1; curTile = start; GameObject modelObject; modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); model = modelObject.AddComponent <BombModel>(); model.init(this); direction = dir; targetTile = start; }
public void init(int dir, Tile start, MarbleManager manager, int health) { GameObject modelObject; this.manager = manager; curTile = start; this.health = health; modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); model = modelObject.AddComponent <MarbleModel>(); model.init(this); direction = dir; rotateMarble(dir * -90); targetTile = start; speed = 1; offBoard = false; turboTime = 0; }
void InitializeBoardValues() { initialFreeMovesValue = Serialization.boardConfig.GENERAL_FreeMovesValue; initialMultiplierValue = Serialization.boardConfig.GENERAL_MultiplierValue; initialGoalPanelMultiplier1Value = Serialization.boardConfig.GENERAL_GoalPanelMultiplier1Value; initialGoalPanelMultiplier2Value = Serialization.boardConfig.GENERAL_GoalPanelMultiplier2Value; initialManaValue = Serialization.boardConfig.GENERAL_ManaValue; initialTimerValue = Serialization.boardConfig.GENERAL_TimerValue; initialScoreValue = Serialization.boardConfig.GENERAL_ScoreValue; initialGoalPanelPointsValue = Serialization.boardConfig.GENERAL_GoalPanelPointsValue; numGates = Serialization.boardConfig.GENERAL_NumGates; numGoalPanelMultipliers = Serialization.boardConfig.GENERAL_NumGoalPanelMultipliers; mainMenu = GameObject.Find("Main_Menu"); marbleManager = GameObject.Find("MarbleManager"); utils = mainMenu.GetComponent <Utils>(); mmComponent = marbleManager.GetComponent <MarbleManager> (); }
public void init(int type, int boardx, int boardy) { //determine the type, make the correct quad, add quad to currentMarbles, build the dictionary map whatever thing for outward direction this.type = type; source = GetComponent <AudioSource>(); getOutward = new Dictionary <int, int>(); boardPosition = new Vector2(boardx, boardy); GameObject modelObject; parent = GameObject.Find("MarbleManager").GetComponent <MarbleManager>();; currentMarbles = new List <Marble>(); hasGem = false; if (type == 0) { modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); // Create a quad object for holding the gem texture. out1 = 7; out2 = out1; } else if (type == 2) { modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); out1 = -1; out2 = out1; } else { modelObject = new GameObject(); out1 = 1; out2 = 2; //make a new child with two quads and a script for controlling the quads } //tileModel.init(type, position, owner) populateOutward(); model = modelObject.AddComponent <TileModel>(); model.init(type, this); }