コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     if (!isDead)
     {
         //loncat
         if (Input.GetMouseButtonDown(0))
         {
             Jump();
         }
         //nembak
         if (Input.GetKeyUp(KeyCode.Space) && ammo > 0 && ammoSpawner != null)
         {
             ammo--;
             ammoSpawner.SpawnAmmo();
         }
     }
 }
コード例 #2
0
    void OnTriggerEnter2D(Collider2D target)
    {
        if (target.gameObject.tag == "Player")
        {
            if (ammoSound)
            {
                AudioSource.PlayClipAtPoint(ammoSound, transform.position);
            }

            AmmoManager.ammoCount += addAmmo;

            // Trigger a new delivery.
            ammoSpawner.StartCoroutine(ammoSpawner.SpawnAmmo());

            Destroy(transform.root.gameObject);
        }
    }