-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpickUpAmmo.cs
More file actions
29 lines (22 loc) · 776 Bytes
/
pickUpAmmo.cs
File metadata and controls
29 lines (22 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class pickUpAmmo : MonoBehaviour
{
private GameObject thePlayer;
private IDictionary<string, int> ammos;
void Start()
{
}
void OnTriggerEnter2D(Collider2D other)
{
Debug.Log("entered");
thePlayer= GameObject.FindGameObjectWithTag("Player");
if(other.gameObject.CompareTag("ammo")){
other.gameObject.SetActive(false);
ammos = thePlayer.GetComponent<PLayerController> ().ammoCounts;
ammos[other.gameObject.name] = ammos[other.gameObject.name] + 1;
Debug.Log(ammos[other.gameObject.name]);
}
}
}