void SpawnZombie() { PlayerCharacter player = FindObjectOfType <PlayerCharacter>(); if (player) { for (int i = 0; i < numPerSpawn; i++) { float maxX = player.transform.position.x + spawnRange; float minX = player.transform.position.x - spawnRange; float maxZ = player.transform.position.z + spawnRange; float minZ = player.transform.position.z - spawnRange; float x = Random.Range(minX, maxX); float z = Random.Range(minZ, maxZ); float y = 4.0f; Instantiate(zombie, new Vector3(x, y, z), Quaternion.identity); } } else { SphereController sphere = FindObjectOfType <SphereController>(); for (int i = 0; i < numPerSpawn; i++) { float maxX = sphere.transform.position.x + spawnRange; float minX = sphere.transform.position.x - spawnRange; float maxZ = sphere.transform.position.z + spawnRange; float minZ = sphere.transform.position.z - spawnRange; float x = Random.Range(minX, maxX); float z = Random.Range(minZ, maxZ); float y = 4.0f; Instantiate(zombie, new Vector3(x, y, z), Quaternion.identity); } } }
public override IEnumerator ChangeColor() { yield return new WaitForEndOfFrame(); if (SphereController.GetGroundColor().Equals(Color.green)) SphereController.SetState(new Green(SphereController)); }
private void OnTriggerExit(Collider other) { Rigidbody rb = other.gameObject.GetComponent <Rigidbody>(); rb.constraints = RigidbodyConstraints.None; SphereController sphereController = other.gameObject.GetComponent <SphereController>(); sphereController.onPole = false; gameController.number_of_plays += 1; if (pole == 1) { gameController.stack1.RemoveAt(gameController.stack1.Count - 1); gameController.size1 -= 1; } if (pole == 2) { gameController.stack2.RemoveAt(gameController.stack2.Count - 1); gameController.size2 -= 1; } if (pole == 3) { gameController.stack3.RemoveAt(gameController.stack3.Count - 1); gameController.size3 -= 1; } }
// Should change transform.position to current world position of mouth // Use this for initialization void Awake() { if (GameObject.Find ("FoodTracker")) GameObject.Find ("FoodTracker").name = "FoodTracker" + Application.loadedLevelName; trackerRef = GameObject.Find ("FoodTracker" + Application.loadedLevelName).GetComponent<FoodTracker> (); controlRef = GetComponent<SphereController> (); }
private void ActivateSphere(SphereController s) { if (s) { s.Activate(); } }
void Start() { BonusSwitch = true; SphereScript = GameObject.Find("Sphere").GetComponent <SphereController>(); Audio = GetComponents <AudioSource>(); MusicStart(); }
void Update() { // 経過時間をカウントします time += Time.deltaTime; if (time > 1) { // 1秒間に1回球を生成します // 表示上の左右(-5〜5)と、落とす高さ(10〜30)をランダムに決定します Vector3 position = new Vector3(Random.Range(-5, 5), Random.Range(10, 30), 10); GameObject obj = GameObject.Instantiate(sphere, position, Quaternion.identity); if (Random.value < 0.15F) { // 生成した球のうち15%の割合で、3回クリックしなければ // 爆発しないようにします SphereController s = obj.GetComponent <SphereController>(); s.count = 3; MeshRenderer mr = obj.GetComponent <MeshRenderer>(); mr.material.color = Color.red; } // 経過時間を0に戻します time = 0; } }
// Resets game to starting state private void ResetGame() { GameObject[] gos = GameObject.FindGameObjectsWithTag("Interactive"); foreach (var go in gos) { GameObject.Destroy(go); } GameObject sphereObject = Instantiate(sphere, new Vector3(0, 0, 0), Quaternion.identity); enemy.GetComponent <EnemyController>().sphere = sphereObject; Instantiate(enemy, new Vector3(-15, 0, 0), Quaternion.Euler(0, 180, 0)); if (gameState == GameState.DEMO) { Instantiate(enemy, new Vector3(15, 0, 0), Quaternion.Euler(0, 180, 0)); } else { Instantiate(player, new Vector3(15, 0, 0), Quaternion.Euler(0, 180, 0)); } SphereController sc = sphereObject.GetComponent <SphereController>(); sc.StartMoving(); }
void Awake() { Instance = this; instanceList.Add(gameObject.name, this); _sphereController = FindObjectOfType <SphereController>(); _sphereController.InitializeCameraShaker(this); }
void Awake() { Assert.IsNotNull(textureClip); sc = GetComponent <SphereController>(); chuck = GetComponent <ChuckSubInstance>(); source = GetComponent <AudioSource>(); collideSource = transform.Find("CollisionAudioSource").GetComponent <AudioSource>(); }
void Start() { hornTimer = new Timer(0); sphereController = GameObject.Find("Enemy").GetComponent <SphereController>(); audioSource = GetComponents <AudioSource>(); bonusSwitch = true; MusicStart(); }
public override IEnumerator ChangeColor() { yield return(new WaitForEndOfFrame()); if (SphereController.GetGroundColor().Equals(Color.red)) { SphereController.SetState(new Red(SphereController)); } }
//Sphereを登録…出来るのかな? /// <param name="newSphere">New Sphere.</param> public void RegisterSphere(SphereController newSphere) { //たぶん関数呼び出されるごとに新しくSphere登録される mPlayerListSphere.Add(newSphere); foreach (SphereController sphere in mPlayerListSphere) { sphere.gameObject.SetActive(PlacenoteMultiplayerManager.Instance.IsPlaying); } }
public void ChangeActiveSphereTo(SphereController newActiveSphere) { DeactivateActiveSphere(); ActivateSphere(newActiveSphere); CancelInvoke("ChangeActiveSphere"); float timeUntilChangeActive = Random.Range(minTimeUntilChangeActive, maxTimeUntilChangeActive); Invoke("ChangeActiveSphere", timeUntilChangeActive); }
private void OnValidate() { if (mesh == null) { mesh = GetComponent <MeshRenderer>(); } if (sphere == null) { sphere = GetComponentInParent <SphereController>(); } }
private void OnTriggerStay(Collider other) { Rigidbody rb = other.gameObject.GetComponent <Rigidbody>(); rb.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezePositionX; SphereController sphereController = other.gameObject.GetComponent <SphereController>(); if (!sphereController.isHolding) { sphereController.onPole = true; rb.useGravity = true; } other.gameObject.transform.position = new Vector3(gameObject.transform.position.x, other.gameObject.transform.position.y, gameObject.transform.position.z); }
void OnTriggerEnter(Collider collider) { Debug.Log("Collision"); SphereController cubeController = collider.gameObject.GetComponent <SphereController> (); bool cubeForward = cubeController.forward; cubeForward = !cubeForward; cubeController.forward = cubeForward; cubeController.recalcularB(); }
// Use this for initialization void Start() { InputManager.Setup(); Controller = GetComponent <SphereController>(); JumpController = GetComponent <SphereControllerJump>(); for (int i = 0; i < InputManager.Devices.Count; i++) { switch (i) { case 0: Player1 = InputManager.Devices[0]; break; } } }
public void addSphere() { if (appear_balloon < max_balloon) { int total_count = max_balloon - appear_balloon; for (int i = 0; i < total_count; i++) { int index = random.Next(spheres_dis.Count); GameObject sphere = spheres_dis[index]; spheres_dis.RemoveAt(index); spheres_app.Add(sphere); appear_balloon++; SphereController controller = sphere.gameObject.GetComponent <SphereController>(); controller.InitSphere(); } } }
void OnTriggerEnter(Collider other) { // 画面下のCubeに球がぶつかったら呼び出されます MeshRenderer meshRenderer = other.gameObject.GetComponent <MeshRenderer>(); SphereController sphere = other.gameObject.GetComponent <SphereController>(); if (meshRenderer.enabled && sphere.visible) { // カメラに表示された球が、表示されたまま(クリックされずに) // 画面下まで落ちてしまった場合の処理をおこないます。 // 現在の実装では、ミスした数をカウントするだけで何もしません ++miss; Debug.Log(miss); } // 球を削除します GameObject.Destroy(other.gameObject); }
private void GetCloseCallScore() { foreach (GameObject sphere in GameObject.FindGameObjectsWithTag("Enemy")) { if (!AllSpheres.Contains(sphere)) { AllSpheres.Add(sphere); } } int tempTotal = 0; foreach (GameObject sphere in AllSpheres) { SphereController eachSphereScript = sphere.GetComponent <SphereController>(); tempTotal += eachSphereScript.CloseCall; } GrandTotalScore = tempTotal; }
private void OnTriggerEnter(Collider other) { SphereController sphere = other.gameObject.GetComponent <SphereController>(); if (pole == 1) { gameController.stack1.Add(sphere.ballNumber); gameController.size1 += 1; } if (pole == 2) { gameController.stack2.Add(sphere.ballNumber); gameController.size2 += 1; } if (pole == 3) { gameController.stack3.Add(sphere.ballNumber); gameController.size3 += 1; } }
void addSphere(Sphere s) { GameObject sphere = (GameObject)Instantiate(base_sphere, new Vector3(s.x, s.y, s.z), Quaternion.identity); //sphere.active = false; // Code initialization SphereController sc = sphere.GetComponent <SphereController> (); sc.target_time = s.t; sc.main = this; // Color initialization int color_index = Random.Range(0, colors.Length - 1); string color = colors[color_index]; sphere.GetComponent <MeshRenderer>().material = Resources.Load("Materials/" + color + "SphereMaterial", typeof(Material)) as Material; sphere.transform.Find("Ring").gameObject.GetComponent <MeshRenderer>().material = Resources.Load("Materials/" + color + "RingMaterial", typeof(Material)) as Material; sphere.GetComponent <Light> ().color = colorc [color_index]; //sphere.active = true; }
void Update() { int floorMask = LayerMask.GetMask("Floor"); // A layer mask so that a ray can be cast just at game objects on the floor layer. float camRayLength = 100f; // The length of the ray from the camera into the scene. RaycastHit floorHit; // Create a RaycastHit variable to store information about what was hit by the ray. Ray camRay = Camera.main.ScreenPointToRay(Input.mousePosition); // Create a ray from the mouse cursor on screen in the direction of the camera. // Perform the ray cast and if it hits something on the floor layer... if (Physics.Raycast(camRay, out floorHit, camRayLength, floorMask)) { if (Input.GetKeyUp(KeyCode.S)) { Vector3 position3 = new Vector3(floorHit.point.x, height, floorHit.point.z); GameObject playerGO = Instantiate(sphere, position3, Quaternion.identity) as GameObject; playerRB = playerGO.GetComponent <Rigidbody>(); playerSC = playerGO.GetComponent <SphereController>(); } else if (Input.GetMouseButtonUp(1)) { playerSC.findPath(floorHit.point.x, floorHit.point.z); } } }
private void GetCloseCallScore() { int previousGrandTotalScore = grandTotalScore; foreach (GameObject enemy in GameObject.FindGameObjectsWithTag("Enemy")) { if (!allEnemys.Contains(enemy)) { allEnemys.Add(enemy); } } float tempTotal = 0; foreach (GameObject enemy in allEnemys) { SphereController eachSphereScript = enemy.GetComponent <SphereController>(); tempTotal += eachSphereScript.closeCall; } grandTotalScore = (int)tempTotal; isScoring = ScoringCheck(previousGrandTotalScore, grandTotalScore); }
void Start() { // sphereObject = GameObject.Find("Sphere"); print("Object is:" + sphereObject); sc = sphereObject.GetComponent <SphereController>(); }
// Use this for initialization void Start() { Sphere = GetComponent <SphereController>(); }
public Red(SphereController sphereController) : base(sphereController) { }
public override IEnumerator Start() { SphereController.SetColor(Color.red); yield break; }
// Use this for initialization void Start() { labelStyle = new GUIStyle(); labelStyle.alignment = TextAnchor.MiddleRight; labelStyle.fontSize = Screen.height / 25; labelStyle.normal.textColor = new Color (1.0f, 1.0f, 1.0f, 1.0f); //white sphereController = (SphereController) FindObjectOfType (typeof(SphereController)); rayController = (RayController) FindObjectOfType (typeof(RayController)); sphereCount = 0; lastTime = 0; Directory.CreateDirectory ("Data"); createNewLogFile(); }
public SmashState(SphereController controller) : base(controller.gameObject) { _controller = controller; }
private void SpawnSphere() { currentSphere = Instantiate(sphere.gameObject, GenerateRandomTopBoundPosition(), sphere.transform.rotation).GetComponent <SphereController>(); spawningCounter++; }