added target
This commit is contained in:
parent
dd7a3f63cc
commit
9980435c44
File diff suppressed because it is too large
Load Diff
33
Assets/Scripts/Target.cs
Normal file
33
Assets/Scripts/Target.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Target : MonoBehaviour
|
||||
{
|
||||
public AudioClip target;
|
||||
public AudioSource sfx;
|
||||
public CircleCollider2D circ;
|
||||
public string nextScene;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
private void OnCollisionEnter2D (Collision2D collisionInfo)
|
||||
{
|
||||
if (collisionInfo.collider.name == "Player") {
|
||||
circ.enabled = false;
|
||||
sfx.clip = target;
|
||||
sfx.Play();
|
||||
SceneManager.LoadScene(nextScene);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Target.cs.meta
Normal file
11
Assets/Scripts/Target.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88e6c07a2eeb9c744849a1fbecd9b1b6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user