// Use this for initialization private void Awake() { character = GetComponent <Character>(); Gun = GetComponentInChildren <GunFire>(); animator = GetComponentInChildren <Animator>(); RangedWeapon = Gun.gameObject.transform.parent.gameObject; MeleeWeapon = null; }
// Use this for initialization void Start() { gunProperties = GetComponent <GunProperties>(); gunFire = gunProperties.GetGunFire(); colorStateSize = System.Enum.GetNames(typeof(ColorState)).Length; gunProperties.SetBulletPrefab(bulletPrefabs[colorSelected]); uiColorImage = GameObject.FindWithTag("BulletColourUI").GetComponent <Image>(); }
// ############### // ## Methods ## // ############### /// <summary> /// Instantiate gun gameobject, and add it under the main camera. (in order not to make it move with the movement effect that we use for the main camera) /// </summary> public void Initialize() { GameObject gunPrefab = Resources.Load(GUN_PREFAB) as GameObject; var gunObject = GameObject.Instantiate(gunPrefab, Camera.main.transform.position + gunPrefab.transform.position, Quaternion.identity) as GameObject; gunObject.transform.parent = Camera.main.transform; // adding compoenet for the firing effect. gunFire = GameObject.FindGameObjectWithTag("GunHead").AddComponent <GunFire>(); }
public void TriggerDialogue() { //Time.timeScale = 0f; player = (MovementScript)GameObject.FindWithTag("Player").GetComponent(typeof(MovementScript)); shooting = (GunFire)GameObject.FindWithTag("Player").GetComponent(typeof(GunFire)); player.setNoEnemies(true); shooting.setShoot(false); player.setStopMovement(false); FindObjectOfType <DialogueManager>().StartDialogue(conversation.conversation, isExitDialogue); }
private bool isIce = true; //sets whenever its ice or fire type bullet //Performs shooting for the ice fire cannon with switch bullets public override void Shoot() { if (Target != null) { if (Target.gameObject.activeInHierarchy == true) { TimeElapsed += Time.deltaTime; if (TimeElapsed >= RateOfFire) { TimeElapsed = 0; if (BulletPool != null) { //plays animation if (Anim != null) { Anim.enabled = true; Anim.Play(0, 0, 0); } //plays particle if (GunFire != null) { GameObject particle = GunFire.GetPooledObject(); if (particle == null) { return; } particle.transform.position = Muzzle[0].transform.position; particle.transform.rotation = Muzzle[0].transform.rotation; particle.gameObject.SetActive(true); } //spawns the bullet and sets it to be positioned by muzzle GameObject bulletObj = BulletPool.GetPooledObject(); bulletObj.transform.position = Muzzle[0].transform.position; bulletObj.transform.rotation = Muzzle[0].transform.rotation; bulletObj.SetActive(true); Bullet newBullet = bulletObj.GetComponent <Bullet>(); newBullet.SetBullet(Damage, TowerStats.bulletSpeed, Target.transform, isIce); } } } } else { //sets animation to disabled if (Anim != null) { Anim.enabled = false; } } }
private void Start() { if (bulletSpawnPoint == null) { bulletSpawnPoint = transform; } gunFire = GetComponent <GunFire>(); if (bulletSpawnPoint == null) { Debug.LogError("bulletSpawnPoint not found on " + gameObject.name + "!"); } if (bulletPrefab == null) { Debug.LogError("bulletPrefab not found on " + gameObject.name + "!"); } }
void Start() { gunComponent = GetComponent <GunFire>(); }
// Start is called before the first frame update void Start() { dialogue_q = new Queue <Dialogue>(); player = (MovementScript)GameObject.FindWithTag("Player").GetComponent(typeof(MovementScript)); shooting = (GunFire)GameObject.FindWithTag("Player").GetComponent(typeof(GunFire)); }
public int CurrentWeapon = 0; // Take into account current weapon in hand / initialized to 0 (No Weapon) // [START] - void Start() { GunComponent = GetComponent <GunFire> (); // Assign GunComponent access of GunFire Component }
private void Start() { gun = GetComponent <Gun>(); gunFire = GetComponent <GunFire>(); }
// Use this for initialization private void Awake() { gunfire = GetComponentInChildren <GunFire>(); character = GetComponentInParent <Character>(); }
private void Start() { gameController = GameObject.Find("GameController").GetComponent <GameController>(); gunFire = GetComponent <GunFire>(); gunAim = GetComponent <GunAim>(); }
private void Start() { gun = GameObject.Find("Player").GetComponent <GunFire>(); }