public static void DrawLines() { if (!DrawingLines) { return; } RemoveLines(); for (int i = 1; i < dotPoints.Count; i++) { Vector3 startPoint = dotPoints[i - 1]; Vector3 endPoint = dotPoints[i]; var clone = Instantiate(instance.linePrefab, instance.lineParent); var line = clone.GetComponent <Line>(); Vector3 start = Cam.ScreenToWorldPoint(startPoint); Vector3 end = Cam.ScreenToWorldPoint(endPoint); line.Apply(start, end); lines.Add(line); } }
public e_EnemyAI[] GetEnemiesOnScreen(float maxRange, LayerMask whatIsEnemy) { List <Collider> colls = new List <Collider>(Physics.OverlapSphere(Body.position, maxRange, whatIsEnemy)); Vector2 screenPos; for (int i = colls.Count - 1; i >= 0; i--) { if (Cam_t.InverseTransformVector(colls[i].transform.position - Cam_t.position).z < 0 || Physics.Raycast(Cam_t.position, (colls[i].transform.position - Cam_t.position), (colls[i].transform.position - Cam_t.position).magnitude, Game_NG.GroundLayerMask)) { colls.Remove(colls[i]); } else { screenPos = Cam.WorldToScreenPoint(colls[i].transform.position); if (screenPos.x < -20f || screenPos.x > Screen.width + 20f) { colls.Remove(colls[i]); } else if (screenPos.y < -20f || screenPos.y > Screen.height + 20f) { colls.Remove(colls[i]); } } } List <e_EnemyAI> enemies = new List <e_EnemyAI>(); for (int i = 0; i < colls.Count; i++) { enemies.Add(colls[i].GetComponentInParent <e_EnemyAI>()); } return(enemies.ToArray()); }
protected void ChangeEnemyLocked(bool right) { List <e_EnemyAI> enemies = new List <e_EnemyAI>(GetEnemiesOnScreen(LockRange, AC.whatIsEnemy)); List <e_EnemyAI> sortedEnemies = new List <e_EnemyAI>(); while (enemies.Count > 0) { float distFromleft = Mathf.Infinity; e_EnemyAI nearest = null; for (int i = 0; i < enemies.Count; i++) { float dist; if ((dist = Cam.WorldToScreenPoint(enemies[i].Body.position).x) < distFromleft) { nearest = enemies[i]; distFromleft = dist; } } sortedEnemies.Add(nearest); enemies.Remove(nearest); } int index = sortedEnemies.IndexOf(EnemyLocked); index = (int)Utilities.AddWithLimit(index, right ? 1 : -1, 0, sortedEnemies.Count - 1, false); EnemyLocked = sortedEnemies[index]; }
void Awake() { filter = GetComponent<MeshFilter>(); camera = GetComponentInParent<Cam>(); mesh = new Mesh(); mesh.name = "view mesh"; filter.mesh = mesh; }
public void Start() { effectGO = GameObject.Find("Effects"); if (effectGO == null) { effectGO = new GameObject("Effects"); } animator = GetComponent <Animator>(); movementController = GetComponent <CharacterMovementController>(); camerascript = GameObject.FindObjectOfType <Cam>(); idleState = new IdleState(); preJumpIdleState = new PreJumpIdleState(); jumpStartIdleState = new JumpStartIdleState(); preJumpRunningState = new PreJumpRunningState(); jumpStartRunningState = new JumpStartRunningState(); fallingState = new FallingState(); landIdleState = new LandIdleState(); landRunningState = new LandRunningState(); landRollingState = new LandRollingState(); runningState = new RunningState(); stoppingState = new StoppingState(); duckingState = new DuckingState(); duckingUpState = new DuckingUpState(); climbingState = new ClimbingState(); attackingHeavyState = new AttackingHeavyState(); attackingCombo1State = new AttackingCombo1State(); attackingCombo2State = new AttackingCombo2State(); currentState = idleState; currentDirectionX = 1; }
private void button6_Click(object sender, EventArgs e) { Cam cam = CreateCam(); for (int i = 0; i < 30; i++) { // видовая матрица g.Clear(Color.White); double angle = 10 * i * Math.PI / 180; if (angle >= 2 * Math.PI) { angle -= 2 * Math.PI; } Polyhedron ph_copy = ph.Clone() as Polyhedron; //Affine.MakePerspectiveProjection(ph_copy, 45 * Math.PI / 180, 100, 5); Affine.MakeView(ph_copy, cam); Affine.RotateOverCenter(ph_copy, 'z', -angle); // вывести Affine.CentralProjection(ph_copy, 10); //Affine.IsometricProjection(ph_copy); ph_copy.Draw(g, Color.Black); //pictureBox1.Invalidate(); System.Threading.Thread.Sleep(100); } }
public void Start() { //Setup Prefs dataStorage.SetupFlockPrefs(); dataStorage.SetupPredPrefs(); //Check if first time setup if (PlayerPrefs.GetInt("startingCount", 0) == 0) { dataStorage.SaveFlockPrefs(); dataStorage.SavePredPrefs(); } float radius = flock.startingCount * flock.agentDensity * 5; //Spawn in the predator away from murmuration Vector3 predatorPos = Random.insideUnitSphere * flock.startingCount * flock.agentDensity * 5 * 4; float predRadius = radius * 2; while ((predatorPos.x < predRadius && predatorPos.x > predRadius * -1) || (predatorPos.z < predRadius && predatorPos.z > predRadius * -1) || (predatorPos.y < predRadius && predatorPos.y > predRadius * -1)) { predatorPos = Random.insideUnitSphere * flock.startingCount * flock.agentDensity * 5 * 4; } predatorPos += flock.focalPoint; predatorAgent = Instantiate( predatorPrefab, predatorPos, Random.rotation, transform ); predatorAgent.name = "Predator"; predatorAgent.Initialize(flock); flock.predatorAgent = predatorAgent; //Spawn in the flock of birds for (int i = 0; i < flock.startingCount; i++) { Vector3 pos = (Random.insideUnitSphere * flock.startingCount * flock.agentDensity * 5) + flock.focalPoint; FlockAgent starling = Instantiate( flockAgent, pos, Random.rotation, transform ); starling.name = "" + i; starling.Initialize(flock, predatorAgent); flock.agents.Add(starling); flock.agentsTransform.Add(starling.transform); StartCoroutine(starling.starlingAnimate(starling.GetComponentInChildren <Animator>())); grid.Populate(i, pos); } //Setup Camera cam = Instantiate(camPrefab, flock.focalPoint, camPrefab.transform.rotation); cam.Initialise(flock, flock.agents[0].transform, flock.agents[0].transform, predatorAgent.transform); Menu.runSimulation = true; }
private void UpdateZoom(float deltaTime) { if (IsPinching == true) { if (IsSmoothingEnabled == true) { pinchDistanceCurrentLerp = Mathf.Lerp(pinchDistanceCurrentLerp, pinchDistanceCurrent, Mathf.Clamp01(Time.deltaTime * camFollowFactor)); pinchCenterCurrentLerp = Vector3.Lerp(pinchCenterCurrentLerp, pinchCenterCurrent, Mathf.Clamp01(Time.deltaTime * camFollowFactor)); } else { pinchDistanceCurrentLerp = pinchDistanceCurrent; pinchCenterCurrentLerp = pinchCenterCurrent; } float cameraSize = pinchStartCamZoomSize * (pinchDistanceStart / Mathf.Max(pinchDistanceCurrentLerp, 0.0001f)); cameraSize = Mathf.Clamp(cameraSize, camZoomMin - camOverzoomMargin, camZoomMax + camOverzoomMargin); CamZoom = cameraSize; //Position update. Vector3 intersectionDragCurrent = GetIntersectionPoint(Cam.ScreenPointToRay(pinchCenterCurrentLerp)); Vector3 dragUpdateVector = intersectionDragCurrent - pinchStartIntersectionCenter; Vector3 targetPos = GetClampToBoundaries(Transform.position - dragUpdateVector); Transform.position = targetPos; //Disable smooth follow for the pinch-move update to prevent oscillation during the zoom phase. SetTargetPosition(targetPos); } }
/// <summary> /// Resets all or specific values from the camera component to their defaults. /// </summary> public void ResetCam(bool resetPosition = true, bool resetZoom = true, bool resetRotation = true) { if (resetPosition) { Cam.Move(new Vector2(-CurrentWorldShiftX, -CurrentWorldShiftY)); CurrentWorldShiftX = 0; CurrentWorldShiftY = 0; if (Cam.DefaultPosition == Vector2.Zero) { Cam.Position = new Vector2(graphics.Viewport.Width / 2, graphics.Viewport.Height / 2); } else { Cam.Position = Cam.DefaultPosition; } } if (resetZoom) { Cam.Zoom = Cam.DefaultZoom; } if (resetRotation) { Cam.Rotation = Cam.DefaultRotation; } }
public void Initialize(int startIndex = 0) { if (!m_Camera) { m_Camera = GetComponent <Camera>(); } if (m_Camera) { SetCamRect(m_Camera.rect); } else { Debug.LogError("[Observer has no camera] Destroying " + this.name); Destroy(gameObject); } if (!m_UI.canvas) { m_UI.canvas = GetComponentInChildren <Canvas>(); } if (m_UI.canvas) { m_UI.canvas.name = this.name + "_" + m_UI.canvas.name; PersistentObjectManager.Add(m_UI.canvas.gameObject); if (!m_UI.m_uiPanel) { var canvasChild = m_UI.canvas.transform.GetChild(0); if (canvasChild) { m_UI.m_uiPanel = canvasChild.GetComponent <RectTransform>(); } } } // Disable any camera postprocessing effects for Servers. m_MachineRole = MachineConfigurationManager.instance.GetMachineRole(); if (m_MachineRole == MachineConfigurationManager.MachineRole.Server) { var postProcBehavior = Cam.GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>(); if (postProcBehavior) { postProcBehavior.enabled = false; } } if (ObserverManager.Instance.cameraMountList.Count > 0) { int startingMountIndex = Mathf.Clamp(startIndex, 0, ObserverManager.Instance.cameraMountList.Count - 1); RepositionCamera(ObserverManager.Instance.cameraMountList[startingMountIndex]); } initialized = true; }
void Start() { cam = FindObjectOfType <Cam>(); player = FindObjectOfType <PlayerMove>().transform; InvokeRepeating("ShakeIt", rate, rate); anim = GetComponent <Animator>(); }
private void ShowCharacterCreationMenuEvent(object[] args) { // Destroy the menu Browser.DestroyBrowserEvent(null); // Initialize the character creation playerData = new PlayerModel(); ApplyPlayerModelChanges(); // Set the character into the creator menu Events.CallRemote("setCharacterIntoCreator"); // Make the camera focus the player camera = Cam.CreateCameraWithParams(Misc.GetHashKey("DEFAULT_SCRIPTED_CAMERA"), 402.8974f, -998.756f, -98.25f, -20.0f, 0.0f, 0.0f, 90.0f, true, 2); Cam.SetCamActive(camera, true); Cam.RenderScriptCams(true, false, 0, true, false, 0); // Disable the interface Ui.DisplayRadar(false); Ui.DisplayHud(false); Chat.Activate(false); Chat.Show(false); // Load the character creation menu Browser.CreateBrowserEvent(new object[] { "package://statics/html/characterCreator.html" }); }
// The command buffer populates the LODs with ocean depth data. It submits any objects with a RenderOceanDepth component attached. // It's stateless - the textures don't have to be managed across frames/scale changes void UpdateCmdBufOceanFloorDepth() { // if there is nothing in the scene tagged up for depth rendering then there is no depth rendering required if (_depthRenderers.Count < 1) { if (_bufOceanDepth != null) { _bufOceanDepth.Clear(); } return; } if (_bufOceanDepth == null) { _bufOceanDepth = new CommandBuffer(); Cam.AddCommandBuffer(CameraEvent.BeforeForwardOpaque, _bufOceanDepth); _bufOceanDepth.name = "Ocean Depth"; } _bufOceanDepth.Clear(); _bufOceanDepth.SetRenderTarget(_rtOceanDepth); _bufOceanDepth.ClearRenderTarget(false, true, Color.black); foreach (var entry in _depthRenderers) { _bufOceanDepth.DrawRenderer(entry.Key, entry.Value); } }
/// <summary> /// Menu closing sends "CharacterChanged (SelectedModelHash)" to server /// </summary> /// <param name="sender"></param> protected override void MainMenu_OnMenuClose(UIMenu sender) { //Destroy cameras, set this _camera to inactive Cam.RenderScriptCams(false, true, 0, false, false, 0); Cam.SetCamActive(_camera, false); Cam.DestroyCam(_camera, false); //Enable the players controls again RAGE.Elements.Player.LocalPlayer.SetGravity(true); Pad.EnableAllControlActions(0); //Let server know menu is closed to change if selected a ped to sync. RAGE.Events.CallRemote("ClientMenuClosed", SelectedModelHash.ToString(), selectedOutfit); PlayerHelper.FreezePlayer(false, false); ChatHelper.EnableChat(true); UiHelper.EnableHuds(); _instructionLayer = ScaleformHelper.InstructionalButtons(KeyValuePairs); if (_debug) { Chat.Output("Skin selector Menu closed"); } }
private int i = 0; //Sert pour le temps(pluie neige ...) public GameScreen() { timeSpawn = 10000; WorldEffects = new List <WorldEffect>(); Player = new Player(this, TexturesManager.Player); // Charge le Joueur Windows.Add(new PanelMenu(this, new Vector2(0, MainGame.ScreenY / 2), TexturesManager.Window, Player)); escapeMenu = new EscapeMenu(this, new Vector2(100, MainGame.ScreenY / 4 + 50)); IsPaused = false; Entities = new List <Entity>(); deletedEntities = new List <Entity>(); // On transfere un Monster deleted a l'interieur puis on le detruit dans cette liste MapData mapData = new MapData(); if (!mapData.FromFile("Content/Maps/map.mrm")) { throw new Exception(); } MapFirst = new Map(mapData); camera = new Cam(mapData.MapWidth * 32, mapData.MapHeight * 32, MainGame.graphics); }
public IEnumerator MM1MoveCameraRightOnMouse() { if (GameObject.Find("GameInfo") != null) { GameObject.Destroy(GameObject.Find("GameInfo")); } SceneManager.LoadScene("UnderGodScene"); //Always give it a sec yield return(null); yield return(null); Cam testcam = GameObject.Find("Main Camera").GetComponent <Cam>(); Vector3 firstPos = testcam.transform.position; testcam.transform.position += new Vector3(Time.deltaTime * testcam.FieldOfView, 0.0f, 0.0f); Vector3 secondPos = testcam.transform.position; //Checks to see if we added one unit Assert.True(firstPos != secondPos); }
void OnDestroy() { if (inst == this) { inst = null; } }
async Task TagImage(object sender, System.EventArgs e) { ViewModel.Tagging = true; ViewModel.ImageClassifierRunning = false; while (!ViewModel.ImageClassifierStopped) { await Task.Delay(200); } Device.BeginInvokeOnMainThread(async() => { Stream stream = await Cam.TakePhoto(new Renderers.CropRatios() { BottomRatio = 1, TopRatio = 1, LeftRatio = 1, RightRatio = 1 }); await ViewModel.TagPhoto(stream); ViewModel.Tagging = false; StartClassifier(null, null); }); }
public void CamShake() { if (!GameManager.instance.slowMotion) { Cam.GetComponent <Animator>().Play("CameraShake"); } }
// Use this for initialization void Start() { _This = this; Vector3 angles = transform.eulerAngles; x = angles.y; y = angles.x; }
void CamCapture() { //change render target to our renderTexture RenderTexture currentRT = RenderTexture.active; RenderTexture.active = screenshotRT; RenderTexture currentCamRT = Cam.targetTexture; Cam.targetTexture = screenshotRT; Cam.Render(); Debug.Log(screenshotRT); Texture2D Image = new Texture2D(screenshotRT.width, screenshotRT.height); Image.ReadPixels(new Rect(0, 0, screenshotRT.width, screenshotRT.height), 0, 0); Image.Apply(); RenderTexture.active = currentRT; Cam.targetTexture = currentCamRT; var Bytes = Image.EncodeToPNG(); Destroy(Image); File.WriteAllBytes(folderPath + "/Frame_" + FileCounter + ".png", Bytes); FileCounter++; }
void Awake() { cam = GameObject.Find("Camera").GetComponent <Cam>(); anim = GameObject.Find("Body").GetComponent <Animator>(); anim.SetBool("walk", false); anim.SetBool("idle", true); }
void CursorUiPos() { Ray ray = Cam.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, MaxRaycastDistance, MaskCursor)) { GameplayCursorPos = hit.point; GameplayCursorPosScm = ScmapEditor.WorldPosToScmap(GameplayCursorPos); if (GameplayCursorPosScm.x == LastCursorPos.x && GameplayCursorPosScm.z == LastCursorPos.z) { return; } GameplayCursorPosScm.y = hit.point.y * 10; //GameplayCursorPosScm.z = ScmapEditor.Current.map.Height - GameplayCursorPosScm.z; string X = GameplayCursorPosScm.x.ToString("N2"); string Y = GameplayCursorPosScm.y.ToString("N2"); string Z = GameplayCursorPosScm.z.ToString("N2"); X = X.PadRight(8); Y = Y.PadRight(8); Z = Z.PadRight(8); CursorInfo.text = "x: " + X + "\ty: " + Y + "\tz: " + Z; SetToEmptyPos = false; } else if (!SetToEmptyPos) { SetToEmptyPos = true; CursorInfo.text = "x: -------- \ty: -------- \tz: -------- "; } }
void LockHandler() { if (C.Lock) { if (IsLocked) { Unlock(); } else { e_EnemyAI[] enemies = CC.GetEnemiesOnScreen(lockRange, whatIsEnemy); if (enemies.Length <= 0) { return; } float distFromCenter = Mathf.Infinity; float temp = 0f; for (int i = 0; i < enemies.Length; i++) { if ((temp = Mathf.Abs(Cam.WorldToScreenPoint(enemies[i].transform.position).x - Screen.width * 0.5f)) < distFromCenter) { distFromCenter = temp; Lock(enemies[i].GetComponentInParent <e_EnemyAI>()); } } } } else if (IsLocked && EnemyLocked.IsDead) { Unlock(); } }
async Task StartImageClassifier() { while (ViewModel.ImageClassifierRunning) { ViewModel.ImageClassifierStopped = false; Stream stream = await Cam.TakePhoto(new Renderers.CropRatios() { BottomRatio = 1, TopRatio = 1, LeftRatio = 1, RightRatio = 1 }); var resultSet = await ImageClassifier.ClassifyImage(stream); foreach (var result in resultSet.OrderBy((arg) => arg.Tag)) { var foundResultValue = ViewModel.ResultEntries.Where((arg) => arg.Name == result.Tag).FirstOrDefault(); if (foundResultValue != null) { foundResultValue.SetTagValue(result.Probability); } } await Task.Delay(ViewModel.VisionClassifierInterval); // arbitrary delay } ViewModel.ImageClassifierStopped = true; }
public void SetAllFollowTransforms(Transform followTransform) { foreach (Camera Cam in RegisteredObjects.Values) { InertialCameraController ICC = Cam.GetComponent <InertialCameraController>(); if (ICC != null) { ICC.FollowTransform = followTransform; } else { LargeScaleCamera LSC = Cam.GetComponent <LargeScaleCamera>(); if (LSC != null) { LSC.FollowTransform = followTransform; } else { throw new InvalidOperationException( "Camera " + Cam.ToString() + " does not have an InertialCameraController " + "or LargeScaleCamera component" ); } } } }
protected void updateKeys(GameTime time, KeyboardState KeyBoardState) { ScreenOrSelection = KeyBoardState.IsKeyDown(Keys.A); //if (KeyBoardState.IsKeyDown(Keys.Enter)) //{ // new Vector3(); //} if (KeyBoardState.IsKeyDown(Keys.Z)) { OnRequestedSceneChanged(this, SceneType.Game, new LevelSelectSceneSendingArgs() { Name = LevelSelected }); } if (KeyBoardState.IsKeyDown(Keys.X)) { for (int i = 1; i != 100000; i++) { var b = Math.Log10(Math.Tan(Math.Tanh(Math.Sqrt(i)))) / Math.Log10(Math.E); } } if (KeyBoardState.IsKeyDown(Keys.Space)) { Cam.Rotate(0.1f, true); } }
private void PurchaseVehicleEvent(object[] args) { // Get the colors variables int primaryRed = 0, primaryGreen = 0, primaryBlue = 0; int secondaryRed = 0, secondaryGreen = 0, secondaryBlue = 0; // Get the vehicle's data var model = previewVehicle.Model.ToString(); previewVehicle.GetCustomPrimaryColour(ref primaryRed, ref primaryGreen, ref primaryBlue); previewVehicle.GetCustomSecondaryColour(ref secondaryRed, ref secondaryGreen, ref secondaryBlue); // Get color strings var firstColor = string.Format("{0},{1},{2}", primaryRed, primaryGreen, primaryBlue); var secondColor = string.Format("{0},{1},{2}", secondaryRed, secondaryGreen, secondaryBlue); // Destroy preview menu CloseCatalogEvent(null); // Destroy preview vehicle previewVehicle.Destroy(); previewVehicle = null; // Enable the HUD Ui.DisplayHud(true); Ui.DisplayRadar(true); // Position the camera behind the character Cam.DestroyCam(previewCamera, true); Cam.RenderScriptCams(false, false, 0, true, false, 0); // Purchase the vehicle Events.CallRemote("purchaseVehicle", model, firstColor, secondColor); }
private Vector3 GetDragVector(Vector3 dragPosStart, Vector3 dragPosCurrent) { Vector3 intersectionDragStart = GetIntersectionPoint(Cam.ScreenPointToRay(dragPosStart)); Vector3 intersectionDragCurrent = GetIntersectionPoint(Cam.ScreenPointToRay(dragPosCurrent)); return(intersectionDragCurrent - intersectionDragStart); }
public IEnumerator MM1MoveCameraUpOnWKey() { if (GameObject.Find("GameInfo") != null) { GameObject.Destroy(GameObject.Find("GameInfo")); } SceneManager.LoadScene("UnderGodScene"); //Always give it a sec yield return(null); yield return(null); Cam testcam = GameObject.Find("Main Camera").GetComponent <Cam>(); Vector3 firstPos = testcam.transform.position; testcam.UpHeld = true; yield return(null); testcam.UpHeld = false; Vector3 secondPos = testcam.transform.position; //Checks to see if we added one unit Assert.True(firstPos != secondPos); }
private void OnMouseDrag() { _ScreenPos = Input.mousePosition; _CurrPos = Cam.ScreenToWorldPoint(new Vector3(_ScreenPos.x, _ScreenPos.y, Cam.nearClipPlane)); _CurrPos.y = 0; transform.SetParent(null, true); _OldScale = transform.localScale; transform.SetParent(Owner.transform, true); var s = Owner.transform.localScale; var ds = DeltaScale(); s += ds; s.x = Mathf.Clamp(s.x, 5f, float.MaxValue); s.z = Mathf.Clamp(s.z, 5f, float.MaxValue); Owner.transform.localScale = s; for (int i = 0; i < Siblings.Length; i++) { Siblings[i].transform.SetParent(null, true); Siblings[i].transform.localScale = _OldScale; Siblings[i].transform.SetParent(Owner.transform, true); } if (!(s.x <= 5.01f) && !(s.z <= 5.01f)) { Owner.transform.position += _Anchor - Opposite.transform.position; } _Origin = _CurrPos; }
// Use this for initialization void Start () { point = GameObject.Find ("Main Camera").GetComponent<Cam> (); player = GameObject.Find ("Player"); enemy = GetComponent<Transform>().position; dir = player.GetComponent<Transform> ().position - enemy; gameObject.SetActive (true); Random.seed = System.DateTime.Now.Millisecond; }
void RemoveCommandBuffers() { if (_bufOceanDepth != null) { Cam.RemoveCommandBuffer(CameraEvent.BeforeForwardOpaque, _bufOceanDepth); _bufOceanDepth = null; } }
// Use this for initialization void Start() { p = GameObject.Find ("Player").GetComponent<player> (); c = Camera.main.GetComponent<Cam> (); PauseMenu = PauseMenu.GetComponent<Canvas> (); mainMenuText = mainMenuText.GetComponent<Button> (); resumeText = resumeText.GetComponent<Button> (); exitText = exitText.GetComponent<Button> (); restartText = exitText.GetComponent<Button> (); controlsText= controlsText.GetComponent<Button> (); exitControlsText = exitControlsText.GetComponent<Button> (); PauseMenu.enabled = false; ControlsImage.enabled = false; exitControlsText.gameObject.SetActive (false); //exitControlsText.enabled = false; foreach (string word in Input.GetJoystickNames()) { if (word != "") { usingController = true; } } }
void Awake() { main = this; }
void Start() { timerText = GameObject.Find("WaveTimeUI").GetComponent<Text>(); kidText = GameObject.Find("GirlCount").GetComponent<Text>(); momText = GameObject.Find("MomCount").GetComponent<Text>(); dadText = GameObject.Find("DadCount").GetComponent<Text>(); GO = GameObject.Find("gameover").GetComponent<GameOverScreen>(); winScreen = GameObject.Find("WinScreen").GetComponent<GameOverScreen>(); flameHealth = GameObject.Find("SkullFlame").GetComponent<Image>(); Ready = GameObject.Find("Ready").GetComponent<Image>(); Wave = GameObject.Find("Wave").GetComponent<Image>(); waveNumber = GameObject.Find("waveNumber").GetComponent<Image>(); readyNumber = GameObject.Find("readyNumber").GetComponent<Image>(); source = GetComponent<AudioSource>(); ms = GameObject.Find("MainSpawn").GetComponentInChildren<spawnAI>(); ks = GameObject.Find("KitchenSpawn").GetComponentInChildren<spawnAI>(); ws = GameObject.Find("WindowSpawn").GetComponentInChildren<spawnAI>(); bs = GameObject.Find("BathroomSpawn").GetComponentInChildren<spawnAI>(); Ghoul = GameObject.Find("Player").GetComponent<player>(); stopTimeUI = GameObject.Find("timePower").GetComponent<Image>(); speedUI = GameObject.Find("speedPower").GetComponent<Image>(); roomScareUI = GameObject.Find("scarePower").GetComponent<Image>(); mainCam = GameObject.Find("Camera").GetComponent<Cam>(); score = 0; waveCount = -1; totalWaves = 10; momWait = 0; dadWait = 0; timing = true; timer = -wavePrepTime; waveTimer = timer; kitchenTimer = timer; mainTimer = timer; windowTimer = timer; bathroomTimer = timer; currSpawn = 0; roomScareCurrent = 0; stopTimeCurrent = 0; speedCurrent = 0; speedUI.fillAmount = (float)speedCurrent / (float)speedMax; roomScareUI.fillAmount = (float)roomScareCurrent / (float)roomScareMax; stopTimeUI.fillAmount = (float)stopTimeCurrent / (float)stopTimeMax; fast = false; if (GameModeControl.mode == 2) Time.timeScale = speedMod; else Time.timeScale = 1; totalWaves = 10; populateEnemy(GameModeControl.mode); num = new Sprite[10]; numDesat = new Sprite[10]; for(int i = 0; i < 10; i++) { num[i] = Resources.Load<Sprite>("WaveUI/WaveUI/" + (i+1)); numDesat[i] = Resources.Load<Sprite>("WaveUI/WaveUI/" + (i+1) + "desat"); } //num[0] = Resources.Load<Sprite>("WaveUI/WaveUI/" + (1)); //numDesat[0] = Resources.Load<Sprite>("WaveUI/WaveUI/" + (1) + "desat"); spawnNextWave(); }
void Awake() { inst = this; offset = transform.position; flashCard = GetComponentInChildren<SpriteRenderer>(); }