} //for debug purpose only // Start is called before the first frame update private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } _playerBanner = transform.Find("PlayerPowerBanner").GetComponent <PowerBanner>(); _enemyBanner = transform.Find("EnemyPowerBanner").GetComponent <PowerBanner>(); _playerMeter = transform.Find("PlayerPowerMeter").GetComponent <PowerMeter>(); _enemyMeter = transform.Find("EnemyPowerMeter").GetComponent <PowerMeter>(); _crashBG = transform.Find("BG").GetComponent <Image>(); _crashBG.color = new Color(0, 0, 0, 0); _anim = GetComponent <Animator>(); _result = transform.Find("Result").GetComponentInChildren <TMP_Text>(); _damageNumberFont[0] = Resources.Load <TMP_FontAsset>("Fonts/Palmmy/Soviet_Enumber"); _damageNumberFont[1] = Resources.Load <TMP_FontAsset>("Fonts/Palmmy/Soviet_Dnumber"); _damageNumberFont[2] = Resources.Load <TMP_FontAsset>("Fonts/Palmmy/Soviet_Draw"); _cameraShaker = Camera.main.GetComponent <ShakeCamera>(); }
void Start() { shakeCamera = FindObjectOfType <ShakeCamera>(); cameraFollow = FindObjectOfType <CameraFollow>(); characterAttack = GameObject.FindGameObjectWithTag(Tags.PLAYER).GetComponent <CharacterAttackController>(); }
// Start is called before the first frame update void Start() { recuo = GameObject.FindGameObjectWithTag("Player02").GetComponent <ShakeCamera>(); txtAk = GameObject.Find("municao122").GetComponent <Text>(); fireRate = 1f; tempoTiro = Time.time; }
void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "zhangai") { if (GameDataManager.instance.gameData.PlayerScore < score) { GameDataManager.instance.gameData.PlayerScore = score; GameDataManager.instance.Save(); MaxScore.instance.ChangeScore(score); } if (!gameOver) { audio.clip = zhuangqiang; audio.Play(); rb.Sleep(); ShakeCamera.shakeCamera(); } gameOver = true; StartCoroutine(ShowWindow()); if (!banner) { banner = GameObject.FindGameObjectWithTag("ADBanner").GetComponent <ADView>(); } banner.showBanner(true); } else if (col.gameObject.tag == "score") { if (!isAddScore) { score++; Score.instance.ChangeScore(score); isAddScore = true; } } }
public void StartSkill() { if (endTarget == null) { return; } curState = SkillState.directionTarget; transform.LookAt(endTarget); isCollision = false; startTimer = Time.time; virtualTarget = startTarget.position; journeyLength = Vector3.Distance(startTarget.position, endTarget.position); isPlay = true; StartCoroutine(UpdateSkill(0.016f)); ShakeCamera shakeCamera = Camera.main.GetComponent <ShakeCamera>(); if (shakeCamera != null) { if (ShakeCameraTime_Start > 0) { shakeCamera.Play(ShakeCameraTime_Start, ShakeCameraAmount_Start); } } }
// Use this for initialization void Start () { shakecamera = this.GetComponent<ShakeCamera>(); //player = GameObject.FindGameObjectWithTag (Tags.player).transform; //transform.LookAt (player.position); //offsetposition = transform.position - player.position; }
void Start() { GameObject.Destroy(this.gameObject, LifeTime); // Shaking a camera ShakeCamera.Shake(0.2f, 0.7f); }
void Start() { retryer = retryer.GetComponent <Retry>(); shaker = shaker.GetComponent <ShakeCamera>(); flame.SetActive(false); explotion.SetActive(false); }
public void DoDamage() { var explosionPos = transform.position; var colliders = Physics.OverlapSphere(explosionPos, Radius); foreach (var hit in colliders) { if (!hit || hit.gameObject == this.gameObject || hit.gameObject.tag == this.gameObject.tag) { continue; } if (listObjHitted.Contains(hit.gameObject)) { continue; } var dir = (hit.transform.position - transform.position).normalized; var direction = Vector3.Dot(dir, transform.forward); if (direction < Direction) // Only hit an object in the direction. { continue; } var orbit = Camera.main.gameObject.GetComponent <OrbitGameObject>(); if (orbit != null && orbit.Target == hit.gameObject) { ShakeCamera.Shake(0.5f, 0.5f); } var dirforce = (this.transform.forward + transform.up) * Force; if (hit.gameObject.GetComponent <CharacterStatus>()) { if (SoundHit.Length > 0) { int randomindex = Random.Range(0, SoundHit.Length); if (SoundHit[randomindex] != null) { AudioSource.PlayClipAtPoint(SoundHit[randomindex], this.transform.position); } } int damage = this.gameObject.GetComponent <CharacterStatus>().Damage; int damageCal = (int)Random.Range(damage / 2.0f, damage) + 1; var status = hit.gameObject.GetComponent <CharacterStatus>(); int takedamage = status.ApplayDamage(damageCal, dirforce); // Add Particle Effect AddFloatingText(hit.transform.position + Vector3.up, takedamage.ToString()); status.AddParticle(hit.transform.position + Vector3.up); } if (hit.GetComponent <Rigidbody>()) { // push rigidbody object hit.GetComponent <Rigidbody>().AddForce(dirforce); } // add this object to the list. We wont make a multiple hit in the same object AddObjHitted(hit.gameObject); } }
private void Start() { startPosition = transform.localPosition; initialDuration = duration; _instance = this; }
private void Awake() { bulletDirection = -muzzle.right; shotsLeft = shotsPerClip; PAS = GetComponentInParent <playerAudioScr>(); SHAKE = Camera.main.GetComponent <ShakeCamera>(); }
private void Awake() { GameManager.Instance.Player = this; playerInput = GameManager.Instance.InputController; pRBody = GetComponent <Rigidbody>(); shake = Camera.main.GetComponent <ShakeCamera>(); }
void Start() { inst = FindObjectOfType <Instanciator>(); shakeCamera = FindObjectOfType <ShakeCamera>(); player = FindObjectOfType <Player>(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.T)) { //Shake(mTime); ShakeCamera.ShakeAll(mTime); } }
// Start is called before the first frame update void Start() { player = GameObject.FindGameObjectWithTag("Player"); rb = this.GetComponent <Rigidbody2D>(); shakeCamera = GameObject.FindObjectOfType <Camera>().GetComponent <ShakeCamera>(); gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); soundManager = GameObject.FindGameObjectWithTag("SoundManager").GetComponent <SoundManager>(); }
// Use this for initialization void Awake() { if (instance == null) { instance = this; } initialPosition = transform.position; }
// Use this for initialization void Start() { shaker = mainCam.GetComponent <ShakeCamera>(); var x = random.Next(-range_h, range_h); obstacle = CreateObstacle(new Vector3(x, 32, 100)); obsTrans = obstacle.GetComponent <Transform>(); obsExists = true; }
public static ShakeCamera Shake(float magnitude, float duration) { OrbitGameObject orbitGameObject = (OrbitGameObject)UnityEngine.Object.FindObjectOfType(typeof(OrbitGameObject)); ShakeCamera shakeCamera = orbitGameObject.gameObject.AddComponent <ShakeCamera>(); shakeCamera.Magnitude = magnitude; shakeCamera.Duration = duration; return(shakeCamera); }
public virtual void Start() { forBlood = FindObjectOfType <Deplacement>(); gM = FindObjectOfType <GlobalManager>(); player = GameObject.FindGameObjectWithTag("Player").transform; agent = GetComponent <NavMeshAgent>(); currentTime = 0; GetComponent <Health>().OnDie.AddListener(Die); shakecam = FindObjectOfType <ShakeCamera>(); }
void Awake() { animationScript = GetComponent <CharacterAnimation>(); audioSource = GetComponent <AudioSource>(); if (gameObject.CompareTag(Tags.ENEMY_TAG)) { enemy_Movement = GetComponentInParent <EnemyMovement>(); } shakeCamera = GameObject.FindWithTag(Tags.MAIN_CAMERA_TAG).GetComponent <ShakeCamera>(); }
// Start is called before the first frame update void Start() { shakeCamera = GameObject.FindWithTag(Tags.MAIN_CAMERA_TAG).GetComponent <ShakeCamera>(); activators = GameObject.FindGameObjectsWithTag("Activator"); acts = new Activator[activators.Length]; for (int i = 0; i < activators.Length; i++) { acts[i] = activators[i].GetComponent <Activator>(); } }
//屏幕振动 public void Shakecamera(float period, float offPeriod, int shakeOrient, float shakeTime, float maxWave, float minWave) { ShakeCamera shakeCamera = Camera.main.GetComponent <ShakeCamera>(); if (shakeCamera == null) { shakeCamera = Camera.main.gameObject.AddComponent <ShakeCamera>(); } shakeCamera.ShakeScreen((ShakeCamera.ShakeOrient)shakeOrient, period, shakeTime, maxWave, minWave, offPeriod); }
void OnEnable() { instance = this; isshakeCamera = true; selfCamera = gameObject.GetComponent <Camera>(); shakeTime = setShakeTime; fps = shakeFps; frameTime = 0.03f; shakeDelta = 0.005f; }
private void Awake() { if (ShakeCameraRef == null) { ShakeCameraRef = this; } if (mainCam == null) { mainCam = Camera.main; } }
IEnumerator ShakeRoutine() { isShaking = true; ShakeCamera sc = GameObject.Find("GameMaster").GetComponent <ShakeCamera> (); sc.enabled = true; yield return(new WaitForSeconds(1f)); sc.enabled = false; isShaking = false; }
IEnumerator Shake(float aShakeTime, float aShakeMagnitude, float aShakeDelay) { //待機 yield return(new WaitForSeconds(aShakeDelay)); ShakeCamera.ShakeAll(aShakeTime, aShakeMagnitude); //カメラを揺らす //プレイヤーを移動可能にするまで待機 yield return(new WaitForSeconds(aShakeTime)); SetPlayerCanMove(true); }
void OnLand(WeightManager.Weight aWeight, LandImpact.CEnviroment aEnviroment) { //重さが2で if (aWeight == WeightManager.Weight.heavy) { //水中か、地上に着地したら if (aEnviroment == LandImpact.CEnviroment.cWater || aEnviroment == LandImpact.CEnviroment.cGround) { ShakeCamera.ShakeAll(mShakeTime); //カメラを揺らす } } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.name == "Player" && gameObject.name != "Dreadnaught") { KillEnemy(); //gameObject.GetComponent<ShakeCamera>().Shake(); ShakeCamera camShake = gameObject.AddComponent <ShakeCamera>(); camShake.Shake(); collision.collider.GetComponent <Player>().TakeDamage(); } }
private void Awake() { characterScript = GetComponent <CharacterAnimation>(); audioSource = GetComponent <AudioSource>(); if (gameObject.CompareTag(Tags.ENEMY_TAG)) { enemyMovement = GetComponentInParent <EnemyMovement>(); } //burada ShakeCamera() scriptine erişmek için cameranın tagini kullanarak camerayı bulduk, //sonra cameradan da bileşenlerine erişerek ShakeCamera scriptine ulaştık. shakeCamera = GameObject.FindWithTag(Tags.MAIN_CAMERA_TAG).GetComponent <ShakeCamera>(); }
void Start() { inst = FindObjectOfType <Instanciator>(); //shakeCamera = GetComponent<ShakeCamera>(); shakeCamera = FindObjectOfType <ShakeCamera>(); player = FindObjectOfType <Player>(); if (heart != null) { heart.SetInteger("life", -1); } }
// Use this for initialization void Start() { Destroy(gameObject, TimeDestroy); ShakeCamera shakeCamera = Camera.main.GetComponent <ShakeCamera>(); if (shakeCamera != null) { if (ShakeCameraTime > 0) { shakeCamera.Play(ShakeCameraTime, ShakeCameraAmount); } } }