// Update is called once per frame private void LateUpdate() { if (!isRegistered) { isRegistered = GameManager.RegisterCollectable(gameObject); } time += Time.deltaTime; if (time > 5 && !isPicked) { Instantiate(collectableFx, transform.position, new Quaternion(0, 0, 0, 0)); time = 0; } if (isPicked) { playerDirection = GameManager.playerOne.GetComponent <boxMov>(); var playerAttack = GameManager.playerOne.GetComponent <PlayerAttack>(); transform.position = playerAttack.offensePoint.transform.position; if (playerDirection.moveRight) { transform.rotation = new Quaternion(0, 0, 0, 0); } if (playerDirection.moveLeft) { transform.rotation = new Quaternion(0, 180, 0, 0); } // GameManager.setWalkGunAnim(true); GameManager.setDefenceString("defenceGun"); playerAttack.typeOfAttack = 1; } }
// Use this for initialization private void Start() { p_boxMov = transform.parent.GetComponent <boxMov>(); }