// Use this for initialization void Start() { stars = transform.Find("Stars").gameObject; stars.SetActive(false); rb = GetComponent <Rigidbody2D>(); rb.freezeRotation = true; me = GetComponent <PlayerInfo>(); camScript = cam.GetComponent <Camera2DFollow>(); playerNum = me.playerNum; inventory = GetComponent <Inventory>(); mycolor = GetComponent <SpriteRenderer>().color; aimIndicator = transform.Find("AimIndicator").gameObject; aimIndicator.GetComponent <SpriteRenderer>().color = mycolor; SetControls(); //Idle timeSinceLastMoved = 0f; idle = false; idleLF = false; // movement pMovCurrentSpeed = speed; pMovHandle = pMovHandleBase; // punching fist = transform.Find("Fist").GetComponent <Fist>(); transform.FindDeepChild("FistSprite").GetComponent <SpriteRenderer>().color = mycolor; }
void initializeObject() { totalPoints = 100; bonusAmmoCapasity = 0; bonusMuzzleVelocity = 0; isPaused = false; isDead = false; audioSource = GetComponent <AudioSource>(); currentTimeScale = 1.0f; mainCamera = GameObject.FindWithTag("MainCamera"); cameraScript = mainCamera.GetComponentInParent <Camera2DFollow>(); lastActiveGun = WeaponController.Guns.Pistol; elapsedLives = totalLives; changeUserInfo(); changeActiveGunSprite(); }
// Use this for initialization protected virtual void Awake() { if (CameraTarget == null) { Debug.LogError(name + ": CameraTarget not set!"); } if (BossPrefab == null) { Debug.LogError(name + ": BossPrefab not set!"); } if (BossPosTransform == null) { Debug.LogError(name + ": BossPosTransform not set!"); } if (RespawnPosTransform == null) { Debug.LogError(name + ": RespawnPosTransform not set!"); } _camera = GameObject.FindObjectOfType <Camera2DFollow> (); if (_camera == null) { Debug.LogError(name + ": can not find Camera2DFollow!"); } // record the position of CameraTarget _cameraTargetPos = CameraTarget.position; // initialize Reset(); }
void Awake() { if (followControl == null) { followControl = this; } }
// Use this for initialization protected void Awake() { if (CameraTarget == null) { Debug.LogError(name + ": CameraTarget not set!"); } _camera = GameObject.FindObjectOfType <Camera2DFollow> (); if (_camera == null) { Debug.LogError(name + ": can not find Camera2DFollow!"); } _playerTransform = GameObject.FindGameObjectWithTag("Player").transform; if (_playerTransform == null) { Debug.LogError(name + ": can not find Player!"); } // record the position of CameraTarget _cameraTargetPos = CameraTarget.position; // initialize Reset(); }
// Start is called before the first frame update void Start() { m_DialogueManager = DialogueMgt.instance; m_AudioManager = AudioManager.instance; m_CameraShake = CameraShake.instance; m_CameraFollow = Camera.main.GetComponentInParent <Camera2DFollow>(); }
void Start() { camScript = FindObjectOfType <Camera> ().GetComponent <Camera2DFollow>(); source = GetComponent <AudioSource> (); Transform trsf = GetComponent <Transform> (); float orientation = trsf.localEulerAngles.z; angle = orientation * (Mathf.PI / 180); cos = Mathf.Cos(angle); sin = Mathf.Sin(angle); rend = GetComponentInChildren <SpriteRenderer> (); if (canBoostJump) { rend.sprite = spriteBoost; } else { rend.sprite = spriteNoBoost; } GameObject jumpPoint = new GameObject(); jumpPoint.name = "JumpPoint"; jumpPoint.transform.parent = gameObject.transform; jumpPoint.transform.localPosition = new Vector3(0, 1.5f, 0); jumpTrsf = jumpPoint.transform; }
void Awake() { if (gm != null) { if (gm != this) { Destroy(this.gameObject); } } else { gm = this; } GameObject clone = (GameObject)Instantiate(Resources.Load("Prefabs\\Player")); clone.transform.position = m_InitSpawnPoint.position + new Vector3(0f, 0.5f, 0f); clone.name = "Player"; Camera2DFollow cameraFollow = Camera.main.GetComponentInParent <Camera2DFollow>(); if (cameraFollow != null) { cameraFollow.target = clone.transform; } }
private void Awake() { animController = GetComponent <Animator>(); healthBar = FindObjectOfType <Slider>(); bossCameraTarget = Camera.main.GetComponent <Camera2DFollow>(); currTargetTransform = bossCameraTarget.target; }
public void SnapCameraAndTentacleToPlayer() { Camera.main.transform.position = playerController.transform.position; Camera2DFollow follow = Camera.main.GetComponent <Camera2DFollow>(); follow.Reset(); playerController.tentacle.transform.position = playerController.transform.position; playerController.tentacle.TeleportToBase(); }
private void Start() { m_Camera = Camera.main.GetComponent <Camera2DFollow>(); //get main camera script m_Animator = GetComponent <Animator>(); //get animator on gameobject var enemyStats = GetComponent <EnemyStatsGO>(); //get enemy stats on gameobject enemyStats.EnemyStats.OnEnemyTakeDamageValue += AddSmallScrapsAmount; //on hit give small amount of scraps enemyStats.EnemyStats.OnObjectDeath += AddBigScrapsAmount; //on destroy give big amount of scraps }
private void Start() { m_IsQuitting = false; PauseMenuManager.Instance.OnReturnToStartSceen += ChangeIsQuitting; MoveToNextScene.IsMoveToNextScene += ChangeIsQuitting; m_Camera = Camera.main.GetComponent <Camera2DFollow>(); }
private Camera2DFollow m_Camera; //main camera on scene #region initialize // Start is called before the first frame update void Start() { m_InteractionUIButton.PressInteractionButton = ActivatePlatform; //set what is happening when player press button m_InteractionUIButton.SetActive(false); //hide item's ui m_Camera = Camera.main.GetComponent <Camera2DFollow>(); //subscribe on is quitting method SubscribeToEvents(); }
void Start() { GameObject playerGO = GameObject.FindGameObjectWithTag("Player"); camera2DFollow = Camera.main.GetComponent <Camera2DFollow>(); player = playerGO.GetComponent <Player>(); player2D = playerGO.GetComponent <Player2D>(); dialogueManager = FindObjectOfType <DialogueManager>(); cameraEffects = FindObjectOfType <CameraEffects>();; }
private void Awake() { if (followControl == null) { followControl = this; } else { Destroy(gameObject); } }
// Use this for initialization void Awake() { anin_sprite = GetComponentInChildren <Animator>(); boxC = GetComponent <BoxCollider2D>(); script_Audio_MainScript = GameObject.Find("Main Camera").GetComponent <Audio_MainScript>(); script_Platformer2DUserControl = GameObject.Find("Player").GetComponent <Platformer2DUserControl>(); // miniG_PulgasAssassinas = GameObject.Find("MiniG_Boss"); main_Canvas = GameObject.Find("_MainCanvas").GetComponent <Canvas>(); script_FinalizarDia = GameObject.Find("_MainCanvas").GetComponent <finalizar_DIA>(); camera2DFollow_Script = GameObject.Find("Main Camera").GetComponent <Camera2DFollow>(); }
private bool m_IsQuitting; //if game is closing #endregion #region private methods // Use this for initialization private void Start() { m_InteractionUIButton.PressInteractionButton = OpenTheDoor; m_InteractionUIButton.SetActive(false); //initialize switch ui ChangeIsQuitting(false); //notify that application is not closing m_Camera = Camera.main.GetComponent <Camera2DFollow>(); SubscribeToEvents(); //subscribe to events }
private void Awake() { // Setting up references. m_GroundCheck = transform.Find("GroundCheck"); m_CeilingCheck = transform.Find("CeilingCheck"); m_Anim = GetComponentInChildren <Animator>(); m_Rigidbody2D = GetComponent <Rigidbody2D>(); GOController = GameObject.Find("GameController").GetComponent <GameController>(); camera2DFollow_Script = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera2DFollow>(); systemDialogueMental_Script = GetComponent <SystemDialogueMental>(); mainScript_Canvas = GameObject.Find("_MainCanvas").GetComponent <Canvas_MainScript>(); }
public Text CurrentMaxAmmo; // The amount of ammo of the weapon void Awake() { // If there isn't a stance of GameController yet if (instance == null) { // Search for the GameController and set it as the instance instance = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController> (); } // Stores camera = Camera.main.GetComponent <Camera2DFollow>(); }
private void Awake() { if (followControl == null) { followControl = this; cam = GetComponent <Camera>(); } else { Destroy(gameObject); } }
void Awake(){ cameraSettings = FindObjectOfType<Camera2DFollow> (); marker1 = Resources.Load<GameObject> ("Markers/Marker1"); marker2 = Resources.Load<GameObject> ("Markers/Marker2"); obstacle = Resources.Load<GameObject> ("Markers/Obstacle"); boom = Resources.Load<AudioClip> ("Audio/Final/Boom"); preDrop = Resources.Load<AudioClip> ("Audio/Final/Pre-drop"); audioSource = GetComponentInParent<AudioSource> (); player = GameObject.FindWithTag("Player"); mixer = audioSource.outputAudioMixerGroup.audioMixer; beat = FindObjectOfType<BeatMatcher> (); }
/* * TODO: * 2. PROPOSITION: Divide the force over several frames so that it looks as if it is burning opposite? - when deaccelerating * 3. * 5. möjligen en dynamisk dt variabel med inverst förhållande till velocity * * */ void Awake() { camera2DFollowSC = GameObject.Find("Main Camera").GetComponent <Camera2DFollow>(); overlord = GameObject.Find("Overlord"); overlordSC = overlord.GetComponent <overlordScript>(); bodyBeingOrbited = GameObject.FindGameObjectWithTag("orbitingCelestial"); //initial orbit around celestial with tag "startOrbit" now called bodyBeingOrbited oldCelestial = bodyBeingOrbited; trajectoryLine = GetComponent <LineRenderer>(); playerRigidbody = GetComponent <Rigidbody2D>(); playerWeight = playerRigidbody.mass; celestialMass = bodyBeingOrbited.GetComponent <celestialScript>().mass; score = 0; }
protected override void active() { cameraObj = Camera.main.GetComponent<Camera2DFollow>(); cameraObj.enabled = false; nodes.Insert(0,Player.instance.transform); durations.Insert(0,0.5f); pause.Insert(0,0); nodes.Add(Player.instance.transform); durations.Add(1); pause.Add(0); moveCamera(); }
void Awake() { scriptAudio_MainScript = GameObject.Find("Main Camera").GetComponent <Audio_MainScript>(); g_Player = GameObject.FindGameObjectWithTag("Player"); playerTrans = g_Player.GetComponent <Transform>(); platformer2dcharacter_Script = g_Player.GetComponent <PlatformerCharacter2D>(); GOController = GameObject.Find("GameController").GetComponent <GameController>(); systemDialogueMental_Script = GameObject.FindGameObjectWithTag("Player").GetComponent <SystemDialogueMental>(); camera2Dfollow_Script = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera2DFollow>(); scriptDIAProgress_Controller = GameObject.Find("Player").GetComponent <DIAProgress_Controller>(); trialLogger = GameObject.Find("Save").GetComponent <TrialLogger>(); script_Platformer2DUserControl = GameObject.Find("Player").GetComponent <Platformer2DUserControl>(); }
// Use this for initialization void Start () { base.ID = (int)IDList.ID.Cannon; _stageSwap = GameObject.FindGameObjectWithTag ("StageSwap").GetComponent<StageSwapController> (); _camera = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<Camera2DFollow> (); _player = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerUserController> (); _playerPick = GameObject.FindGameObjectWithTag ("Player").GetComponent <PlayerPickup> (); _playerAC = GameObject.FindGameObjectWithTag ("Player").transform.FindChild("Sprite").GetComponent <Animator> (); _shotStart = this.gameObject.transform.FindChild ("BarrelEnd"); _collider = this.gameObject.GetComponent<Collider2D> (); _aim = this.gameObject.transform.FindChild ("Aim").gameObject; _aim.SetActive (false); _sfxManager = GameObject.FindGameObjectWithTag ("SFXManager").GetComponent<SFXController> (); }
void UpdateCamera(Transform destination) { Transform currentTransform = activeRoom.gameObject.transform; Tuple <Tuple <float, float>, Tuple <float, float> > minMaxXYValues = DetermineMinMaxXYValues(activeRoom.gameObject.transform, 0, new Tuple <Tuple <float, float>, Tuple <float, float> >(new Tuple <float, float>(10000, -10000), new Tuple <float, float>(10000, -10000))); Camera2DFollow cameraFollowComponent = mainCam.GetComponent <Camera2DFollow>(); Debug.Log("camera bounds: " + minMaxXYValues); cameraFollowComponent.lowerBounds = new Vector2(minMaxXYValues.GetLeft().GetLeft(), minMaxXYValues.GetRight().GetLeft()); cameraFollowComponent.upperBounds = new Vector2(minMaxXYValues.GetLeft().GetRight(), minMaxXYValues.GetRight().GetRight()); mainCam.transform.position = new Vector3(destination.transform.position.x, destination.transform.position.y, mainCam.transform.position.z); }
// ///////////////////////////////////////////////////////////////////////////////// WESLEY private void Awake() { controls_Script = GameObject.Find("Player_MiniG").GetComponent <Controls>(); minigController_Script = GameObject.Find("MiniG_Controller").GetComponent <MiniG_Controller>(); camera2DFollow_Script = GameObject.Find("Main Camera").GetComponent <Camera2DFollow>(); if (GameObject.Find("_MainCanvas") != null) { script_FinalizarDia = GameObject.Find("_MainCanvas").GetComponent <finalizar_DIA>(); } }
public IEnumerator RespawnPlayer() { audio.Play(); yield return(new WaitForSeconds(spawnDelay)); Transform player = Instantiate(playerPrefab, spawnPoint.position, spawnPoint.rotation) as Transform; GameObject effect = (Instantiate(spawnPrefab, spawnPoint.position, spawnPoint.rotation) as Transform).gameObject; // Delete effect after someTime Destroy(effect, 1.8f); // Point main camera back to character; Camera2DFollow cam = Camera.main.GetComponent <Camera2DFollow> (); cam.target = player; }
public void Teleport(GameObject player) { // For when we animate the teleporting if (teleporting) { return; } // Once it's teleporting, don't try to teleport again teleporting = true; // Stops if doesn't find the map GameObject map = GameObject.Find(mapName); if (map == null) { teleporting = false; return; } // Stops the damping so the camera doesn't move with the player Camera2DFollow follow = Camera.main.GetComponent <Camera2DFollow>(); float damping = follow.damping; follow.damping = 0; // Moves the player around Vector3 newPos = map.transform.TransformPoint(position); newPos.z = player.transform.position.z; player.transform.position = newPos; // Cancels keyboard input KeyboardListener keyboard = player.GetComponent <KeyboardListener>(); keyboard.StopListening(); // TODO: cancels NPC movement // Update the camera and puts the damping again follow.UpdateCamera(); follow.damping = damping; keyboard.avoidListening = false; teleporting = false; }
public IEnumerator RespawnPlayer() { isRespawning = true; yield return(new WaitForSeconds(m_SpawnDelay)); GameObject cloneappear = (GameObject)Instantiate(Resources.Load("Prefabs\\AppearPlayer")); cloneappear.transform.position = m_SpawnPoint.transform.position + new Vector3(0f, 0.5f, 0f); cloneappear.name = "AppearPlayer"; Camera2DFollow cameraFollow = Camera.main.GetComponentInParent <Camera2DFollow>(); if (cameraFollow != null) { cameraFollow.target = cloneappear.transform; } gm.StartCoroutine(cameraFollow.DampingShutOff(0.1f)); yield return(new WaitForSeconds(m_AppearDelay)); Destroy(cloneappear); GameObject clone = (GameObject)Instantiate(Resources.Load("Prefabs\\Player")); clone.transform.position = m_SpawnPoint.transform.position + new Vector3(0f, 0.5f, 0f); clone.name = "Player"; if (!gm.m_IntroSceneEnded) { clone.GetComponentInChildren <PlayerSpit>().IsSpittingAllowed = false; } cameraFollow.target = clone.transform; if (OnPlayerRespawn != null) { OnPlayerRespawn(); // called to relink the statusindicator in the new player instance } isRespawning = false; }
public IEnumerator _RespawnPlayer() { isRespawning = true; audioManager.PlaySound(respawnCountdownSoundName); yield return(new WaitForSeconds(spawnDelay)); audioManager.PlaySound(spawnSoundName); Transform clone = Instantiate(playerPrefab, spawnPoint.position, spawnPoint.rotation); Transform spawnClone = Instantiate(spawnPrefab, spawnPoint.position, spawnPoint.rotation); Camera2DFollow cameraFollow = Camera.main.GetComponentInParent <Camera2DFollow>(); cameraFollow.target = clone; Destroy(spawnClone.gameObject, 3f); isRespawning = false; }
// Use this for initialization void Awake() { noahComendo_1 = GameObject.Find("Img_noahComendo_Dia1").GetComponent <Image>(); noahComendo_2 = GameObject.Find("Img_noahComendo_Dia2").GetComponent <Image>(); noahComendo_3 = GameObject.Find("Img_noahComendo_Dia3").GetComponent <Image>(); noahMercado = GameObject.Find("Img_noahPapelaria").GetComponent <Image>(); noahPapelaria = GameObject.Find("Img_noahMercado").GetComponent <Image>(); miniCelular = GameObject.Find("MiniCel"); script_PensamentoController = GameObject.Find("PensamentoController").GetComponent <PensamentoController>(); script_Platformer2DUserControl = GameObject.Find("Player").GetComponent <Platformer2DUserControl>(); anim = GameObject.Find("_PopUpMensagem").GetComponent <Animator>(); scriptAudio_MainScript = GameObject.Find("Main Camera").GetComponent <Audio_MainScript>(); array_OBJs_Diario = muzzle_Inicial_Diario.GetComponentsInChildren <Image>(); anin = celular.GetComponent <Animator>(); // Alterações Danilo camera2DFollow_Script = GameObject.Find("Main Camera").GetComponent <Camera2DFollow>(); }
void Awake() { character = GetComponent<PlatformerCharacter2D>(); GameObject cameraObject = GameObject.FindGameObjectWithTag("MainCamera"); camera = cameraObject.GetComponent<Camera2DFollow>(); runNumber = 1; //make sure there is only ever 1 of these objects /* if (og == null) { DontDestroyOnLoad(gameObject); DontDestroyOnLoad(character); og = this; runNumber = 1; Debug.Log("First Time Initialize."); } else if(og != this){ Destroy(gameObject); Destroy(character); runNumber++; Debug.Log("Destroy"); } */ }
void Start() { if (transform.localScale.x >= 0) { isFacingRight = true; } else { isFacingRight = false; } playerRigidBody = GetComponent<Rigidbody2D>(); playerAnimator = GetComponent<Animator>(); scale = new Vector2(Mathf.Abs(transform.localScale.x), Mathf.Abs(transform.localScale.y)); shotSpawnPosition = transform.Find("ShotSpawnPosition"); nextFireTime = 0.0f; camera2DFollow = GameObject.Find("Main Camera").AddComponent<Camera2DFollow>(); camera2DFollow.target = transform; audioSource = GetComponent<AudioSource>(); }
// Use this for initialization void Start() { followScript = GetComponent<Camera2DFollow> (); followScript.enabled = false; }