private void Awake() { _boxOffset = new Vector3(1, 0); _groundChecker = GetComponent <GroundControl>(); _strafeChecker = GetComponent <StrafeControl>(); _rb = GetComponent <Rigidbody>(); }
// Start is called before the first frame update void Start() { _rigidBody = GetComponent <Rigidbody2D>(); _animator = GetComponent <Animator>(); _groundControl = GetComponentInChildren <GroundControl>(); _groundControl._animator = _animator; }
// Update is called once per frame void Update() { //if out of camera, recycle this ground. Vector3 pos = Camera.main.WorldToViewportPoint(this.transform.position); if (pos.z < 0) { GroundControl con = groundControl.GetComponent <GroundControl>(); con.recycle(); } }
private void checkFail() { if (transform.position.y < -10) { transform.position = new Vector3(0, 5, 0); transform.rotation = Quaternion.identity; this.runDirection = 0; this.runSpeed = this.defaultRunSpeed; GameObject obj = GameObject.Find("GroundControl"); GroundControl con = obj.GetComponent("GroundControl") as GroundControl; con.resetGame(); } }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag ("MainCamera"); ground = GameObject.FindGameObjectWithTag ("ground"); attack = GameObject.FindGameObjectWithTag ("attack"); hb = player.GetComponent<HealthBar> (); gc = ground.GetComponent<GroundControl> (); sc = attack.GetComponent<SpawnScript2> (); ball = GameObject.Find("Attack"); image = GameObject.FindGameObjectWithTag ("image"); pb = image.GetComponent<progressBar> (); anim = GetComponent<Animator> (); }
private void Awake() { _groundChecker = GetComponent <GroundControl>(); _rb = GetComponent <Rigidbody>(); }