void Start() { Application.targetFrameRate = 60; this.state = State.START; this.timer = 0; score = 0; this.moleManager = this.GetComponent <MoleManager> (); }
//時間を止める public void TimeStopButton() { StopTime = true; ReStartButton.SetActive(true); StopButton.SetActive(false); MoleManager moleManager = MolePrefab.GetComponent <MoleManager>(); BoxCollider component = this.gameObject.GetComponent <BoxCollider>(); Destroy(component); }
//モグラ生成 void EncountMole() { for (int i = 0; i < 1; i++) { Mole = Instantiate(MolePrefab); MoleManager moleManager = Mole.GetComponent <MoleManager>(); int r = Random.Range(0, positions.Length); moleManager.transform.position = positions[r]; } }
private void Awake() { if (PhotonNetwork.offlineMode) { if (instance == null) { instance = this; } else { Destroy(gameObject); } GameManager.Instance.onStartGame += RaiseMoles; bigMole = Instantiate(bigMolePrefab, moleSpawnPoint.position, Quaternion.identity).GetComponent <BigMole>(); for (int i = 0; i < dynamiteMolesAmount; i++) { GameObject go = Instantiate(dynamiteMolePrefab, moleSpawnPoint.position, Quaternion.identity); dynamiteMoles.Add(go.GetComponent <DynamiteMole>()); } } //Network spawning else { if (PhotonNetwork.isMasterClient) { if (instance == null) { instance = this; } else { Destroy(gameObject); } GameManager.Instance.onStartGame += RaiseMoles; //Spawn and set reference to the big mole bigMole = PhotonNetwork.Instantiate(bigMolePrefab.name, moleSpawnPoint.position, Quaternion.identity, 0).GetComponent <BigMole>(); //Spawn the dynamite moles and add them to the array for (int i = 0; i < dynamiteMolesAmount; i++) { GameObject go = PhotonNetwork.Instantiate(dynamiteMolePrefab.name, moleSpawnPoint.position, Quaternion.identity, 0); dynamiteMoles.Add(go.GetComponent <DynamiteMole>()); } } } if (bigMole != null) { bigMole.onBigMoleRetracted += RaiseMoles; } }
void Start() { Application.targetFrameRate = 60; this.state = State.START; this.timer = 0; this.anim = GameObject.Find("Canvas").GetComponent <Animator>(); this.moleManager = GameObject.Find("GameManager").GetComponent <MoleManager>(); this.remainingTIme = GameObject.Find("RemainingTime").GetComponent <Text>(); this.audio = GetComponent <AudioSource>(); }
// Use this for initialization void Start() { minSwipeDist = 50.0f; speed = 10f; shieldDuration = 0.5f; shieldRemainingDuration = 0; shieldCooldown = 3f; spellCooldown = 0.5f; spellRemainingCooldown = 0; isShielded = false; spellLaunched = false; spellPrefab = Resources.Load("Prefabs/Spell") as GameObject; mShield = Resources.Load("Materials/Shield") as Material; mNoShield = GetComponent <MeshRenderer>().material; gameManager = GameObject.Find("GameManager"); moleManager = GetComponent <MoleManager>();; }
void Start() { isTouching = false; /* retorna o objecto do tipo MoleManager (se existir) */ moleManager = FindObjectOfType <MoleManager>(); if (moleManager == null) { Debug.LogError("MOLE MANAGER IS NULL"); } /* cria um novo objecto do tipo InputManager */ inputManager = FindObjectOfType <InputManager>(); if (inputManager == null) { Debug.LogError("CANT FIND THE INPUT MANAGER"); } //devolve o componente EventManager que se encontra na hierarquia eventManager = FindObjectOfType <EventManager>().GetComponent <EventManager>(); }
private void updateGameOverPanel(MoleManager[] mm) { GameObject go = Instantiate(Resources.Load("Prefabs/GameOverPanel")) as GameObject; go.transform.parent = canvas.transform; go.GetComponent<RectTransform>().offsetMax = new Vector2(-20, -125); go.GetComponent<RectTransform>().offsetMin = new Vector2(20, 182); go.GetComponent<RectTransform>().localScale = new Vector3(1, 1, 1); if (mm.Length != 1) { GameObject.Find("GameOverText").GetComponent<Text>().text = "Time Over"; } float[] temps = new float[nbPlayers]; int[] playersId = new int[nbPlayers]; for (int i = 0; i < nbPlayers; i++) { playersId[i] = i; temps[i] = PlayerPrefs.GetFloat("timeAlive" + i); } for (int i = 0; i < mm.Length; i++) { temps[mm[i].PlayerID] = timeElapsed; } Array.Sort(temps, playersId); Array.Reverse(temps); Array.Reverse(playersId); for (int i = 0; i < nbPlayers; i++) { Text t = GameObject.Find("Mole" + i + "Text").GetComponent<Text>(); t.color = colors[playersId[i]]; if (i < mm.Length) t.text = "1. " + names[playersId[i]]; else t.text = (i + 1 - (mm.Length - 1)) + ". " + names[playersId[i]]; } for (int i = nbPlayers; i < 4; i++) { GameObject.Find("Mole" + i + "Text").SetActive(false); } GameObject.Find("QuitButton").GetComponent<Button>().onClick.AddListener(QuiButton); }
// Use this for initialization void Start() { moles = GameObject.Find("Moles"); t = moles.GetComponent <MoleManager>(); }
// Use this for initialization void Start() { minSwipeDist = 50.0f; speed = 10f; shieldDuration = 0.5f; shieldRemainingDuration = 0; shieldCooldown = 3f; spellCooldown = 0.5f; spellRemainingCooldown = 0; isShielded = false; spellLaunched = false; spellPrefab = Resources.Load("Prefabs/Spell") as GameObject; mShield = Resources.Load("Materials/Shield") as Material; mNoShield = GetComponent<MeshRenderer>().material; gameManager = GameObject.Find("GameManager"); moleManager = GetComponent<MoleManager>(); ; }