void Awake() { playerRigidbody = target.GetComponent <Rigidbody>(); this.shootFlare = false; this.zoomInZone = false; this.inCurrents = false; this.particleDirection = ""; this.waitingCurrent = ""; transform = GetComponent <Transform>(); Vector3 position = transform.position; position.z = zPosition; transform.position = position; deadzoneRadiusSquared = deadzoneRadius * deadzoneRadius; this.zoomTimer = timeBeforeZoomIn; if (cameraInstance != null && cameraInstance != this) { GameObject.Destroy(this.gameObject); } else { DontDestroyOnLoad(this.gameObject); cameraInstance = this; } }
/// <summary> /// Instantiates a camera fr the local player /// </summary> private void InstantiateCamera() { SmoothCamera camera = ((GameObject)GameObject.Instantiate(playerCamera, transform.position, Quaternion.Euler(0, 0, 0))).GetComponent <SmoothCamera>(); camera.Target = transform; camera.Init(); }
private void LoadLevel() { _currentLevel = PlayerPrefs.GetInt("CurrentLevel", 0); LevelImporter importer = new LevelImporter(); _levels = importer.loadMetadata(Resources.Load <TextAsset>("levels").text); if (levelName != null) { levelName.text = _levels.levels[_currentLevel].title; } rewindButton.SetActive(_levels.levels[_currentLevel].rewindCount != 0); if (_camera != null) { SmoothCamera sc = GetComponent <SmoothCamera>(); sc.ClearBackgrounds(); for (int i = 0; i < _levels.levels[_currentLevel].background.Length; ++i) { sc.AddBackground(_levels.levels[_currentLevel].background[i]); } } LoadLevelObjects(importer); }
/// <summary> /// Intiailizes the camera, /// and ensures that there is only once camera instance per player /// </summary> public void Init() { GameObject currentObject = GameObject.FindGameObjectWithTag("Current"); if (currentObject != null) { current = currentObject.GetComponent <Current>(); } zoomManager = GetComponent <Zoom>(); transform = GetComponent <Transform>(); Vector3 position = transform.position; position.z = zPosition; transform.position = position; deadzoneRadiusSquared = deadzoneRadius * deadzoneRadius; if (isLocalPlayer) { if (cameraInstance != null && cameraInstance != this) { GameObject.Destroy(this.gameObject); } else { DontDestroyOnLoad(this.gameObject); cameraInstance = this; } } initialized = true; }
void Update() { var p = transform.position; p.x = x + SmoothCamera.Parallax(SmoothCamera.camT.position.x, SmoothCamera.camT.position.y, myStreet.transform.position.y - myStreet.StreetYOffset - amount); transform.position = p; }
void Awake() { Debug.Log(tag); if (tag == "MainCamera") { Instance = this; } }
// Use this for initialization void Start() { GameObject mainCamera = GameObject.Find("Main Camera"); if (mainCamera != null) { this.smoothCamera = mainCamera.GetComponent<SmoothCamera>(); } }
void Start() { sc = GetComponent <SmoothCamera>(); cs = cars[PlayerPrefs.GetInt("c")].GetComponent <CarScript>(); cars[PlayerPrefs.GetInt("c")].SetActive(true); sc.target = cars[PlayerPrefs.GetInt("c")].transform; sc.sc = cars[PlayerPrefs.GetInt("c")].GetComponent <WheelJoint2D>(); }
void Awake() { if (instance == null) { instance = this; } camera = GetComponent <Camera>(); }
void Update() { if (rootStreet) { var p = transform.position; p.x = SmoothCamera.Parallax(SmoothCamera.camT.position.x, SmoothCamera.camT.position.y, transform.position.y - StreetYOffset); transform.position = p; } }
// Use this for initialization void Start() { GameObject mainCamera = GameObject.Find("Main Camera"); if (mainCamera != null) { this.smoothCamera = mainCamera.GetComponent <SmoothCamera>(); } }
public void Construct(ILogger <CustomAvatarsSmoothCameraController> logger, Settings settings, MainSettingsModelSO mainSettingsModel) { _logger = logger; _settings = settings; _mainSettingsModel = mainSettingsModel; _smoothCamera = GetComponent <SmoothCamera>(); _camera = GetComponent <Camera>(); }
public override void onEnabled() { _broScene = scene as BroScene; _camera = scene.getSceneComponent <SmoothCamera>(); DebugLines.Add(new DebugLine { Text = () => $"Game State: {_gameState}" }); SetupGameModeHandler(); }
/// <summary> /// Initializes the zoom parameters /// </summary> void Start() { RevertTimer(); GameObject currentObject = GameObject.FindGameObjectWithTag("Current"); if (currentObject != null) { current = currentObject.GetComponent <Current>(); } smoothCamera = this.GetComponent <SmoothCamera>(); }
IEnumerator Start() { while (PlayerName == null || Time.timeScale == 0) yield return null; // Set dash time according to which stage someone's in if (UIManager.current_scene_name == GlobalStrings.SCENE_Game) { dashRechargeFactor = dashRechargeFactor_Game; } else { dashRechargeFactor = dashRechargeFactor_Tutorial; } dashDrainWfs = new WaitForSeconds(dashDrainFactor); dashRechargeWfs = new WaitForSeconds(dashRechargeFactor); cam = Camera.main.GetComponent<SmoothCamera>(); surface = Surface.None; canMoveHorizontal = true; kickOffset = Vector2.zero; // Pode coloring head.SetColor(headColor); foreach (Leg leg in legs) { leg.Init(headColor); } // Spawn PlayerStomp prefab (allows correct foot positioning on other players) GameObject newStomper = Instantiate(playerStomp, _transform.position, Quaternion.identity) as GameObject; newStomper.GetComponent<PlayerStomp>().player = gameObject; newStomper.transform.parent = _transform.parent; // Spawn shadow object GameObject newShadow = Instantiate(playerShadow, _transform.position, Quaternion.identity) as GameObject; newShadow.GetComponent<PlayerShadow>().player = this; newShadow.transform.parent = _transform.parent; // Update sprite / renderer ordering SetOrder(); stunHalo.gameObject.SetActive(false); // Tween initialization bopTweenConfig = new GoTweenConfig(); kickRetractConfig = new GoTweenConfig() .vector2Prop("kickOffset", Vector2.zero) .setEaseType(GoEaseType.ExpoOut); DashLayerMask = LayerMask.NameToLayer("Level"); }
void Start() { this.timer = cooldownTime; this.lightSource = GetComponent<LightSource>(); this.controllerRumble = GetComponent<ControllerRumble>(); this.rigidbody = GetComponent<Rigidbody>(); player = GameObject.FindWithTag("Player").transform; playerSound = player.GetComponent<PlayerSound>(); GameObject mainCamera = GameObject.Find("Main Camera"); if (mainCamera != null) { this.smoothCamera = mainCamera.GetComponent<SmoothCamera>(); } }
void Start() { this.timer = cooldownTime; this.lightSource = GetComponent <LightSource>(); this.controllerRumble = GetComponent <ControllerRumble>(); this.rigidbody = GetComponent <Rigidbody>(); player = GameObject.FindWithTag("Player").transform; playerSound = player.GetComponent <PlayerSound>(); GameObject mainCamera = GameObject.Find("Main Camera"); if (mainCamera != null) { this.smoothCamera = mainCamera.GetComponent <SmoothCamera>(); } }
/// <summary> /// Instantiates the particle system. /// </summary> private void StartCurrentParticles() { if (!particles) { GameObject mainCamera = GameObject.FindWithTag("MainCamera"); if (mainCamera != null) { this.smoothCamera = mainCamera.GetComponent <SmoothCamera>(); } Transform child = smoothCamera.gameObject.transform.FindChild(particleDirection); particles = (GameObject)Instantiate(child.gameObject, this.transform.position, child.transform.rotation); particles.SetActive(true); particles.GetComponent <ParticleSystem>().Play(); } }
/// <summary> /// Initializes the current. /// </summary> protected void Start() { rigidbodies = new List <Rigidbody>(); GameObject mainCamera = GameObject.FindWithTag("MainCamera"); if (mainCamera != null) { this.smoothCamera = mainCamera.GetComponent <SmoothCamera>(); } // By default, the current pushes downward. SetDirection(); empty = true; playerInCurrent = false; distance = distanceFromPlayer; }
public override void OnStateChanged(bool state, GameObject triggeringObject) { if (triggeringObject != null && state) { bool isMain = FindObjectOfType <LevelManager>().IsMainPlayerObject(triggeringObject); SmoothCamera camera = FindObjectOfType <SmoothCamera>(); Vector3 offset = camera.CameraPosition - triggeringObject.transform.position; offset.z = camera.CameraPosition.z; triggeringObject.transform.position = this.transform.position; if (isMain) { camera.SnapCamera(triggeringObject.transform.position + offset); } } }
public IEnumerator _Test_setPlayer() { GameObject player = new GameObject(); player.AddComponent <SmoothCamera>(); player.AddComponent <PlayerMovement>(); SmoothCamera playerScript = player.GetComponent <SmoothCamera>(); PlayerMovement playerPosition = player.GetComponent <PlayerMovement>(); playerScript.setPlayer(player); Assert.AreEqual(player, playerScript.getPlayer()); yield return(null); }
public PlayerSpawnFlare(FlareBean flareBean, Player player, ControllerRumble controllerRumble) { this.timer = 0; this.cooldownTime = flareBean.CoolDown; this.flareSpawnObject = flareBean.FlareSpawnObject; this.recoilForce = flareBean.RecoilForce; this.flareCostPercentage = flareBean.FlareCostPercentage; this.flareEnergyCost = flareBean.FlareEnergyCost; this.player = player; this.controllerRumble = controllerRumble; this.rigidbody = player.GetComponent <Rigidbody>(); GameObject mainCamera = GameObject.Find("Main Camera"); if (mainCamera != null) { this.smoothCamera = mainCamera.GetComponent <SmoothCamera>(); } }
void Awake() { // Set instance to this object if (instance == null) { instance = this; } // Enforce there can be only one instance else if (instance != this) { Destroy(gameObject); } camera_bounds = CameraExtensions.OrthographicBounds(Camera.main); /*left_wall.Attach(new Vector3(-camera_bounds.extents.x, 0), camera_bounds.extents.y, Wall.ESide.LEFT); * right_wall.Attach(new Vector3(camera_bounds.extents.x, 0), camera_bounds.extents.y, Wall.ESide.RIGHT); * up_wall.Attach(new Vector3(0, camera_bounds.extents.y), camera_bounds.extents.x, Wall.ESide.UP); * down_wall.Attach(new Vector3(0, -camera_bounds.extents.y), camera_bounds.extents.x, Wall.ESide.DOWN);*/ }
public void InitCamera() { Vector2d start = Rider.Create( _track.StartOffset, Vector2d.Zero).CalculateCenter();//avoid a timeline query if (Camera != null) { Camera.BeginFrame(1, Zoom); start = Camera.GetCenter(true); } if (Settings.SmoothCamera) { Camera = new SmoothCamera(); } else { Camera = new ClampCamera(); } Camera.SetTimeline(Timeline); Camera.SetFrameCenter(start); }
private void UpdateSmoothCamera(DiContainer container) { if (!_mainSettingsModel.smoothCameraEnabled) { return; } SmoothCamera smoothCamera = container.TryResolve <SmoothCamera>(); if (!smoothCamera) { _logger.Warning("Smooth camera not found!"); return; } Camera camera = smoothCamera.GetPrivateField <Camera>("_camera"); bool thirdPersonEnabled = smoothCamera.GetPrivateField <bool>("_thirdPersonEnabled"); _logger.Info($"Setting avatar culling mask and near clip plane on '{camera.name}'"); if (!_settings.showAvatarInSmoothCamera) { camera.cullingMask = camera.cullingMask & ~AvatarLayers.kAllLayersMask; camera.nearClipPlane = kCameraDefaultNearClipMask; } else if (thirdPersonEnabled) { camera.cullingMask = camera.cullingMask | AvatarLayers.kOnlyInThirdPersonMask | AvatarLayers.kAlwaysVisibleMask; camera.nearClipPlane = kCameraDefaultNearClipMask; } else { camera.cullingMask = (camera.cullingMask & ~AvatarLayers.kOnlyInThirdPersonMask) | AvatarLayers.kAlwaysVisibleMask; camera.nearClipPlane = _settings.cameraNearClipPlane; } }
/* * Replace this room with puzzle1 room */ private void ReplaceWithPuzzle1() { // Remove all childs for (int i = transform.childCount - 1; i >= 0; i--) { Destroy(transform.GetChild(i).gameObject); } // Add shop room Transform trans = Instantiate(myGenerator.puzzle1, transform).transform; walls = trans.GetChild(0); doors = trans.GetChild(1); floor = trans.GetChild(2); traps = trans.GetChild(3); size = new Vector2(9, 7); // Fix camera SmoothCamera camera = Camera.main.GetComponent <SmoothCamera>(); camera.offset = new Vector2(Mathf.Floor(size.x / 2), Mathf.Floor(size.y / 2)); camera.GetComponent <Camera>().orthographicSize = size.y / 2 + 2; }
void Start() { mainCamera = Camera.main.GetComponent <SmoothCamera>(); }
void Awake() { playerRigidbody = target.GetComponent<Rigidbody>(); this.shootFlare = false; this.zoomInZone = false; this.inCurrents = false; this.particleDirection = ""; this.waitingCurrent = ""; transform = GetComponent<Transform>(); Vector3 position = transform.position; position.z = zPosition; transform.position = position; deadzoneRadiusSquared = deadzoneRadius * deadzoneRadius; this.zoomTimer = timeBeforeZoomIn; if (cameraInstance != null && cameraInstance != this) { GameObject.Destroy(this.gameObject); } else { DontDestroyOnLoad(this.gameObject); cameraInstance = this; } }
void Start () { dog = GameObject.Find ("Dog"); mainCamera = GameObject.Find ("Main Camera").GetComponent<SmoothCamera> (); }
// private SaveLoadManager saveloadGame; // Use this for initialization void Start() { LevelSelect = false; Cam = FindObjectOfType <SmoothCamera> (); }
public virtual void Construct() { mainCamera = GetComponentInChildren <Camera>(); smoothCamera = GetComponent <SmoothCamera>(); charController = GetComponentInParent <CharacterController>(); }
private void Start() { smoothCamera = Camera.main.GetComponent <SmoothCamera>(); }
/// <summary> /// Initializes the current. /// </summary> protected void Start() { rigidbodies = new List<Rigidbody>(); GameObject mainCamera = GameObject.FindWithTag("MainCamera"); if (mainCamera != null) { this.smoothCamera = mainCamera.GetComponent<SmoothCamera>(); } // By default, the current pushes downward. SetDirection(); empty = true; playerInCurrent = false; distance = distanceFromPlayer; }