// Use this for initialization void Start() { ppp = GameDataManger.manager.gameController.ppp; tf = transform; rot = new Vector3(Random.Range(-randomRange, randomRange), Random.Range(-randomRange, randomRange), Random.Range(-randomRange, randomRange)); //mat = GetComponent<MeshRenderer> ().material; switch (type) { case Type.Beef: cReal = c1; break; case Type.Cheese: cReal = c2; break; case Type.Lettuce: cReal = c3; break; case Type.Cream: cReal = c4; break; } }
/*void Update() * { * SetBorders(); * }*/ void Start() { GameDataManger.manager.fadePanel = fadePanel; camTF = Camera.main.transform; camStartPos = camTF.position; levelNumber = GameDataManger.manager.currentLevel; GameDataManger.manager.FadeToBlack(false, null); ppp = GetComponent <PhysicParticlePool> (); UnPause(); GameDataManger.manager.ClearMessageQueue(); //Player initialization player = (Player)Instantiate(playerPrefab, playerAnimStartPos, Quaternion.Euler(playerAnimStartRot)); playerTf = player.transform; //playermodel/material setup if (!GameDataManger.manager.unlockData.modelUnlocks [GameDataManger.manager.settings.currentModel]) { GameDataManger.manager.settings.currentModel = 0; GameDataManger.manager.settings.SaveSettings(); } currentPlayerModel = GameDataManger.manager.assetManager.models[GameDataManger.manager.settings.currentModel]; if (currentPlayerModel == null) { currentPlayerModel = GameDataManger.manager.assetManager.models[0]; } Instantiate(currentPlayerModel, playerTf, false); if (!GameDataManger.manager.unlockData.matUnlocks [GameDataManger.manager.settings.currentMat]) { GameDataManger.manager.settings.currentMat = 0; GameDataManger.manager.settings.SaveSettings(); } currentPlayerMat = GameDataManger.manager.assetManager.mats[GameDataManger.manager.settings.currentMat]; if (currentPlayerMat != null) { MeshRenderer[] rends = playerTf.GetComponentsInChildren <MeshRenderer>(); foreach (MeshRenderer rend in rends) { rend.material = currentPlayerMat; } } //Custom model setups if (GameDataManger.manager.settings.currentMat == 5 && GameDataManger.manager.settings.currentModel == 5) { playerTf.GetComponentInChildren <ParticleSystem> (true).transform.parent.gameObject.SetActive(true); } player.GetComponent <Rigidbody> ().isKinematic = true; playerAnim = player.GetComponent <Animator> (); playerAnim.enabled = false; playerTf.position = playerAnimStartPos; playerTf.eulerAngles = playerAnimStartRot; playerTf.localScale = playerAnimStartScale; player.dustAnim = dustAnim; //player.dusterHolder = dustHolder; //player.duster = duster; player.dusterRing = dusterRing; player.gc = this; player.level = level; SpawnBackground(); StartCoroutine(CountDown()); SetBorders(); }