Estoy trabajando en un prototipo de juego 2D plataforma, pero cuando aplico el script de muerte del gameObject "Player", me da error el script de cameraFollow.
A continuacion, les dejo los dos Scripts, y bueno ojalá me puedan ayudar con algun consejo.
Script Segumiento de Camara
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class cameraFollow2DPlatformer : MonoBehaviour {
public Transform target; //lo que la camara estara siguiendo
public float smoothing; //efecto dampening
Vector3 offset;
float lowY;
// Use this for initialization
void Start () {
offset = transform.position - target.position;
lowY = transform.position.y;
}
void FixedUpdate () {
Vector3 targetCamPos = target.position + offset; // donde sera ubicada la camara
transform.position = Vector3.Lerp (transform.position, targetCamPos, smoothing*Time.deltaTime);
if (transform.position.y < lowY)
transform.position = new Vector3 (transform.position.x, lowY, transform.position.z);
}
}
Script Salud del Jugador
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerHealth : MonoBehaviour {
public float fullHealth;
public GameObject deathFX;
float currentHealth;
PlayerController controlMovement;
// Use this for initialization
void Start () {
currentHealth = fullHealth;
controlMovement = GetComponent<PlayerController> ();
}
// Update is called once per frame
void Update () {
}
public void addDamage (float damage){
if (damage <= ) return;
currentHealth -= damage;
if