Ejemplo n.º 1
0
    void Start()
    {
        shake = GameObject.FindGameObjectWithTag("ScreenShake").GetComponent <ShakeController>();

        InitializeScreenField();
        InitializeMineField();
        SetBombs();
    }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        Debug.Assert(m_NextLevel != null, "Missing next level!!");
        Debug.Assert(SceneManager.GetSceneByName(m_NextLevel) != null, "Scene with name " + m_NextLevel + " Does not exist!!");

        m_SceenShaker = gameObject.AddComponent <ShakeController>();
        m_Counter     = Counter.GetComponent <HammerCounter>();
    }
Ejemplo n.º 3
0
    void OnCollisionEnter(Collision c)
    {
        ContactPoint cp = c.contacts[0];

        transform.up         = cp.normal;
        transform.localScale = new Vector3(1.5f, 0.5f, 1);

        ShakeController shake = Camera.main.gameObject.GetComponent <ShakeController>();

        shake.Shake();

        if (c.gameObject.tag == "Player")
        {
            sound.clip = hitPaddle;
            sound.Play();
        }
        else if (c.gameObject.tag == "Brick")
        {
            sound.clip = hitBrick;
            sound.Play();
        }
        else
        {
            sound.clip = hitWall;
            sound.Play();
        }
        ParticleSystem hitParticles = null;

        for (int i = 0; i < particlePool.Count; i++)
        {
            ParticleSystem p = particlePool[i];
            if (p.isStopped)
            {
                hitParticles = p;
                Debug.Log("reusing from my pool");
                break;
            }
        }

        if (hitParticles == null)
        {
            hitParticles = Instantiate(hitParticlesPrefab) as ParticleSystem;
            particlePool.Add(hitParticles);
        }

        ParticleSystem a = (c.gameObject.tag == "Player") ? paddle : hitParticles;

        //hitParticles.Stop();
        //hitParticles.transform.position = transform.position;
        //hitParticles.transform.up = body.velocity;
        //hitParticles.Play();

        a.Stop();
        a.transform.position = transform.position;
        a.transform.up       = body.velocity;
        a.Play();
    }
Ejemplo n.º 4
0
 void Start()
 {
     hudun.SetActive(false);
     changecolor     = TipUI.transform.FindChild("changecolor").GetComponent <Image>();
     LeftShake       = GameObject.Find(@"left_touch_controller_model_skel").GetComponent <ShakeController>();
     RightShake      = GameObject.Find(@"right_touch_controller_model_skel").GetComponent <ShakeController>();
     defaultbullet   = bullet.normal;
     timetemp        = 0.0f;
     father          = this.gameObject.transform.parent;
     line            = this.gameObject.transform.FindChild("line").GetComponent <LineRenderer>();
     line.startWidth = LineWidth;
     line.endWidth   = LineWidth;
     blood           = maxblood;
 }
Ejemplo n.º 5
0
    public ICameraOperate(CameraManager cameraManager)
    {
        mCameraManager = cameraManager;

        mMainCamera      = Camera.main;
        mParcent         = mMainCamera.transform.parent;
        mShakeController = new ShakeController();
        mShakeController.Init(mMainCamera.transform);

        PauseMove = true;
        PauseRoll = true;

        mPercent = 0;
        GameObject obj = GameObject.FindGameObjectWithTag(GameTage.PluginCameraPath);

        if (obj != null)
        {
            mCpa = obj.GetComponent <CameraPathAnimator>();
            mCpa.AnimationCustomEvent += OnCustomEvent;
        }
    }
Ejemplo n.º 6
0
    void CameraShake()
    {
        ShakeController shake = Camera.main.gameObject.GetComponent <ShakeController> ();

        shake.Shake();
    }
Ejemplo n.º 7
0
 private void Awake()
 {
     instance = this;
 }