Inheritance: MonoBehaviour
コード例 #1
0
    } //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>();
    }
コード例 #2
0
 void Start()
 {
     shakeCamera     = FindObjectOfType <ShakeCamera>();
     cameraFollow    = FindObjectOfType <CameraFollow>();
     characterAttack =
         GameObject.FindGameObjectWithTag(Tags.PLAYER).GetComponent <CharacterAttackController>();
 }
コード例 #3
0
 // 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;
 }
コード例 #4
0
 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;
         }
     }
 }
コード例 #5
0
    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);
            }
        }
    }
コード例 #6
0
ファイル: FollowPlayer.cs プロジェクト: satela/xjhU3d
	// 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;
	}
コード例 #7
0
    void Start()
    {
        GameObject.Destroy(this.gameObject, LifeTime);

        // Shaking a camera
        ShakeCamera.Shake(0.2f, 0.7f);
    }
コード例 #8
0
 void Start()
 {
     retryer = retryer.GetComponent <Retry>();
     shaker  = shaker.GetComponent <ShakeCamera>();
     flame.SetActive(false);
     explotion.SetActive(false);
 }
コード例 #9
0
    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);
        }
    }
コード例 #10
0
    private void Start()
    {
        startPosition   = transform.localPosition;
        initialDuration = duration;

        _instance = this;
    }
コード例 #11
0
ファイル: Shoot.cs プロジェクト: walthill/gundum
 private void Awake()
 {
     bulletDirection = -muzzle.right;
     shotsLeft       = shotsPerClip;
     PAS             = GetComponentInParent <playerAudioScr>();
     SHAKE           = Camera.main.GetComponent <ShakeCamera>();
 }
コード例 #12
0
ファイル: Player.cs プロジェクト: DarioDigz10/Project-ROGGER
 private void Awake()
 {
     GameManager.Instance.Player = this;
     playerInput = GameManager.Instance.InputController;
     pRBody      = GetComponent <Rigidbody>();
     shake       = Camera.main.GetComponent <ShakeCamera>();
 }
コード例 #13
0
    void Start()
    {
        inst = FindObjectOfType <Instanciator>();

        shakeCamera = FindObjectOfType <ShakeCamera>();

        player = FindObjectOfType <Player>();
    }
コード例 #14
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.T))
     {
         //Shake(mTime);
         ShakeCamera.ShakeAll(mTime);
     }
 }
コード例 #15
0
 // 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>();
 }
コード例 #16
0
ファイル: ShakeCamera.cs プロジェクト: TThanushan/space-td
    // Use this for initialization
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        initialPosition = transform.position;
    }
コード例 #17
0
    // 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;
    }
コード例 #18
0
    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);
    }
コード例 #19
0
 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>();
 }
コード例 #20
0
 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>();
 }
コード例 #21
0
 // 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>();
     }
 }
コード例 #22
0
        //屏幕振动
        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);
        }
コード例 #23
0
 void OnEnable()
 {
     instance      = this;
     isshakeCamera = true;
     selfCamera    = gameObject.GetComponent <Camera>();
     shakeTime     = setShakeTime;
     fps           = shakeFps;
     frameTime     = 0.03f;
     shakeDelta    = 0.005f;
 }
コード例 #24
0
 private void Awake()
 {
     if (ShakeCameraRef == null)
     {
         ShakeCameraRef = this;
     }
     if (mainCam == null)
     {
         mainCam = Camera.main;
     }
 }
コード例 #25
0
    IEnumerator ShakeRoutine()
    {
        isShaking = true;
        ShakeCamera sc = GameObject.Find("GameMaster").GetComponent <ShakeCamera> ();

        sc.enabled = true;
        yield return(new WaitForSeconds(1f));

        sc.enabled = false;
        isShaking  = false;
    }
コード例 #26
0
    IEnumerator Shake(float aShakeTime, float aShakeMagnitude, float aShakeDelay)
    {
        //待機
        yield return(new WaitForSeconds(aShakeDelay));

        ShakeCamera.ShakeAll(aShakeTime, aShakeMagnitude);         //カメラを揺らす

        //プレイヤーを移動可能にするまで待機
        yield return(new WaitForSeconds(aShakeTime));

        SetPlayerCanMove(true);
    }
コード例 #27
0
 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);                       //カメラを揺らす
         }
     }
 }
コード例 #28
0
    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();
        }
    }
コード例 #29
0
    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>();
    }
コード例 #30
0
ファイル: Splitter.cs プロジェクト: DenisCuencaBrex/GDD
    void Start()
    {
        inst = FindObjectOfType <Instanciator>();

        //shakeCamera = GetComponent<ShakeCamera>();
        shakeCamera = FindObjectOfType <ShakeCamera>();

        player = FindObjectOfType <Player>();
        if (heart != null)
        {
            heart.SetInteger("life", -1);
        }
    }
コード例 #31
0
    // 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);
            }
        }
    }