private void ShootOnEnemy(BasicPlayerDamage ballEffect, RaycastHit hit)
    {
        Rigidbody rigidBody = ballEffect.GetComponent <Rigidbody>();
        Vector3   direction = (hit.point - ballEffect.transform.position).normalized;

        rigidBody.velocity = direction * speed;
    }
    public void Shoot()
    {
        BasicPlayerDamage ballEffect = Instantiate(currentPower, transform.position, Quaternion.identity);
        RaycastHit        hit;

        if (Physics.Raycast(camera.transform.position, camera.transform.forward, out hit, range))
        {
            ShootOnEnemy(ballEffect, hit);
        }
        PlayShootingSound();
    }
    public void SetPower(PowerType powerType)
    {
        currentPowerType = powerType;
        switch (currentPowerType)
        {
        case PowerType.WhiteBall:
            currentPower = powers[0];
            break;

        case PowerType.FireBall:
            currentPower = powers[1];
            break;

        case PowerType.IceBall:
            currentPower = powers[2];
            break;

        case PowerType.LightningBall:
            currentPower = powers[3];
            break;
        }
    }
 private void Start()
 {
     currentPower = powers[0];
     InitializePowerDamage();
 }
Ejemplo n.º 5
0
 public void Spawn()
 {
     BasicPlayerDamage prefab = Instantiate(earthquakePrefab, parentTransform.position + parentTransform.forward, Quaternion.identity);
     prefab.transform.rotation = parentTransform.rotation;
     PlayEarthquakeSound();
 }