void OnCollisionEnter2D(Collision2D collision) { if (collision.transform.localScale.x < transform.localScale.x * eatScaleX) { Vector3 toScale = collision.transform.localScale * addScale; if (transform.localScale.x + toScale.x > maxScale) { transform.localScale = new Vector3(maxScale, maxScale, 1); } else { transform.DOScale(transform.localScale + toScale, 0.3f).SetEase(Ease.OutBack); } GameMgr.inst().musicControl.playSound(soundType.xiaohui); curSmalTime += 0.8f; Destroy(collision.gameObject); } else if (collision.transform.localScale.x > transform.localScale.x * eatedScaleX) { Time.timeScale = 0; gameOver = true; UIcontroller.getInst().dieType = 1; UIcontroller.getInst().gameOver(1); // Destroy(gameObject); } }
public void Pay(int id, System.Action <int> buyAction) { this.buyAction = buyAction; #if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR // ads if (id == 1) { if (isReadUnityOrAdmobAwardAds()) { showAdmobOrUnityRewardAds(buyAction); } else { UIcontroller.getInst().gameTip.showAtion(42); buyAction(0); } } // 100 diamond else { purchaser.DoIapPurchase(id, buyAction); } #else buyAction(1); #endif }
private void initialize() { Screen.sleepTimeout = SleepTimeout.NeverSleep; learners = new GameObject[numOfIndividuals]; nextGenes = new byte[numOfIndividuals][]; individuals = new List <Individual>(); Vector3 pos = defaultObject.transform.position; for (int i = 0; i < numOfIndividuals; i++) { learners[i] = (GameObject)Instantiate(defaultObject, pos, defaultObject.transform.rotation); pos.z += 5; } generationInterval = defaultObject.GetComponent <GAscript>().getGenerationInterval(); rankingScript = rankingContainer.GetComponent <CreateNodes>(); rankingScript.createRanking(numOfIndividuals); uiControllerScript = uiController.GetComponent <UIcontroller>(); setUI(); }
//被击毁与重生 public override void Die() { UIcontroller uic = GameObject.Find("UIcontroller").GetComponent <UIcontroller>(); for (int i = 1; i <= uic.shop.soilders.Length; i++) { if (uic.shop.soilders[i - 1] == gameObject) { uic.whichIsChanged = i; } } uic.Refresh(true); Destroy(gameObject); uic.activeSoilders--; globalChangeController.GlobalChange -= SelectChange; foreach (var type in teamStructureTypes) { for (int i = 1; i <= globalChangeController.teams.Length; i++) { if (type == globalChangeController.teams[i - 1].name) { globalChangeController.teams[i - 1].Num--; } } } }
// Use this for initialization void Start() { contineBtn.GetComponent <Button>().onClick.AddListener(() => { transform.parent.gameObject.SetActive(false); UIcontroller.getInst().gameContinueBySave(); //UIcontroller.getInst().gameHalfStart(); }); rankBtn.GetComponent <Button>().onClick.AddListener(() => { }); restartBtn.GetComponent <Button>().onClick.AddListener(() => { transform.parent.gameObject.SetActive(false); UIcontroller.getInst().endLessStart(); }); // halfBtn.GetComponent<Button>().onClick.AddListener(()=>{ // transform.parent.gameObject.SetActive(false); // UIcontroller.getInst().gameHalfStart(); // }); doStartAni(); }
void Start() { gc = GameObject.Find("Main Camera").GetComponent <GameController>(); player = GameObject.Find("Player"); uicontrol = GameObject.Find("Canvas").GetComponent <UIcontroller>(); na = this.GetComponent <NavMeshAgent>(); points = GameObject.FindGameObjectsWithTag("movepoint"); }
private void Setup() { bricks_pool = transform.Find("Bricks"); game_field = GameObject.Find("GameField").transform; ui_controller = FindObjectOfType <UIcontroller>(); PlayerPrefs.SetInt("Score", 0); }
// Use this for initialization void Start() { carretera = FindObjectOfType <MotorCarretera> (); Carro = FindObjectOfType <Coche> (); controladorUI = FindObjectOfType <UIcontroller> (); Tiempo_txt.text = "2:00"; Distancia_txt.text = "0"; Tiempo = 120; }
void Start() { gc = GameObject.Find("Main Camera").GetComponent <GameController>(); player = GameObject.Find("Player"); uicontrol = GameObject.Find("Canvas").GetComponent <UIcontroller>(); phone = GameObject.Find("Phone"); wsm = this.GetComponent <WangStateMachine>(); na = this.GetComponent <NavMeshAgent>(); }
// Start is called before the first frame update void Start() { uIcontroller = this.GetComponent <UIcontroller>(); buildingCounts[0] = 4; buildingCounts[1] = 2; buildingCounts[2] = 3; Cash = 1000; Food = 6; JobsCeiling = 10; }
public bool useDiamonds(int num) { if (diamondNum - num >= 0) { diamondNum -= num; PlayerPrefs.SetInt("diamondNum", diamondNum); UIcontroller.getInst().updateDiamondTxt(diamondNum); return(true); } return(false); }
private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
public void reBuyClick() { UIcontroller.getInst().showBlockPanel(true, 18); PlatformHelper.inst().purchaser.RestorePurchases((int state) => { if (state == 1) { adsSuccessBack = true; curType = 0; } UIcontroller.getInst().showBlockPanel(false, 18); }); }
//This method create an instance of the script private void Awake() { if (instance == null) { instance = this; } else if (instance != null) { Debug.Log("Instance already exists, destroying object!"); Destroy(this); } }
private void Awake() { if (UIcontroller.instanse != null) { Destroy(gameObject); return; } UIcontroller.instanse = this; if (Time.timeScale == 0) { Time.timeScale = 1; } }
private void Awake() { GameObject cinemachine = GameObject.FindGameObjectWithTag("Cinemachine"); cinemachine.GetComponent <CinemachineVirtualCamera>().Follow = this.anchor.transform; UIcontroller uiController = GameObject.FindGameObjectsWithTag("UIIcon")[0].GetComponent <UIcontroller>(); uiController.ChangeChara(this); if (!gameoveranimator) { gameoveranimator = GameObject.FindGameObjectsWithTag("UIIcon")[1].GetComponent <Animator>(); } }
// Start is called before the first frame update void Start() { _uicontroller = GameObject.Find("UIcontrollerComponent").GetComponent <UIcontroller>(); _heldItems = new List <ParametrizedItem>(); _itemBoxImage1 = GameObject.Find("ItemBoxImage1").GetComponent <Image>(); _itemBoxImage2 = GameObject.Find("ItemBoxImage2").GetComponent <Image>(); _itemBoxImage3 = GameObject.Find("ItemBoxImage3").GetComponent <Image>(); _itemBoxImage4 = GameObject.Find("ItemBoxImage4").GetComponent <Image>(); _itemBoxImage5 = GameObject.Find("ItemBoxImage5").GetComponent <Image>(); _itemBoxImage6 = GameObject.Find("ItemBoxImage6").GetComponent <Image>(); _shouldGetKufr = true; HandleItemChange(); }
//预制加载的位置 // Use this for initialization void Start() { record = new ScoreRecorder(); record.scoreText = scoreText; UI = new UIcontroller(); UI.centerText = centerText; fac = Singleton <Factory> .Instance; Subject publisher = Publisher.getInstance(); publisher.add(this); // 添加事件 LoadResources(); }
// Model types /// <summary> /// /// blank tile /// /// strucural tile (cant be used) /// /// food: /// sheep tile /// farm tile /// /// Energy: /// windmill tile /// loop reactor (use placeholder) /// /// atmosphere: /// air scrubber (use placeholder) /// tree farm tile /// /// control: /// castle tile /// flight tower (use placeholder) /// /// /// </summary> private void Start() { possibleobjs = new Dictionary <int, GameObject>(); possibleobjs.Add(1, GameObject.Find("SHEEP")); possibleobjs.Add(2, GameObject.Find("FARM")); possibleobjs.Add(3, GameObject.Find("WINDMILL")); possibleobjs.Add(4, GameObject.Find("LOOPREACTOR")); possibleobjs.Add(5, GameObject.Find("SCRUBBER")); possibleobjs.Add(6, GameObject.Find("TREEFARM")); possibleobjs.Add(7, GameObject.Find("CASTLE")); possibleobjs.Add(8, GameObject.Find("TOWER")); possibleobjcount = possibleobjs.Count; rendy = GetComponent <Renderer>(); uic = GameObject.Find("UIController").GetComponent <UIcontroller>(); startcolor = rendy.material.color; }
public void doubleClick() { if (PlatformHelper.inst().isReadUnityOrAdmobAwardAds()) { PlatformHelper.inst().showAdmobOrUnityRewardAds((int state) => { if (state == 1) { adsSuccessBack = true; } }); } else { UIcontroller.getInst().gameTip.showAtion(42); } }
void Start() { mUIcontroller = GetComponent <UIcontroller>(); mAudioM = DominoAudioManger.Instance; AllDominos = new GameObject(); AllDominos.name = "AllDominos"; ListDominos = new List <DominosController>(); CurrentLvl = Instantiate(Level_heart); if (CurrentLvl != null) { mStarter = CurrentLvl.GetComponentInChildren <Startdomino>(); } MissionCompleteNum = 0; mDonimoTotalNum = 0; IsStartPush = false; }
public void buyBtnClick(int type) { if (type != 1) { UIcontroller.getInst().showBlockPanel(true, 18); } PlatformHelper.inst().Pay(type, (int state) => { UIcontroller.getInst().showBlockPanel(false); if (state == 1) { adsSuccessBack = true; curType = type; } else { Debug.Log(">>>>>>>>>>>>>>>>pay fail"); } }); }
double[] GetInput() { double[] input = new double[inputSize]; Vector3 dir = target.position - transform.position; input[0] = dir.magnitude * 0.2f; input[1] = Vector2.SignedAngle(transform.up, dir) / 180; dir = new Vector3(UIcontroller.Round20(transform.position.x), UIcontroller.Round20(transform.position.y), 0) - transform.position; input[2] = dir.magnitude * 0.2f; input[3] = Vector2.SignedAngle(transform.up, dir) / 180; vel = target.GetComponent <Rigidbody2D>().velocity; input[4] = Vector2.Dot(vel, dir) * 0.2f; input[5] = Vector2.Dot(vel, Vector2.Perpendicular(dir)) * 0.2f; input[6] = move.lastShoot; return(input); }
// Update is called once per frame void Update() { if (!(GameMgr.inst().GetGameState() == gameState.canShoot || GameMgr.inst().GetGameState() == gameState.ballRuning)) { return; } if (Input.GetMouseButton(0) || Input.GetMouseButtonUp(0)) { if (UIcontroller.getInst().IsPointerOverUIObject(Input.mousePosition) && !indrag) { // Debug.Log(">>>>>>>>>>>>>>>>>click ui3"); return; } } if (GameMgr.inst().canAddSpeed&& Input.GetMouseButtonUp(0)) { Time.timeScale = timeScale; } if (GameMgr.inst().GetGameState() != gameState.canShoot) { return; } if (Input.GetMouseButton(0)) { indrag = true; } else if (Input.GetMouseButtonUp(0)) { indrag = false; } }
public void GameStart() { UIcontroller = UIcontrollerObj.GetComponent <UIcontroller>(); gridSize = UIcontroller.GetComponent <UIcontroller>().sizeFromInput; cubeSize = (1000f) / gridSize; // sizeMultiplayer = cubeSize / 100f; gridFitMultiplayer = sizeMultiplayer; //2küp arası 100 cols = gridSize + 2; //+1 çünkü çerçeve oyun alanına girmiyor rows = gridSize + 2; grid = new GameObject[rows, cols]; GenerateGrid(); CamFocus(); }
// Use this for initialization private void Awake() { _uiCotl = this; }
public void Awake() { instance = this; }
// Update is called once per frame void Update() { //if (Input.GetMouseButton(0) || Input.GetMouseButtonUp(0)) //{ // if (UIcontroller.getInst().IsPointerOverUIObject(Input.mousePosition) && !indrag) // { // // Debug.Log(">>>>>>>>>>>>>>>>>click ui3"); // return; // } //} if (GameMgr.inst().canAddSpeed&& Input.GetMouseButtonUp(0)) { } if (gameOver || GameMgr.inst().GetGameState() != gameState.ballRuning) { return; } if (Input.GetMouseButton(0)) { indrag = true; Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); // Debug.Log(">>>>>>>>>>>>>>GetMouseButton(0)"); if (mousePos.x < lelfX) { mousePos.x = lelfX; } if (mousePos.x > rightX) { mousePos.x = rightX; } if (mousePos.y < downY) { mousePos.y = downY; } if (mousePos.y > upY) { mousePos.y = upY; } transform.position = new Vector3(mousePos.x, mousePos.y + 1.2f, transform.position.z); } else if (Input.GetMouseButtonUp(0)) { indrag = false; } curSmalTime -= Time.deltaTime; if (curSmalTime <= 0) { curSmalTime = smalTimeGap; Vector3 toScale = transform.localScale * smallSpeed; transform.DOScale(toScale, 0.3f).SetEase(Ease.InOutBack); if (transform.localScale.x < dieScale) { Time.timeScale = 0; UIcontroller.getInst().dieType = 2; gameOver = true; UIcontroller.getInst().gameOver(1); } } }
void Start() { dragbool = false; script = canvas.GetComponent <UIcontroller> (); }
public UIcontroller getUIComponent() { UImanager = new UIcontroller(); return(UImanager); }