#Any shooting codes in c

1 messages ยท Page 1 of 1 (latest)

cursive robin
#

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;
    }
}

}

glossy dragon
#

Thx

cursive robin
#

what kind?

glossy dragon
#

But did i nees to create for example new animators?

cursive robin
#

What do you want to achieve

cursive robin
glossy dragon
#

Ok

cursive robin
#

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/

ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท...

โ–ถ Play video
glossy dragon
cursive robin
#

which one?

glossy dragon
#

This u sent

glossy dragon
cursive robin
#

what errors

#

I can help