// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody2D>(); speed = 0f; StartCoroutine(ChangeTableSpeed()); shaker = GameObject.FindWithTag("MainCamera").GetComponent <ScreenShake>(); }
private void Start() { pressbar = GameObject.FindGameObjectWithTag("PressBar").GetComponent <PressBar>(); anim = GetComponent <Animator>(); camera = Camera.main.GetComponent <ScreenShake>(); }
// Start is called before the first frame update void Start() { isColumnBomb = false; isRowBomb = false; isColourBomb = false; isAdjacentBomb = false; //board = FindObjectOfType<Board>(); board = GameObject.FindWithTag("Board").GetComponent <Board>(); findMatches = FindObjectOfType <FindMatches>(); hintManager = FindObjectOfType <HintManager>(); shake = FindObjectOfType <ScreenShake>(); endGameManager = FindObjectOfType <EndGameManager>(); explodable = GetComponent <Explodable>(); audioSource = gameObject.GetComponent <AudioSource>(); childObj = transform.Find("FollowMouse"); if (board.AllJuice == true) { childObj.gameObject.SetActive(true); } }
private IEnumerator PlaySword(NodeCollider.NodeHit grabbedNode, float attackSpeed) { float slashTime = attackSpeed / 3f; while (true) { slashTime += Time.deltaTime; Node updatedNode = UpdateNode(grabbedNode); Vector2 direction = GetNodeDirection(updatedNode); transform.position = updatedNode.position; transform.rotation = Quaternion.FromToRotation(Vector3.right, direction); if (slashTime >= attackSpeed) { slashTime -= attackSpeed; BloodParticlesManager.Play(updatedNode.position + Vector2.right / 10, direction); ScreenShake.Play(); } if (slashTime > attackSpeed / 3f) { swordSprite.transform.localPosition = Vector3.right / 10 + Vector3.down / 10; } else { swordSprite.transform.localPosition = Vector3.left / 20 + Vector3.down / 10; } yield return(null); } }
void Start() { col = GetComponent <BoxCollider2D>(); text = GetComponent <Text>(); shake = Camera.main.GetComponent <ScreenShake>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerShooting>(); }
// Start is called before the first frame update void Start() { mAnim = GetComponent <Animator>(); mCamera = GameObject.FindGameObjectWithTag("MainCamera").transform.GetChild(0).gameObject; mShake = GetComponent <ScreenShake>(); ShipTransitionIn(); }
private void Start() { ani = GetComponent <Animator>(); audioPlayer = GameObject.Find("AudioPlayer").GetComponent <AudioPlayer>(); screenShaker = GameObject.Find("GroundColTrigger").GetComponent <ScreenShake>(); }
// Use this for initialization void Start() { leftPanel = transform.GetChild(0); rightPanel = transform.GetChild(1); leftOpenPosition = leftPanel.position; rightOpenPosition = rightPanel.position; leftClosedPosition = leftPanel.position + new Vector3(-Screen.width * 0.6f, 0, 0); rightClosedPosition = rightPanel.position + new Vector3(Screen.width * 0.6f, 0, 0); leftPanel.position = leftClosedPosition; rightPanel.position = rightClosedPosition; vs = transform.GetChild(2).gameObject; leftTotal = vs.transform.GetChild(0).GetChild(0); leftTotalSpace = leftTotal.position; rightTotal = vs.transform.GetChild(1).GetChild(0); rightTotalSpace = rightTotal.position; leftTotal.position = rightTotalSpace; rightTotal.position = leftTotalSpace; vs.SetActive(false); screen = transform.parent.GetComponent <ScreenShake>(); }
// Start is called before the first frame update void Start() { transform.position = new Vector3(0, 0, 0); _screenShake = GameObject.Find("Main Camera").GetComponent <ScreenShake>(); _spawnManager = GameObject.Find("Spawn_Manager").GetComponent <SpawnManager>(); _uiManager = GameObject.Find("Canvas").GetComponent <UIManager>(); _audioSource = GetComponent <AudioSource>(); _shieldSpriteRenderer = _shieldVisual.GetComponent <SpriteRenderer>(); if (_spawnManager == null) { Debug.LogError("The Spawn Manager is NULL."); } if (_uiManager == null) { Debug.LogError("The UI Manager is NULL."); } if (_audioSource == null) { Debug.LogError("The Player's Audio Source is NULL."); } else { _audioSource.clip = _laserSoundClip; } if (_shieldSpriteRenderer == null) { Debug.LogError("The Shield's sprite renderer is NULL."); } }
void explode() { if (c != null) { ScreenShake ss = c.GetComponent <ScreenShake>(); ss.shakeDuration += .3f; } //do the exploding Vector3 explosionPos = transform.position; Collider2D[] colliders = Physics2D.OverlapCircleAll(explosionPos, radius); foreach (Collider2D hit in colliders) { Rigidbody2D rb = hit.GetComponent <Rigidbody2D>(); var direction = Vector3.zero; if (rb != null) { direction = rb.transform.position - transform.position; rb.AddForce(direction.normalized * power, ForceMode2D.Impulse); rb.gameObject.SendMessage("hit"); } } }
// Use this for initialization void Start() { game_ended = false; invincible = false; m_stunned = false; m_overdrive = false; started = false; m_currentSpeed_y = p_speed_y; m_currentSpeed_x = p_speed_x; gameManager = GameObject.FindGameObjectWithTag("GameController"); colorManager = gameManager.GetComponent <ColorManager>(); cameraScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <ScreenShake>(); barrelEnd = transform.Find("Barrel"); spriteRenderer = gameObject.GetComponent <SpriteRenderer>(); powerBar = Resources.Load <GameObject>("PowerBar"); shootAnimator = bazookaObject.GetComponent <Animator>(); invincibilityStar = transform.GetChild(2).gameObject; invincibilityStar.SetActive(false); key_cancelColor = KeyCode.I; }
/* * event #21 * * screen shake effect, assumes main canvas is in world space * * param 0: shake duration (float) * - if equal to -1, will trigger infinite screen shake (the check is within ScreenShake script) * optional param 1: shake magnitude (float, default 0.7f) * optional param 2: damping speed (float, default 1.0f) */ public void screenShake(bool[] done, string[] prms) { print("screenshake: " + prms[0] + "s, mag " + prms[1] + " damp " + prms[2]); float duration; if (!float.TryParse(prms[0], out duration)) { duration = 1f; } ScreenShake shake = gameControl.mainCamera.GetComponent <ScreenShake>(); if (prms[2] == "" && prms[1] == "") { shake.TriggerShake(duration); } else if (prms[2] == "") { float mag; float.TryParse(prms[1], out mag); shake.TriggerShake(duration, mag); } else { float mag; float.TryParse(prms[1], out mag); float damp; float.TryParse(prms[2], out damp); shake.TriggerShake(duration, mag, damp); } done[0] = true; }
// Use this for initialization protected virtual void Start() { Transform = transform; _renderer = GetComponent <SpriteRenderer>(); _screenShake = Camera.main.GetComponent <ScreenShake>(); Rigidbody = GetComponent <Rigidbody2D>(); }
// Start is called before the first frame update void Start() { rays = new List <RaycastHit2D>(rayCount); rayRenderersList = new List <GameObject>(); waypointPatrolScript = GetComponent <WaypointPatrol>(); gunBoiPatrolScript = GetComponent <GunBoiPatrol>(); screenShake = cameraObj.GetComponent <ScreenShake>(); circlePatrolScript = GetComponent <circleManPatrol>(); viewLineRenderer = GetComponent <LineRenderer>(); viewLineRenderer.positionCount = rayCount; updatePlayerPos = true; active = true; maxViewAngle = viewAngle; minViewAngle = -viewAngle; rayCount /= 2; layerMask = 1 << 8; layerMask = ~layerMask; if (rayRenderDensity % 2 == 0) { rayRenderDensity += 1; } raving = false; }
private void Awake() { playerId = GetComponent <InputReceiver>().playerId; pingSpawner = GetComponent <PingSpawner>(); particleGenerator = GetComponent <HitParticleGenerator>(); screenShake = Camera.main.GetComponent <ScreenShake>(); }
public IEnumerator InitGame(GameManager mode, WorldManager world) { TransitionController.instance.Transition(); AudioController.instance.ChangeMusic((int)(Random.Range(2, AudioController.instance.bgmClips.Length))); yield return(new WaitForSeconds(1.5f)); ScreenShake s = GameObject.Find("Camera").GetComponent <ScreenShake>(); s.ColorFade(s.day, 1); if (map) { DestroyImmediate(map.gameObject); } if (game) { DestroyImmediate(game.gameObject); } if (gameUI) { DestroyImmediate(gameUI.gameObject); } map = Instantiate(world, Vector3.zero, Quaternion.identity) as WorldManager; game = Instantiate(mode, Vector3.zero, Quaternion.identity) as GameManager; gameUI = Instantiate(gui, Vector3.zero, Quaternion.identity) as Canvas; }
void OnTriggerEnter(Collider other) { if (other.tag == "Player" && other.GetComponent <Health> () != null) { shake.CamShake(); other.gameObject.GetComponent <Health> ().currentHealth -= 1f; if (other.gameObject.GetComponent <PlayerControl> () != null) { Instantiate(other.gameObject.GetComponent <PlayerControl> ().playerBloodParticles, transform.position, Quaternion.identity); } Destroy(gameObject); } if (other.GetComponent <Collider>().tag == "Respawn" && other.GetComponent <Collider>().tag != "Enemy") { Destroy(other.gameObject, 3f); } if (other.GetComponent <Collider>().tag == "Shield") { shake = GameObject.FindGameObjectWithTag("ScreenShake").GetComponent <ScreenShake> (); Destroy(this.gameObject); this.GetComponent <Rigidbody> ().AddExplosionForce(10f, transform.position, 10f); } }
void Start() { //panel=panel = GameObject.Find("Main/Canvas/Game-Over Menu").GetComponent<RectTransform>(); ss = Camera.main.GetComponent <ScreenShake>(); objs = GameObject.FindGameObjectsWithTag("EnemyA"); other = GetComponent <SpriteRenderer>(); }
void Start() { source = GetComponent <AudioSource>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); gm = GameObject.FindGameObjectWithTag("GM").GetComponent <PlayerHealth>(); anim = GetComponent <Animator>(); spots = GameObject.FindGameObjectWithTag("Spots").GetComponent <Spots>(); shake = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <ScreenShake>(); if (complete == true) { ui = GameObject.FindGameObjectWithTag("UI").GetComponent <UI>(); } if (this.gameObject.tag == "Save Spot") { gm.respawnSpot = this.transform.position; } if (complete == false) { for (int i = 0; i < word.Length; i++) { word[i].SetActive(false); } } }
void Start() { parentUI = transform.parent.GetComponent <BulletSelect>(); mainMenu = parentUI.transform.parent.GetComponent <MainMenu>(); shake = Camera.main.GetComponent <ScreenShake>(); col = GetComponent <BoxCollider2D>(); }
void Start() { _screenShake = Camera.main.GetComponent <ScreenShake>(); _knockback = transform.root.GetComponent <Knockback>(); _muzzleFlash = GetComponent <ParticleSystem>(); _slowMotion = transform.root.GetComponent <SlowMotion>(); }
void Start() { anim = GetComponent <Animator>(); target = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); rotateSpeed = Random.Range(minRotateSpeed, maxRotateSpeed); shake = Camera.main.GetComponent <ScreenShake>(); if (shake == null) { Debug.LogError("No camera found for screenshake"); } int randNum = Random.Range(1, 4); switch (randNum) { case 1: startRateOfFire = 2f; break; case 2: startRateOfFire = 2.25f; break; case 3: startRateOfFire = 2.5f; break; } rateOfFire = startRateOfFire; }
// Start is called before the first frame update void Start() { screenShake = GetComponent <ScreenShake>(); camera = GetComponent <Camera>(); camPosition = player.transform.position + Vector3.up * verticalOffset; }
protected void Awake() { dragonController = FindObjectOfType <DragonController>(); player = FindObjectOfType <PlayerController>(); enterTerritory = FindObjectOfType <EnterTerritory>(); screenShake = GetComponentInChildren <ScreenShake>(); }
void Awake() { shotSound = GetComponent <AudioSource> (); camShake = GameObject.FindGameObjectWithTag("ScreenShake").GetComponentInChildren <ScreenShake> (); canFire = true; timer = 0f; }
void Start() { col = gameObject.GetComponent <BoxCollider2D>(); playText = gameObject.GetComponent <Text>(); mainMenu = gameObject.transform.parent.parent.GetComponent <MainMenu>(); shake = Camera.main.GetComponent <ScreenShake>(); }
void Start() { anim = GetComponent <Animator>(); target = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); shake = Camera.main.GetComponent <ScreenShake>(); StartCoroutine(BeginMove(true)); }
protected override void Awake() { base.Awake(); _originMat = GetComponent <SpriteRenderer>().material; _audioSource = GetComponent <AudioSource>(); _shapeshift.Init(_config.powerStates, _config.powerStates.candyState); _config.powerStates.SetupFrameRates(); _config.basicAttack.Init(); _config.superAttack.Init(); _fsm = StateMachine <PlayerState> .Initialize(this, PlayerState.Normal); _attackFSM = StateMachine <AttackState> .Initialize(this, AttackState.NoneAttack); _rainbowFSM = StateMachine <RainbowState> .Initialize(this, RainbowState.RainbowDisabled); _attackFSM.Changed += (state) => { _attackCollider.enabled = false; _attackedEnemies.Clear(); if (state != AttackState.NoneAttack) { _fsm.ChangeState(PlayerState.Attacking); } else { _attackIndex = 0; _fsm.ChangeState(PlayerState.Normal); } }; Stats.Reset(); _screenShake = Camera.main.GetComponent <ScreenShake>(); }
public void TakeDamage(Spell spell) { if (!spell.EnemyHit) { Vector2 damageTextPos = new Vector2(this.transform.position.x, this.transform.position.y + 2); if (spell.SpellDamageType == _weakness) { //if the damage type of the spell is the same as the weakness of the enemy, do double damage _currentHealth -= spell.SpellDamage * 2; ShowDamage.onShowDamage(damageTextPos, spell.SpellDamage * 2, true); ScreenShake.onScreenShake(4); } else { //IF the spells damage type is not the same as the weakness of the enemy, deal normal damage _currentHealth -= spell.SpellDamage; ShowDamage.onShowDamage(damageTextPos, spell.SpellDamage, false); ScreenShake.onScreenShake(1); } spell.EnemyHit = true; //This is to make sure spells dont hit multiple enemies StartCoroutine(TakeDamageRoutine(0.3f)); } _healthbar.ChangeHealth(_currentHealth, _maxHealth); if (_currentHealth <= 0) { Death(); } }
void Start() { currentState = GameState.START; StartCoroutine(SetUpBattle()); shake = GameObject.FindGameObjectWithTag("ScreenShake").GetComponent <ScreenShake>(); }
void Awake() { if (instance == null) instance = this; else { Debug.Log("More than one ScreenShake"); } }
void Awake() { if (Instance == null) { Instance = this; } else { Destroy(this); } }
void Start() { //shakes screen GameObject screenShakeObject = GameObject.FindWithTag("MainCamera"); if(screenShakeObject != null) screenShake = screenShakeObject.GetComponent<ScreenShake>(); screenShake.Shake(); //destroys itself after lifetime Destroy(gameObject, lifetime); }
// Use this for initialization void Awake() { dropForce = 100f; maxBalloonSpeed = 2f; lowestRemainingBalloon = 0; balloonCount = 3; distanceAway = new float[3]; screenShakeScript = GameObject.Find ("mainCam").GetComponent<ScreenShake> (); popNoise = GetComponent<AudioSource> (); rigbod = GetComponent<Rigidbody2D> (); basketCollider = GameObject.Find ("Basket").GetComponent<BoxCollider2D> (); balloons = new GameObject[]{ GameObject.Find("PinkBalloon"), GameObject.Find("TealBalloon"), GameObject.Find("GreyBalloon") }; balloonSprites = new SpriteRenderer[]{ balloons[0].GetComponent<SpriteRenderer>(), balloons[1].GetComponent<SpriteRenderer>(), balloons[2].GetComponent<SpriteRenderer>() }; balloonScripts = new Balloon[]{ balloons[0].GetComponent<Balloon>(), balloons[1].GetComponent<Balloon>(), balloons[2].GetComponent<Balloon>() }; balloonColliders = new CircleCollider2D[]{ balloons[0].GetComponent<CircleCollider2D>(), balloons[1].GetComponent<CircleCollider2D>(), balloons[2].GetComponent<CircleCollider2D>() }; balloonAnimators = new Animator[]{ balloons [0].GetComponent<Animator> (), balloons [1].GetComponent<Animator> (), balloons [2].GetComponent<Animator> () }; popped = new bool[]{ false, false, false, }; //Physics2D.IgnoreLayerCollision (14, 13); //ignore basket and spear collision //Physics2D.IgnoreLayerCollision (16, 16); //ignore birds hitting birds }
void Start() { Instance = this; regularPosition = transform.position; }
void Awake() { demon = GameObject.Find ("Demon"); shaman = GameObject.Find ("Shaman"); screenshake = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<ScreenShake> (); }
// Use this for initialization void Start() { manager = FindObjectOfType<GameManager>(); shake=Camera.main.GetComponent<ScreenShake>(); }
void Start() { screenShake = this; }