// Use this for initialization void Start() { joycons = JoyconManager.Instance.j; bug = false; if (joycons.Count == 2) { if (initJoycons()) { aPressed = false; timeCounter = 0; speed = 1; //Initialisation des données pour la force d'impact. minForce = 500f; force = minForce; maxForce = 1000f; forceIncr = -5; currentMode = MODE.ORIENTATION; bInstance = GameObject.Find("Punching Ball").GetComponent <MG_PBall_PBall>(); bInstance.setPlayerMode(currentMode.ToString()); gameObject.GetComponent <Renderer>().material.color = Color.black; gameObject.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePosition | RigidbodyConstraints.FreezeRotation; } else { Debug.Log("Absence du joycon droit ou gauche."); bug = true; } } else { Debug.Log("Pas assez ou trop de joycons détectés. Un joycon droit et un gauche nécessaires."); bug = true; } }
// Use this for initialization void Start() { //On réalise la communication entre la caméra et le composant père, l'objet représentant le joueur. pInstance = gameObject.transform.parent.GetComponent <MG_PBall_Player>(); bInstance = GameObject.Find("Punching Ball").GetComponent <MG_PBall_PBall>(); cInstance = gameObject.transform.GetChild(0).GetComponent <MG_PBall_Text>(); offset = bInstance.transform.lossyScale.y * 3; rotateCameraObject(); }