Exemplo n.º 1
0
 // Use this for initialization
 private void Awake()
 {
     character    = GetComponent <Character>();
     Gun          = GetComponentInChildren <GunFire>();
     animator     = GetComponentInChildren <Animator>();
     RangedWeapon = Gun.gameObject.transform.parent.gameObject;
     MeleeWeapon  = null;
 }
Exemplo n.º 2
0
 // 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>();
 }
Exemplo n.º 3
0
    // ###############
    // ## 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>();
    }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
    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;
            }
        }
    }
Exemplo n.º 6
0
    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>();
 }
Exemplo n.º 8
0
 // 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));
 }
Exemplo n.º 9
0
    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>();
 }
Exemplo n.º 11
0
 // Use this for initialization
 private void Awake()
 {
     gunfire   = GetComponentInChildren <GunFire>();
     character = GetComponentInParent <Character>();
 }
Exemplo n.º 12
0
 private void Start()
 {
     gameController = GameObject.Find("GameController").GetComponent <GameController>();
     gunFire        = GetComponent <GunFire>();
     gunAim         = GetComponent <GunAim>();
 }
Exemplo n.º 13
0
 private void Start()
 {
     gun = GameObject.Find("Player").GetComponent <GunFire>();
 }