void Update() { currentState = GetComponent <ObjectState>().currentState; distanceToPlayer = (Vector3.Distance(GameManager.Player.transform.position, transform.position)); if (explodable) { if (selfDestruct) { currentSelfDestructTime += Time.deltaTime; color = Color.Lerp(defaultColor, Color.red, currentSelfDestructTime / selfDestructTime); renderer.material.SetColor("_Color", color); if (currentSelfDestructTime >= selfDestructTime) { SelfDestruct(); } } } }
public void SetCubeState(ObjectState.ObjectStates state) { GetComponent <ObjectState>().currentState = state; }