Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        player = GameObject.FindGameObjectWithTag ("Player");
        playerAmmo = player.GetComponent<PlayerAmmo> ();

        transform.position += new Vector3 (0, .5f, 0);
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        player     = GameObject.FindGameObjectWithTag("Player");
        playerAmmo = player.GetComponent <PlayerAmmo> ();

        transform.position += new Vector3(0, .5f, 0);
    }
Esempio n. 3
0
 void Awake()
 {
     anim       = GetComponent <Animator>();
     botUtility = GetComponentInParent <BotUtility>();
     health     = botUtility.GetComponent <PlayerHealth>();
     ammo       = botUtility.GetComponentInChildren <PlayerAmmo>();
 }
Esempio n. 4
0
 // Use this for initialization
 void Start()
 {
     playerArmor     = GetComponent <PlayerArmor>();
     playerInventory = GetComponent <PlayerInventory>();
     properties      = GetComponent <PlayerProperties>();
     duffleImage     = UIElement.GetComponent <Image>();
     playerAmmo      = GetComponent <PlayerAmmo>();
 }
Esempio n. 5
0
 // finds gameobjects and set booleans
 void Start()
 {
     AmmoCount     = GameObject.Find("AmmoCount");
     ActiveWeapon  = GameObject.Find("ActiveWeapon");
     weaponControl = ActiveWeapon.GetComponent <WeaponControl>();
     playerAmmo    = AmmoCount.GetComponent <PlayerAmmo>();
     meleeSpawn    = false;
 }
Esempio n. 6
0
 private void Awake()
 {
     gunShot       = GetComponent <AudioSource>();
     playerStat    = GetComponentInParent <PlayerStats>();
     playerAmmo    = GetComponentInParent <PlayerAmmo>();
     playerGrapple = GetComponentInParent <Grapple>();
     gunAnimation  = GetComponent <ProceduralGunAnimation>();
 }
Esempio n. 7
0
 void Awake()
 {
     ammo     = GetComponent <PlayerAmmo>();
     animator = GetComponent <Animator>();
     foreach (var weapon in weapons)
     {
         weapon.gameObject.SetActive(false);
     }
 }
Esempio n. 8
0
    private void Start()
    {
        /*----------------------------------------------------------------------
         * //Gets the Players Rigidbody Collider
         * ------------------------------------------------------------------------*/
        body = GetComponent <Rigidbody2D>();

        ammo = GetComponent <PlayerAmmo>();
    }
Esempio n. 9
0
    void Awake()
    {
        // Create a layer mask for the Shootable layer.
        shootableMask = LayerMask.GetMask("Shootable");

        player     = GameObject.FindGameObjectWithTag("Player");
        playerAmmo = player.GetComponent <PlayerAmmo> ();

        weaponSource      = player.GetComponent <AudioSource> ();
        weaponSource.clip = fireGun;
    }
Esempio n. 10
0
    public void Spawn(Dictionary <string, object> _data)
    {
        MyAmmos = new List <PlayerAmmo>();
        GameObject ballGo = Instantiate(PlayerAmmoPrefab.gameObject, Vector3.zero, Quaternion.identity) as GameObject;
        PlayerAmmo pa     = ballGo.GetComponent <PlayerAmmo>();

        MyAmmos.Add(pa);
        pa.transform.SetParent(transform);
        pa.transform.localPosition = Trans_SpawnPos.localPosition;
        pa.Init(_data);
        pa.Launch();
    }
Esempio n. 11
0
    // Use this for initialization
    public override void Start()
    {
        if (isPickup)
        {
            return;
        }
        base.Start();

        cam        = playerProperties.cam;
        playerAmmo = player.GetComponent <PlayerAmmo>();
        updateAmmo = player.transform.Find("SinglePlayer UI/HUD/Ammo Count").GetComponent <UpdateAmmo>();
        control    = player.GetComponent <PlayerInputControls>();
    }
Esempio n. 12
0
    void Start()
    {
        botUtility     = GetComponent <BotUtility>();
        health         = botUtility.GetComponent <PlayerHealth>();
        ammo           = botUtility.GetComponent <PlayerAmmo>();
        traitComponent = GetComponent <Agent>();

        int uniqueId = (TryGetComponent <AIPlannerTarget>(out var target) ? target.UniqueId : -1);

        traitComponent.UniqueId = uniqueId;

        UpdateParams();
    }
Esempio n. 13
0
    public void ObtenerPlayerAmmo(Transform playerAmmo)
    {
        Transform  spawnedAmmo = PlayerAmmoQueue.Dequeue();
        PlayerAmmo pa          = spawnedAmmo.GetComponent <PlayerAmmo>();

        pa.SetPlayerAmmo(VelocidadPlayerAmmo, TiempoVidaPlayerAmmo, ValorDañoPlayerAmmo);

        spawnedAmmo.gameObject.SetActive(true);
        spawnedAmmo.position = playerAmmo.position + (playerAmmo.forward * 2f);
        spawnedAmmo.rotation = playerAmmo.rotation;
        PlayerAmmoQueue.Enqueue(spawnedAmmo);

        //return spawnedAmmo;
    }
Esempio n. 14
0
    void Start()
    {
        botUtility     = GetComponent <BotUtility>();
        health         = botUtility.GetComponent <PlayerHealth>();
        ammo           = botUtility.GetComponent <PlayerAmmo>();
        traitComponent = GetComponent <TraitComponent>();

        int        uniqueId = (TryGetComponent <AIPlannerTarget>(out var target) ? target.UniqueId : -1);
        ITraitData agent    = traitComponent.GetTraitData <Agent>();

        agent.SetValue("UniqueId", uniqueId);

        UpdateParams();
    }
Esempio n. 15
0
    public Transform SpawnAmmo(Transform playerAmmo)
    {
        Transform  spawnedAmmo = playerAmmoQueue.Dequeue();
        PlayerAmmo pa          = spawnedAmmo.GetComponent <PlayerAmmo>();

        pa.speed    = playerAmmoSpeed;
        pa.lifeTime = playerAmmoLifeTime;
        //spawnedAmmo.SetParent(playerAmmo);

        spawnedAmmo.gameObject.SetActive(true);
        spawnedAmmo.position = playerAmmo.position + (playerAmmo.forward * 2f);
        spawnedAmmo.rotation = playerAmmo.rotation;
        //spawnedAmmo.position = playerAmmo.forward * 1.5f;

        //

        playerAmmoQueue.Enqueue(spawnedAmmo);

        return(spawnedAmmo);
    }
Esempio n. 16
0
    // Use this for initialization
    void Start()
    {
        if (gameObject.name != "Ammo Count Panel")
        {
            Debug.LogWarning("Make sure this is attached to a panel with ammo dislpay UI objects in it!");
        }
        Image[] tempImages = GetComponentsInChildren <Image>();
        ammoImage = new Image[tempImages.Length - 1];
        for (int i = 1; i < tempImages.Length; i++)
        {
            ammoImage[i - 1] = tempImages[i];
        }

        amountText = GetComponentsInChildren <Text>();
        try
        {
            ammo = transform.root.GetComponent <PlayerAmmo>();
        }
        catch (MissingComponentException e)
        {
            Debug.LogError("Missing a player ammo in the root transform!!");
        }
        weaponSwitch = transform.root.GetComponent <WeaponSwitch>();
    }
Esempio n. 17
0
 // Use this for initialization
 void Start()
 {
     text         = GetComponent <Text>();
     weaponSwitch = transform.root.GetComponent <WeaponSwitch>();
     playerAmmo   = weaponSwitch.GetComponent <PlayerAmmo>();
 }
Esempio n. 18
0
 public new void Start()
 {
     base.Start ();
     playerAmmo = player.GetComponent<PlayerAmmo> ();
 }
Esempio n. 19
0
 new public void Start()
 {
     base.Start();
     playerAmmo = player.GetComponent <PlayerAmmo> ();
 }
Esempio n. 20
0
 void Start()
 {
     _ammo       = FindObjectOfType <PlayerAmmo>();
     _viewCamera = GameObject.Find("HeadCamera").GetComponent <UnityEngine.Camera>();
 }
Esempio n. 21
0
 // Find gameobjects
 void Start()
 {
     weaponControl = GameObject.Find("ActiveWeapon").GetComponent <WeaponControl>();
     playerAmmo    = GameObject.Find("AmmoCount").GetComponent <PlayerAmmo>();
     shootSound    = GetComponent <AudioSource>();
 }