void FindScripts() { // Find Controller GameObject GameObject controller = Camera.main.gameObject; // Attach scripts that are attached to controller object sc_CameraController = controller.GetComponent<CameraController>(); sc_GameController = controller.GetComponent<GameController>(); sc_LevelManager = controller.GetComponent<LevelManager>(); sc_RowManager = controller.GetComponent<RowManager>(); // Find Scripts not attached to controller object sc_AudioManager = GameObject.Find("audio_manager").GetComponent<AudioManager>(); if (LevelName == "Intro") return; sc_FadeToScene = GameObject.FindGameObjectWithTag("Fade").GetComponent<FadeToScene>(); sc_HighScoreManager = GameObject.FindGameObjectWithTag("Scores").GetComponent<HighScoreManager>(); if (CheckObjectExist("score_tracker")) sc_ScoreTracker = GameObject.Find("score_tracker").GetComponent<ScoreTracker>(); if (CheckObjectExist("glow_ball")) sc_BallController = GameObject.Find("glow_ball").GetComponent<BallController>(); if (CheckObjectExist("boundaries")) sc_BoundaryManager = GameObject.Find("boundaries").GetComponent<BoundaryManager>(); }
// Use this for initialization void Start () { if (instance != null){ Destroy(gameObject); } instance = this; playerTransform = GameObject.FindGameObjectWithTag("Player").transform; }
void Start() { GameObject gameControllerObject = GameObject.FindWithTag("MainCamera"); if (gameControllerObject != null) { camera = gameControllerObject.GetComponent<CameraController>(); } if (camera == null) { Debug.Log("Cannot find Camera script"); } gameControllerObject = GameObject.FindWithTag("Player"); if (gameControllerObject != null) { player = gameControllerObject.GetComponent<PlayerController>(); } if (player == null) { Debug.Log("Cannot find player script"); } gameOver = false; restart = false; score = 0; UpdateScore(); UpdateLives(); //StartCoroutine(SpawnWaves()); }
public async Task ReadSSIDAsync() { var controller = new CameraController(); var setting = await controller.Settings.SSID.ReadAsync(); Assert.Equal("unknown", setting.Value.Value); Assert.True(setting.Value.ReadOnly); }
// Use this for initialization void Start() { player = FindObjectOfType<PlayerController> (); gravityStore = player.GetComponent<Rigidbody2D> ().gravityScale; camera = FindObjectOfType<CameraController> (); healthManager = FindObjectOfType<HealthManager> (); }
void Start () { stageEnd_left = -30.0f; stageEnd_right = 30.0f; wait_for_start = true; firstTime = true; paused = false; GameObject mainCameraObj = GameObject.Find ("Camera"); GameObject healthBars = GameObject.Find ("HealthBars"); GameObject player1Obj = GameObject.Find ("Player1"); GameObject player2Obj = GameObject.Find ("Player2"); GameObject debugTextObj = GameObject.Find ("DebugText"); GameObject winTextObj = GameObject.Find ("WinText"); GameObject MIObj = GameObject.Find ("Info"); MI_gd = MIObj.GetComponent<MenuInfo> (); mainCamera = mainCameraObj.GetComponent<CameraController> (); healthbarcontroller = healthBars.GetComponent<HealthBarController> (); player1 = player1Obj.GetComponent<PlayerController> (); player2 = player2Obj.GetComponent<PlayerController> (); debugText = debugTextObj.GetComponent<DebugTextController> (); winText = winTextObj.GetComponent<Text> (); Quit = KeyCode.Escape; start_game = KeyCode.G; TogglePause = KeyCode.BackQuote; ToggleDebugText = KeyCode.Quote; winText.text = ""; winText.color = Color.white; }
void Start() { rigid = GetComponent<Rigidbody>(); playerInformation = GetComponent<PlayerInformation>(); cameraController = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>(); StartCoroutine(PointToMouse()); }
// ================================================================ // Initialize // ================================================================ public void Initialize (Transform _parentTransform, BGDials _bgDialsRef, CameraController _cameraControllerRef) { bgDialsRef = _bgDialsRef; cameraControllerRef = _cameraControllerRef; this.transform.SetParent (_parentTransform); spriteRenderer = GetComponent<SpriteRenderer> (); // Just gimmie some defaults for shiggles. lifetimeDuration = 5 * bgDialsRef.LifetimeScale;// * lifetimeDurationOnSpawnScale; vel = Vector3.zero; // spriteAlphaVel = 0; diameterVel = 0; rotationVel = 0; parallaxScale = 0; baseColor = Color.white; spriteRenderer.color = baseColor; GameUtils.SizeSprite (spriteRenderer, diameter,diameter); // Spawn and prewarm! Spawn (); timeAlive = Random.Range (0, lifetimeDuration); // Add event listeners! // GameManagers.Instance.EventManager.CameraPosChangedEvent += OnCameraPosChanged; // GameManagers.Instance.EventManager.CameraViewSectorChangedEvent += OnCameraViewSectorChanged; // GameManagers.Instance.EventManager.CameraZoomChangedEvent += OnCameraZoomChanged; }
// Use this for initialization void Start() { //Get PlayerController Object that already exists in the scene player = FindObjectOfType<PlayerController>(); //Get CameraController Object that already exists in the scene camera = FindObjectOfType<CameraController>(); }
void Start() { cameraController = FindObjectOfType<CameraController>(); snakeStarter = FindObjectOfType<RotateForward>(); cameraLerper = FindObjectOfType<LerpToCameraPoint>(); StartCoroutine(rotateGlobe()); }
// Use this for initialization void Start () { CameraControllerComponent = GetComponent<CameraController>(); BackgroundSprite = BackgroundPrefab.GetComponent<SpriteRenderer>(); Backgrounds = new List<GameObject>(); for (int i = 1; i <= InitialBackgrounds; i++) { float floor = Mathf.FloorToInt(InitialBackgrounds / 2); float ceil = floor + 1; Vector3 Pos; if (i <= floor) { Pos = new Vector3(transform.position.x - (BackgroundSprite.bounds.size.x * (ceil - i)), BackgroundHeight); } else if (i > ceil) { Pos = new Vector3(transform.position.x + (BackgroundSprite.bounds.size.x * (i - ceil)), BackgroundHeight); } else { Pos = new Vector3(transform.position.x, BackgroundHeight); } Backgrounds.Add(Instantiate(BackgroundPrefab, Pos, transform.rotation) as GameObject); } }
// Use this for initialization void Start() { Collider[] colliders = Physics.OverlapSphere(transform.position, m_ExplosionRadius); foreach(Collider otherCollider in colliders) { ExplodingElement explodingElement = otherCollider.gameObject.GetComponent<ExplodingElement>(); if(explodingElement != null) { explodingElement.Explode(transform.position, m_ExplosionRadius, m_ExplosionForce); } BaseHealth<int> health = otherCollider.gameObject.GetComponent<BaseHealth<int>>(); if (health != null) { health.Damage(m_Damage); } } m_Camera = Camera.main.GetComponent<CameraController>(); if (m_Camera != null) { m_Camera.Shake(m_CameraShake); } }
// Use this for initialization void Start () { playerRB = GetComponent<Rigidbody> (); playerTransform = GetComponent<Transform> (); playerPrefix = gameObject.name; if ((Application.platform == RuntimePlatform.OSXEditor) || (Application.platform == RuntimePlatform.OSXPlayer)) { moveButtonHoriz = "HorizontalMac" + playerPrefix; moveButtonVert = "VerticalMac" + playerPrefix; } else if ((Application.platform == RuntimePlatform.WindowsEditor) || (Application.platform == RuntimePlatform.WindowsPlayer)) { moveButtonHoriz = "HorizontalPC" + playerPrefix; moveButtonVert = "VerticalPC" + playerPrefix; } if (playerPrefix == "P1") { camera = GameObject.Find ("CameraParentP1").GetComponent<CameraController>(); animatorSlime = GameObject.Find("Player_blue_slime").GetComponent<Animator> (); } else { camera = GameObject.Find ("CameraParentP2").GetComponent<CameraController>(); animatorSlime = GameObject.Find("Player_yellow_slime").GetComponent<Animator> (); } foreach (Transform child in transform) { if (child.name == "Player_animated") { animatorBody = child.GetChild(0).GetComponent<Animator> (); } } }
// Use this for initialization void Awake() { cameraController = GameObject.FindGameObjectWithTag("CameraController").GetComponent<CameraController>(); thisCam = gameObject.GetComponentInParent<Camera>(); myRotation = transform.rotation; myPosition = transform.position; }
void Start() { cameraController = Camera.main.GetComponent<CameraController>(); try { using (StreamReader sr = new StreamReader(Application.dataPath + "/Levels/" + "01.txt")) { string line; int gridY = gridHeight-1; while ((line = sr.ReadLine()) != null) { // if line.Lenght != gridWidth-1 and other conditions char[] chars = new char[gridWidth]; using (StringReader sgr = new StringReader(line)) { sgr.Read(chars, 0, gridWidth); int gridX = 0; foreach (char c in chars) { CreateInstance(c, gridX, gridY); gridX++; } } gridY--; } } } catch (Exception e) { Debug.LogException(e); } }
// Use this for initialization public void Start () { PauseController = GameObject.Find("PauseCanvas").GetComponent<PauseController>(); _timeAffected = GetComponent<TimeAffected> (); _timeAffected.ShadowBlinkHandler += OnShadowBlink; _timeAffected.PassPauseController (PauseController); _layeredController = GetComponent<LayeredController> (); _targetable = gameObject.GetComponent<Targetable> (); _targetable.DeathEventHandler += OnDeath; _camera = Camera.main.GetComponent<CameraController> (); _musicController = gameObject.GetComponent<MusicController> (); GetComponent<LayeredController> ().LayerChangedEventHandler += UpdateLayerTransparencyOnLayerChange; GetComponent<LayeredController> ().LayerChangedEventHandler += UpdateMusicOnLayerChange; _bigGearPrefab = (GameObject)Resources.Load ("BigGear"); _smallGearPrefab = (GameObject)Resources.Load ("SmallGear"); _bigGear = Instantiate (_bigGearPrefab).GetComponent<GearController> (); _bigGear.PassPauseController (PauseController); _smallGear = Instantiate (_smallGearPrefab).GetComponent<GearController> (); _smallGear.PassPauseController (PauseController); _bigGear.Player = this; _smallGear.Player = this; _bigGear.RotationSpeed = _bigGearDefaultRotationSpeed; _smallGear.RotationSpeed = _smallGearDefaultRotationSpeed; _bigGear.Damage = _bigGearDamage; _smallGear.Damage = _smallGearDamage; _layeredController.Initialize(); UpdateLayerTransparencyOnLayerChange(); SaveCheckpoint (); }
void Start() { rb = GetComponent<Rigidbody> (); homePosition = gameObject.transform.position; cameraController = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<CameraController> (); Reset (); }
public void Awake() { instance = this; startPosition = transform.position; startRotation = transform.rotation; }
public PhotoCaptureWorkflow(ICameraEngineEvents callback, CameraController cameraController, int[] reviewImagePixels, Stream thumbnailStream, Stream imageStream) : base(callback, cameraController) { this.reviewImagePixels = reviewImagePixels; this.thumbnailStream = thumbnailStream; this.imageStream = imageStream; }
// Use this for initialization void Start() { cameraRef = Camera.main.GetComponent<CameraController>(); firstPersonHUD = GetComponentsInChildren<Canvas>(); radar3D = GameObject.FindGameObjectWithTag("Radar3D").GetComponent<Renderer>(); blips = GameObject.FindGameObjectsWithTag("Blip"); laserSight = GameObject.FindGameObjectWithTag("Laser Sight").GetComponent<LineRenderer>(); }
// Use this for initialization void Start() { meshRenderer = GetComponent<MeshRenderer>(); boxCollider = GetComponent<BoxCollider>(); cameraController = FindObjectOfType<CameraController>(); cartController = FindObjectOfType<CartController>(); door = FindObjectOfType<Door>(); }
void Awake() { thisCamera = this.GetComponent<Camera>(); if (camController == null) { camController = this; } }
/// <summary> /// Initializes a new instance of the <see cref="RovioAPI" /> class. /// </summary> /// <param name="settings">The settings.</param> public RovioAPI(string host, int port, NetworkCredential credentials) { this.rwc = new RovioWebClient(host, port, credentials); this.movement = new MovementController(this); this.manualDriver = this.movement.ManualDriver; this.camera = new CameraController(this); }
void Awake() { controller = this; if (camTransform == null) { camTransform = GetComponent(typeof(Transform)) as Transform; } }
public void Init(CameraController cameraController) { this.cameraController = cameraController; characterController = GetComponent<CharacterController>(); animator = transform.GetChild(0).GetComponent<Animator>(); leftHand = transform.Find("granny1/armature/base/base.001/clavicule.L/arm.L/hand.L/Bone"); rightHand = transform.Find("granny1/armature/base/base.001/clavicule.R/arm.R/hand.R/Bone.001"); }
// Use this for initialization void Start () { player = FindObjectOfType<Player1Controller> (); anim = FindObjectOfType<Animator> (); cam = FindObjectOfType<CameraController> (); playerCollider = playerObj.GetComponent<Collider2D> (); gun = FindObjectOfType<GunManager> (); }
void Start() { me = GetComponent<Entity>(); camControl = Cache.Get.cameraController; movement = me.Movement; touch.OnSwipe += OnSwipe; touch.OnTouch += OnTouch; }
void Awake() { if (controller == null) { controller = this; } else if (controller != this) { Destroy(gameObject); } }
private SfxHandler sfxScript; // markcode public void Start () { player_ref = GameObject.FindGameObjectWithTag ("Player"); ducklings_ref = GameObject.FindGameObjectsWithTag ("Duckling"); cc = (CameraController)GameObject.FindGameObjectWithTag ("MainCamera").GetComponent (typeof(CameraController)); // markcode: set the sfxScript varialbe to the SfxHandler script attached to the game controller this.sfxScript = (SfxHandler)GameObject.FindGameObjectWithTag("GameController").GetComponent(typeof(SfxHandler)); }
// Use this for initialization void Start() { player = FindObjectOfType<PlayerController> (); camera = FindObjectOfType<CameraController> (); healthManager = FindObjectOfType<HealthManager> (); }
void ReadPile() { /// Finished the touch NumberOfTouches += 1; var dirtsArray = FindObjectsOfType <Dirt>(); int numDirts = dirtsArray.Length; float superSum = 0.0f; float superAverage = 0.0f; /// For camera.. float lowestAverage = 999999.9f; Vector3 coreLocation = Vector2.zero; if (numDirts > 0) { /// Get average of distance for all dirts... for (int i = 0; i < numDirts; i++) { if (dirtsArray[i] != null) { /// Each dirt... Dirt ThisDirt = dirtsArray[i]; if (CheckBounds(ThisDirt.gameObject)) { float personalSum = 0.0f; for (int j = 0; j < numDirts; j++) { if (dirtsArray[j] != null) { Dirt ThatDirt = dirtsArray[j]; float distToDirt = Vector2.Distance(ThisDirt.transform.position, ThatDirt.transform.position); personalSum += distToDirt; } } /// Contribute to the average float personalAverage = personalSum / numDirts; superSum += personalAverage; /// Possibly nominate centerpoint for camera if (personalAverage < lowestAverage) { lowestAverage = personalAverage; coreLocation = ThisDirt.transform.position; } } /// Determines how many neighbors this dirt has ThisDirt.ProbeSurroundings(); } } /// Inform camera for tigher angle //Debug.Log("lowest average: " + lowestAverage); CameraController CamControl = Camera.main.GetComponent <CameraController>(); if (CamControl != null) { CamControl.NewParameters(lowestAverage, coreLocation); } /// Inverse of the combined average is our pile score superAverage = superSum / numDirts; PileScore = Mathf.Pow((1.0f / superAverage) * 10.0f, 3.0f); if (game != null) { game.UpdateScore(PileScore, NumberOfTouches); } } }
public Tile(int xPos, int yPos, int zPos, List <TileFrame> tileFrames, int animationSpeed, string textureName, CameraController cameraController) { XPos = xPos; YPos = yPos; ZPos = zPos; TileFrames = tileFrames; AnimationSpeed = animationSpeed; _counter = 0; _animationIndex = 0; TextureName = textureName; CameraController = cameraController; }
private void BeginGame() { currentBonusHolder = GameObject.Find("bonusHolder").GetComponent <bonusHolder>(); mazeInstance = Instantiate(mazePrefab) as Maze; lm = GameObject.Find("levelManager").GetComponent <levelManager>(); mazeInstance.Generate(lm.GetLevelSize()); //myPlayer=GameObject.Find("Player").GetComponent<PlayerController>(); if (!lm.isMultiplayer) { player = Instantiate(playerPrefab); } else { player = GameObject.Find("Player(Clone)"); } myPlayer = player.GetComponent <PlayerController>(); myPlayer.InitializePlayer(); myCamera = Instantiate(CameraPrefab); myCamera.SetPosition(new Vector3(0, 100, -100)); myCamera.SetPlayer(myPlayer.gameObject); myPlayer.SetNewLocation(mazeInstance.GetStartCellPosition()); //покраска сеттинга ColorScheme csch = new ColorScheme(); Color32[] colorScheme = csch.getColorRandomScheme(); mazeInstance.PaintMaze(colorScheme[0], 0.5f); myPlayer.PaintPlayer(colorScheme[1]); /*byte cameraBackgroudColorDelta = 30; * Color cameraBackgroudColor = new Color ((float)(colorScheme[0].r-cameraBackgroudColorDelta),(float)(colorScheme[0].g-cameraBackgroudColorDelta),(float)(colorScheme[0].b-cameraBackgroudColorDelta)); * Debug.Log ("gameController: "+colorScheme[0].ToString()); * Debug.Log ("cameraBackgroudColor= "+cameraBackgroudColor); * myCamera.setBackgroudColor (cameraBackgroudColor);*/ Color color = colorScheme [0]; //Debug.Log (color); color = new Color(color.r - 0.25f, color.g - 0.25f, color.b - 0.25f, 1f); myCamera.setBackgroudColor(color); //currentBonusHolder.PaintBonuses (colorScheme[2]); StartCoroutine(currentBonusHolder.PaintBonusesSlow(colorScheme[2])); winPanel.SetActive(false); StartCoroutine(CheckPlayerWin()); PauseMenuButton = GameObject.Find("MenuButton(onPause)"); PauseMenuButton.SetActive(false); }
// Use this for initialization void Start() { bounds = GetComponent <BoxCollider2D>(); theCamera = FindObjectOfType <CameraController>(); theCamera.setBounds(bounds); }
public void Start() { // Create GameObject so we can have access to a transform which has a position of "Vector3.zero". new GameObject("VisualPath", typeof(VisualPath)); GameObject go; TileSpriteController = new TileSpriteController(World); CharacterSpriteController = new CharacterSpriteController(World); FurnitureSpriteController = new FurnitureSpriteController(World); UtilitySpriteController = new UtilitySpriteController(World); JobSpriteController = new JobSpriteController(World, FurnitureSpriteController, UtilitySpriteController); InventorySpriteController = new InventorySpriteController(World, InventoryUI); ShipSpriteController = new ShipSpriteController(World); BuildModeController = new BuildModeController(); SpawnInventoryController = new SpawnInventoryController(); MouseController = new MouseController(BuildModeController, FurnitureSpriteController, UtilitySpriteController, circleCursorPrefab); QuestController = new QuestController(); CameraController = new CameraController(); TradeController = new TradeController(); AutosaveManager = new AutosaveManager(); // Register inputs actions KeyboardManager.Instance.RegisterInputAction("DevMode", KeyboardMappedInputType.KeyDown, ChangeDevMode); // Hiding Dev Mode spawn inventory controller if devmode is off. SpawnInventoryController.SetUIVisibility(SettingsKeyHolder.DeveloperMode); CameraController.Initialize(); // Initialising controllers. GameObject canvas = GameObject.Find("Canvas"); go = Instantiate(Resources.Load("UI/ContextMenu"), canvas.transform.position, canvas.transform.rotation, canvas.transform) as GameObject; go.name = "ContextMenu"; GameObject timeScale = Instantiate(Resources.Load("UI/TimeScale"), GameObject.Find("TopRight").transform, false) as GameObject; timeScale.name = "TimeScale"; GameObject dateTimeDisplay = Instantiate(Resources.Load("UI/DateTimeDisplay"), canvas.transform, false) as GameObject; dateTimeDisplay.name = "DateTimeDisplay"; GameController.Instance.IsModal = false; // Settings UI is a 'dialog box' (kinda), so it comes here. // Where as DevConsole is a constant menu item (it can appear 'anywhere' so it appears after) GameObject settingsMenu = (GameObject)Instantiate(Resources.Load("UI/SettingsMenu/SettingsMenu")); if (settingsMenu != null) { settingsMenu.name = "Settings Menu"; settingsMenu.transform.SetParent(canvas.transform, false); settingsMenu.SetActive(true); } // This will place it after context menu (and the inventory menu) and settings menu DialogBoxManager = GameObject.Find("Dialog Boxes").GetComponent <DialogBoxManager>(); DialogBoxManager.transform.SetAsLastSibling(); GameObject devConsole = (GameObject)Instantiate(Resources.Load("UI/Console/DevConsole")); if (devConsole != null) { devConsole.name = "DevConsole-Spawned"; devConsole.transform.SetParent(canvas.transform, false); devConsole.transform.SetAsLastSibling(); devConsole.SetActive(true); DeveloperConsole.DevConsole.Close(); } }
/// <summary> /// The character has been attached to the camera. Initialze the camera-related values. /// </summary> /// <param name="cameraController">The camera controller attached to the character. Can be null.</param> private void OnAttachCamera(CameraController cameraController) { m_CameraController = cameraController; }
void Start() { _camera = GameObject.Find("main-camera").GetComponent <CameraController>(); _box = GetComponent <BoxCollider2D>(); }
private void Awake() { gameManager = FindObjectOfType <GameManager>(); cameraController = FindObjectOfType <CameraController>(); }
// Use this for initialization void Start() { MainCam = GameObject.Find("Camera").GetComponent <CameraController>(); GameTerrain = GameObject.FindGameObjectWithTag("Terrain"); }
private void Start() { cameraController = FindObjectOfType <CameraController>(); }
// Start is called before the first frame update void Start() { camController = mainCam.GetComponent <CameraController>(); controllableCharacters.Add(currentCharacter); //camController.characterToFollow = currentCharacter.transform; }
void Start() { parser = GetComponent <IndoorGMLParser>(); uiController = GameObject.FindGameObjectWithTag("UIController").GetComponent <UIController>(); cameraController = Camera.main.GetComponent <CameraController>(); }
void FixedUpdate() { float inputX = Input.GetAxis("Horizontal"); float inputY = Input.GetAxis("Vertical"); float inputModifyFactor = (inputX != 0.0f && inputY != 0.0f && movSettings.limitDiagonalSpeed) ? .7071f : 1.0f; if (grounded) { bool sliding = false; //Raycast to check for a slope to slide on. if (Physics.Raycast(myTransform.position, -Vector3.up, out hit, rayDistance)) { if (Vector3.Angle(hit.normal, Vector3.up) > slideLimit) { sliding = true; } } //check from the collider. else { Physics.Raycast(contactPoint + Vector3.up, -Vector3.up, out hit); if (Vector3.Angle(hit.normal, Vector3.up) > slideLimit) { sliding = true; } } //If the player fell from a high place, damage. //Also reset jumps. if (falling) { falling = false; remainingJumps = jumpSettings.jumpCount; if (myTransform.position.y < fallStartLevel - jumpSettings.fallDamageThreshold) { FallingDamageAlert(fallStartLevel - myTransform.position.y); } } //If run key is down runSpeed, else walkSpeed. speed = Input.GetButton("Run") ? movSettings.runSpeed : movSettings.walkSpeed; // If sliding (and it's allowed), or if we're on an object tagged "Slide", get a vector pointing down the slope we're on if ((sliding && movSettings.slideOnSlopes) || (movSettings.slideOnSlopes && hit.collider.tag == "Slide")) { Vector3 hitNormal = hit.normal; moveDirection = new Vector3(hitNormal.x, -hitNormal.y, hitNormal.z); Vector3.OrthoNormalize(ref hitNormal, ref moveDirection); moveDirection *= movSettings.slideSpeed; playerControl = false; } // Otherwise recalculate moveDirection directly from axes, adding a bit of -y to avoid bumping down inclines else { moveDirection = new Vector3(inputX * inputModifyFactor, -movSettings.antiBumpFactor, inputY * inputModifyFactor); moveDirection = myTransform.TransformDirection(moveDirection) * speed; playerControl = true; } // Jump! But only if the jump button has been released and player has been grounded for a given number of frames if (Input.GetButton("Jump") && remainingJumps > 0 && jumpCooldownTimeStamp <= Time.time) { remainingJumps--; moveDirection.y = jumpSettings.jumpVelocity; jumpCooldownTimeStamp = Time.time + jumpSettings.jumpCooldownSeconds; } } else { // If we stepped over a cliff or something, set the height at which we started falling if (!falling) { falling = true; fallStartLevel = myTransform.position.y; } if (Input.GetButton("Jump") && remainingJumps > 0 && jumpCooldownTimeStamp <= Time.time) { remainingJumps--; moveDirection.y = jumpSettings.jumpVelocity; jumpCooldownTimeStamp = Time.time + jumpSettings.jumpCooldownSeconds; falling = false; } // If air control is allowed, check movement but don't touch the y component if (jumpSettings.airControl && playerControl) { moveDirection.x = inputX * speed * inputModifyFactor; moveDirection.z = inputY * speed * inputModifyFactor; moveDirection = myTransform.TransformDirection(moveDirection); } } // Apply gravity moveDirection.y -= jumpSettings.gravity * Time.deltaTime; //If the character is moving, center the camera and update rotation camController = GameObject.FindGameObjectWithTag("cameraPoint").GetComponent <CameraController>(); if (camController is ThirdPersonCameraController && ((ThirdPersonCameraController)camController).overrideWalking) { //Cast camController to ThirdPersonCamController. ThirdPersonCameraController thirdPersonCamController = (ThirdPersonCameraController)camController; if (inputX != 0 || inputY != 0) { if (!thirdPersonCamController.walking) { //Make the player face the camera. gameObject.transform.eulerAngles = new Vector3(0, camController.camPoint.gameObject.transform.eulerAngles.y, 0); } thirdPersonCamController.walking = true; thirdPersonCamController.CenterCamPointAxisY(); } else { thirdPersonCamController.walking = false; } } // Move the controller, and set grounded true or false depending on whether we're standing on something if (!camController.preventMovement) { grounded = (characterController.Move(moveDirection * Time.deltaTime) & CollisionFlags.Below) != 0; } }
void Start() { instance = this; }
//float mDelta = 10f; // Pixels. The width border at the edge in which the movement work //float mSpeed = 3.0f; // Scale. Speed of the movement void Start() { m_Instance = this; }
public CameraMediator() : base(NAME, null) { Camera camera = GameObject.FindObjectOfType <Camera>(); cameraController = camera.gameObject.AddComponent <CameraController>(); }
/// <summary> /// Initializes a new instance of the <see cref="PanHandler"/> class. /// </summary> /// <param name="viewport"> /// The viewport. /// </param> public PanHandler(CameraController viewport) : base(viewport) { }
private void Awake() { Instance = this; _startPosition = transform.position; }
private void Awake() { instance = this; }
void Start() { gameCamera = GetComponent <CameraController>(); gameCamera.SetTarget(cameraTarget); }
void OnGUI() { Color oldColor = GUI.color; //Color oldBackgroundColor = GUI.backgroundColor; GUI.color = Color.white; //GUI.backgroundColor = new Color(0.0F, 0.4F, 0.5F); GUIStyle scanButtonStyle = new GUIStyle("button"); Texture2D blueTexture = new Texture2D(1, 1); blueTexture.SetPixel(0, 0, new Color(0.0F, 0.4F, 1.0F, 0.8F)); blueTexture.Apply(); scanButtonStyle.normal.background = blueTexture; scanButtonStyle.fontSize = 25; if (GUI.Button(new Rect(50, Screen.height / 2, 200, 100), "Screenshot", scanButtonStyle)) { m_scan_state = SCAN_STATE_SCREENSHOT; } if (m_scan_state == SCAN_STATE_ON) { if (GUI.Button(new Rect(50, Screen.height / 2 + 120, 200, 100), "Stop Scan", scanButtonStyle)) { m_scan_state = SCAN_STATE_OFF; } } else { if (GUI.Button(new Rect(50, Screen.height / 2 + 120, 200, 100), "Start Scan", scanButtonStyle)) { m_scan_state = SCAN_STATE_ON; m_initiatal_delete = true; } } if (GUI.Button(new Rect(50, Screen.height / 2 + 240, 200, 100), "Clear Scan", scanButtonStyle)) { ClearPointClouds(); } if (GUI.Button(new Rect(50, Screen.height / 2 + 360, 200, 100), "Save Scan", scanButtonStyle)) { TimeSpan tspan = DateTime.UtcNow - new DateTime(1970, 1, 1); double epoch = tspan.TotalMilliseconds; string filePath = Application.persistentDataPath + "/data.txt"; FileStream _file = new System.IO.FileStream(filePath, FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(_file); // sw.WriteLine("write stuff here"); sw.Close(); _file.Close(); message = epoch.ToString(); } if (GUI.Button(new Rect(Screen.width - 270, Screen.height - 300, 250, 80), "Raw", scanButtonStyle)) { CameraController cameraRef = GameObject.Find("Camera").GetComponent <CameraController>(); cameraRef.EnableCamera(CameraController.CameraType.FIRST_PERSON); ClearPointClouds(); m_scan_state = SCAN_STATE_STREAM; } GUIStyle videoButtonStyle = new GUIStyle("button"); Texture2D whiteTexture = new Texture2D(1, 1); whiteTexture.SetPixel(0, 0, new Color(1.0F, 1.0F, 1.0F, 0.8F)); whiteTexture.Apply(); videoButtonStyle.normal.background = whiteTexture; videoButtonStyle.fontSize = 25; GUI.Button(new Rect(50, 50, 533, 300), "Video Preview", videoButtonStyle); //GUI.Button (new Rect (Screen.width / 2 + 50, 300, 900, 100), message); GUI.color = oldColor; //GUI.backgroundColor = oldBackgroundColor; }
// Use this for initialization void Start() { controller = this; }
// Start is called before the first frame update void Start() { authority = GameObject.Find("authority"); subject = GameObject.Find("subject"); camCon = GameObject.Find("Main Camera").GetComponent <CameraController>(); }
// Use this for initialization void Start() { thePlayer = FindObjectOfType <PlayerController>(); theCamera = FindObjectOfType <CameraController>(); theLevelManager = FindObjectOfType <LevelManager>(); }
// Start is called before the first frame update void Start() { cameraController = Camera.main.GetComponent <CameraController>(); }
// Use this for initialization void Start() { cc = Camera.main.GetComponent <CameraController> (); rb = GetComponent <Rigidbody2D> (); ani = GetComponent <Animator> (); }
public TestApp() { InitializeComponent(); lvCams.ItemsSource = CameraController.GetCameraList(); lvCams.SelectedIndex = 0; }
/// <summary> /// Initializes a new instance of the <see cref="ZoomRectangleHandler"/> class. /// </summary> /// <param name="controller"> /// The controller. /// </param> public ZoomRectangleHandler(CameraController controller) : base(controller) { }
// ---- Methods void CreateMap(int x, int y) { grid.CreateMap(x, y); CameraController.ValidatePosition(); Close(); }
// Start is called before the first frame update void Start() { Cam = FindObjectOfType <CameraController>(); }