using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DemonController : MonoBehaviour
{
public int damage = -1;
public GameObject effect;
public GameObject sound;
private Animator anim, Damage;
public float speed;
using System.Collections.Generic;
using UnityEngine;
public class DemonController : MonoBehaviour
{
public int damage = -1;
public GameObject effect;
public GameObject sound;
private Animator anim, Damage;
public float speed;
private void Update()
{
transform.Translate(Vector2.left * speed );
}
private void Start()
{
Damage = GameObject.FindGameObjectWithTag("Player").GetComponent();
anim = GameObject.FindGameObjectWithTag("MainCamera").GetComponent();
}
private void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Player"))
{
Damage.SetTrigger("Damage");
anim.SetTrigger("Shake");
Instantiate(sound, transform.position, Quaternion.identity);
Instantiate(effect, transform.position, Quaternion.identity);
other.GetComponent().health += damage;
Destroy(gameObject);
}
}
Вот код, куда ставить deltaTime?