Exemplo n.º 1
0
    void MouseStart()
    {
        if (Input.GetMouseButton(0))
        {
            StartPower += AccumulatingSpeed;
            Shrink();
            audioControl.ElasticGO();
//            Debug.Log(StartPower);
        }
        if (Input.GetMouseButtonUp(0))
        {
            Debug.Log("Start");
            if (StartPower >= MaxStartPower)
            {
                StartPower = MaxStartPower;
            }
            if (StartPower <= MinStartPower)
            {
                StartPower = MinStartPower;
            }
            for (int i = 0; i < sperm.Length; i++)
            {
                Vector2 temp = Vector2.up * StartPower;
                // Debug.Log(temp);
                sperm[i].GetComponent <Rigidbody2D>().AddForce(temp);
                //Debug.Log(sperm[i].GetComponent<Rigidbody2D>().velocity);
            }
            Vector2 forceVec = Vector2.up * StartPower;
            cameraTarget.GetComponent <Rigidbody2D>().AddForce(forceVec);
            canStart = true;
            cameraMove.CameraGo();
            audioControl.ElasticStop();
            audioControl.PlayBoom();
            PressKey.SetActive(false);
        }
    }