void Start() { ball = FindObjectOfType <LaunchBall>()?.GetComponent <LaunchBall>(); rigidbody = GetComponent <Rigidbody2D>(); input = GetComponent <ControllerInput>(); healthComponent = GetComponent <HealthComponent>(); animator = GetComponentInChildren <Animator>(); }
private void Awake() { if (instance != null) { Debug.Log("il y a plus d'une instance de LaunchBall"); return; } instance = this; }
//Do this when the mouse is clicked over the selectable object this script is attached to. public void OnPointerDown(PointerEventData eventData) { if (gameObject.GetComponent <Button>().interactable == true) { GameObject.Find("_SCRIPTS_").GetComponent <LaunchBall>().forceChange = true; LaunchBall lb = GameObject.Find("_SCRIPTS_").GetComponent <LaunchBall>(); StartCoroutine(lb.ForceVar()); print("button down"); } }
void Start() { launcher = gameObject.GetComponent <LaunchBall>(); rb = gameObject.GetComponent <Rigidbody>(); sphereCollider = gameObject.GetComponent <SphereCollider>(); meshRend = gameObject.GetComponent <MeshRenderer>(); mouseHeldDown = false; if (!gm) { gm = GameObject.Find("GameManager").GetComponent <GameManager>(); } }
void Launch() { if (Ball != null) { if (Input.GetButtonDown("Fire1") && Ball.CanFire == true) { Debug.Log("Fire"); hasLaunched = true; } } else { Ball = null; } }
private void Awake() { Ball = GameObject.FindObjectOfType <LaunchBall>()?.GetComponent <LaunchBall>(); }