Scriptum/Assets/Scripts/Enemies' Scprits/Enemy.cs
kabix09 35ed59b247 Thugs - behaviour fix
Use pathfinding algorithm
2023-01-04 21:23:02 +01:00

45 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBehaviour
{
public float moveSpeed;
public string enemyName; // var for name (must be unique (playerPrefs.set/get string "enemyName - s")
public FloatValue maxHealth;
public float health;
public float baseAttack;
public int isKilled;
public string MinionName; // var used for multiplied name - for mission poroggress (kill condition)
private void Awake()
{
health = maxHealth.initialValue;
}
//TODO
/* public void Start()
{
enemyName = gameObject.name; //Objects Enemy will be created with an assigned name
}*/
public void TakeDamage(float damage)
{
health -= damage;
if (health <= 0)
{
this.gameObject.SetActive(false);
}
}
public void SaveCheckpoint()
{
PlayerPrefs.SetInt(enemyName + "-S", isKilled);
PlayerPrefs.SetFloat(enemyName + "-S.health", health);
}
}