#Any shooting codes in c
1 messages ยท Page 1 of 1 (latest)
any shooting code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Protogun : MonoBehaviour
{
public Animator animator;
public MaterialHolder Holder;
public GameObject Bolt;
public float RechargeTime;
public AudioSource BlastSFX;
public Transform boltSpawn;
public bool Scoped;
float timer;
// Start is called before the first frame update
void Start()
{
}
public void ChangeAnimStatus()
{
if (Scoped)
{
transform.root.gameObject.GetComponent<CameraController>().ADS = true;
animator.SetTrigger("Hold");
}else
{
transform.root.gameObject.GetComponent<CameraController>().ADS = false;
animator.SetTrigger("UnHold");
}
}
// Update is called once per frame
void Update()
{
if(Input.GetKeyDown(KeyCode.Mouse1))
{
Scoped = !Scoped;
ChangeAnimStatus();
}
timer -= 0.02f;
if (Input.GetKey(KeyCode.Mouse0) && timer <= 0 && Holder.ElectronCharge >= 50)
{
BlastSFX.Play();
Instantiate(Bolt, boltSpawn.position, boltSpawn.rotation);
Holder.ElectronCharge -= 50;
timer = RechargeTime;
}
}
}
Thx
what kind?
But did i nees to create for example new animators?
What do you want to achieve
I assume yes, if you want animations
Ok
You should jsut search any tutorial on YT
there are plenty of them with usefull information
like this:
Let's create a shooting gun with muzzle flash, impact effect and force.
โ Sci-Fi Weapons: http://devassets.com/assets/sci-fi-weapons/
โ Medieval Arena: http://devassets.com/assets/medieval-arena/
โ Western Props: http://devassets.com/assets/western-props-pack/
โฅ Support my videos on Patreon: http://patreon.com/brackeys/
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท...
Bro i had 100 errors on this video
which one?
This u sent
.