public void StartSession()
        {
            Lives           = GameConfiguration.Instance.Lives;
            Score           = 0;
            ScoreMultiplier = 1;

            _ball.Activate();
            _path.Activate();
        }
Exemple #2
0
 public void StartGame()
 {
     m_Paddle.Activate();
     m_Ball?.Activate();
 }
Exemple #3
0
    public virtual float Shoot()
    {
        //Dont have balls to shoot. dont shoot any!
        if (UnAbleToFire())
        {
            return(0.0f);
        }

        if (!mouth)
        {
            mouth = transform.Find("Mouth").transform;;
        }

        //Handle the shooting here.
        Vector3 mouthposition = mouth.position;
        //Vector3 mouthOffset = Vector3.zero;

//		print("Mouth Position :" + mouthposition);
        //mouthOffset.Set(mouthposition.x,1.2f,mouthposition.z);
        //mouthposition = mouthOffset;


        //Grab a hold of the ball to shoot.
        Ball b = BallInventory[0];


        //Activate it.
        b.Activate();

        //Set the balls velocity to zero.
        b.ZeroVelocity();


        //Set the position of the ball to the mouth position of the cannon.
        b.SetPosition(mouthposition);

        //Set the scale
        b.SetScale(BallScale);

        //Set shoot through
        b.SetShootThrough(ShootThrough);

        //Render Changing
        b.SetMaterial(BallMaterial);


        //Set the damage amount
        b.SetDamageAmount(DamageAmount);

        Rigidbody rbdy = b.GetComponent <Rigidbody>();

        //Set the mass amount when shot.
        rbdy.mass = BallMass;

        //Set the drag amount
        rbdy.drag = BallDrag;

        //Check to see if we need to turn off gravity
        rbdy.useGravity = !TurnOffGravityToShoot;

        //Set if shield gravity can control the ball.
        b.SetGravityControl(GravityControl);



        //Calculate the force.
        Vector3 ForceVector   = Vector3.zero;
        float   shootvelocity = ForceMagnitude;

        if (MassPushFactor)
        {
            shootvelocity = MassPushVelocity * BallMass;
        }



        ForceVector.Set(shootvelocity, shootvelocity, shootvelocity);

        //Scale the force with the forward vector of the cannon MOUTH to get the direction
        ForceVector.Scale(mouth.forward);


        //Apply the force and burn the ball.
        b.Fire(ForceVector, BallMass);

        //Set the active time.
        b.HotLifeTime = ActiveTime;


        //Release the ball
        BallInventory.Remove(b);

        //Set the timer
        timer = Time.time;

        //Play the particle effect
        if (ShootingEffect)
        {
            ShootingEffect.transform.position = mouthposition;
            ShootingEffect.Play();
        }


        //PlaySound.
        AudioPlayer.GetPlayer().PlaySound(ShootSound, 0.7f);


        //Return energy used.
        return(FiringEnergyHeat);
    }
 public void StartSimulation()
 {
     m_Active = true;
     m_Ball.Activate();
 }