Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        player = FindObjectOfType <RobotControl>();
        if (player != null)
        {
            playerRB = player.GetComponent <Rigidbody>();
        }
        //
        shootPoint = transform.Find("Shoot Point");
        if (shootPoint == null)
        {
            shootPoint = transform.Find("Barrel/Shoot Point");
        }
        //
        originalRotation = transform.localRotation;
        //
        audioSource = GetComponent <AudioSource>();
        //
        bodyRb = GetComponentInParent <Rigidbody>();
        // Registramos las correspondientes balas en el pool
        bulletPool = FindObjectOfType <BulletPool>();
        Bullet bulletData = proyectilePrefab.GetComponent <Bullet>();

        bulletPool.RegisterBullets(proyectilePrefab, rateOfFire, bulletData.lifeTime);
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        mainCamera   = Camera.main.transform;
        inputManager = FindObjectOfType <InputManager>();
        //cameraControl = mainCamera.GetComponent<SpringCamera>();
        cameraControl = FindObjectOfType <SpringCamera>();
        rb            = GetComponent <Rigidbody>();
        repulsor      = GetComponent <Repulsor>();
        gameManager   = FindObjectOfType <GameManager>();
        audioSource   = GetComponent <AudioSource>();
        //impactInfoManager = FindObjectOfType<ImpactInfoManager>();
        bulletPool = FindObjectOfType <BulletPool>();

        // TODO: No hacerlo tan hardcodeado
        bulletPool.RegisterBullets(elipticProyectilePrefab, 30, 10);

        //
        PlayerReference.Initiate(gameObject);

        //
        lastAxisXZ = Vector3.forward;

        //
        proyectileToUse = elipticProyectilePrefab;
        proyectileRb    = proyectileToUse.GetComponent <Rigidbody>();
        PlayerReference.currentProyectileRB = proyectileRb;

        // Recordar que la masa va en gramos (de momento)
        currentMuzzleSpeed = gameManager.playerAttributes.forcePerSecond.CurrentValue / (gameManager.playerAttributes.massPerSecond / 1000);
        // Debug.Log("Muzzle speed :" + currentMuzzleSpeed);
    }