Files
FueraDeEscala/Assets/Game Kit Controller/Scripts/Weapons/Projectiles/laserMine.cs
Robii Aragon fd87a6ffd5 add ckg
plantilla base para movimiento básico
2026-02-05 05:07:55 -08:00

67 lines
1.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using GameKitController.Audio;
using UnityEngine;
public class laserMine : projectileSystem
{
[Header ("Main Settings")]
[Space]
public GameObject laserBeam;
public bool disableByTime;
public float timeToDisable;
public bool infiniteEnergy;
public int numberOfContactsToDisable;
int currentNumberOfContacts;
public void increaseNumberOfContacts ()
{
if (!infiniteEnergy) {
currentNumberOfContacts++;
if (currentNumberOfContacts >= numberOfContactsToDisable) {
disableBullet (0);
projectilePaused = false;
}
}
}
public void checkObjectDetected (Collider col)
{
if (canActivateEffect (col)) {
if (currentProjectileInfo.impactAudioElement != null) {
currentProjectileInfo.impactAudioElement.audioSource = GetComponent<AudioSource> ();
AudioPlayer.PlayOneShot (currentProjectileInfo.impactAudioElement, gameObject);
}
setProjectileUsedState (true);
//set the bullet kinematic
objectToDamage = col.GetComponent<Collider> ().gameObject;
Vector3 previousVelocity = mainRigidbody.linearVelocity;
//print (objectToDamage.name);
mainRigidbody.isKinematic = true;
if (currentProjectileInfo.adhereToSurface) {
attachProjectileToSurface ();
}
if (disableByTime) {
disableBullet (timeToDisable);
} else {
projectilePaused = true;
}
}
}
public override void resetProjectile ()
{
base.resetProjectile ();
currentNumberOfContacts = 0;
}
}