merge
This commit is contained in:
@@ -30,7 +30,7 @@ public class SlimeAI : MonoBehaviour
|
||||
animator = GetComponent<Animator>();
|
||||
player = GameObject.FindWithTag("Player");
|
||||
HP = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -75,7 +75,7 @@ public class SlimeAI : MonoBehaviour
|
||||
animator.SetBool("EnemyInAggroRange", false);
|
||||
animator.SetBool("EnemyInVisionRange", false);
|
||||
}
|
||||
|
||||
|
||||
if (!isWandering)
|
||||
{
|
||||
//Idle
|
||||
@@ -99,8 +99,8 @@ public class SlimeAI : MonoBehaviour
|
||||
animator.SetBool("Wandering", true);
|
||||
transform.position += transform.forward * moveSpeed * Time.deltaTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
void Rotate()
|
||||
@@ -144,6 +144,29 @@ public class SlimeAI : MonoBehaviour
|
||||
//do attack e.g check for player in range/hit collider
|
||||
}
|
||||
|
||||
void Attack()
|
||||
{
|
||||
if (!isAttacking)
|
||||
{
|
||||
isAttacking = true;
|
||||
attackStartTime = Time.time;
|
||||
StartCoroutine(DelayedAttack());
|
||||
}
|
||||
else if (Time.time - attackStartTime > 0.833)
|
||||
{
|
||||
isAttacking = false;
|
||||
attackStartTime = 0.0f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IEnumerator DelayedAttack()
|
||||
{
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
Debug.Log("Attack");
|
||||
//do attack e.g check for player in range/hit collider
|
||||
}
|
||||
|
||||
IEnumerator Wander()
|
||||
{
|
||||
int rotTime = Random.Range(1, 3);
|
||||
@@ -174,4 +197,4 @@ public class SlimeAI : MonoBehaviour
|
||||
isWandering = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
34
Assets/Project Files/Scripts/JonasB/LootTable.cs
Normal file
34
Assets/Project Files/Scripts/JonasB/LootTable.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class LootTable : MonoBehaviour
|
||||
{
|
||||
public List<GameObject> specialLootItems;
|
||||
public List<GameObject> defaultLootItems;
|
||||
|
||||
|
||||
public void SpawnLoot() {
|
||||
float r = Random.value;
|
||||
Debug.LogWarning(r);
|
||||
Vector3 spawnLocation = this.transform.position;
|
||||
spawnLocation.y += 3;
|
||||
|
||||
if ( r > 0.50) //%50 percent chance -> special loot chance + default loot
|
||||
{
|
||||
int specialloot = Random.Range(0, specialLootItems.Count);
|
||||
int defaultloot = Random.Range(0, defaultLootItems.Count);
|
||||
Debug.LogWarning("special loot spawned");
|
||||
Instantiate(specialLootItems[specialloot], spawnLocation, Quaternion.identity);
|
||||
Instantiate(defaultLootItems[defaultloot], spawnLocation, Quaternion.identity);
|
||||
}
|
||||
|
||||
if (r > 0.2) //%80 percent chance -> default loot chance loot chance
|
||||
{
|
||||
Debug.LogWarning("default loot spawned");
|
||||
int defaultloot = Random.Range(0, defaultLootItems.Count);
|
||||
Instantiate(defaultLootItems[defaultloot], this.transform);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Project Files/Scripts/JonasB/LootTable.cs.meta
Normal file
11
Assets/Project Files/Scripts/JonasB/LootTable.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a29d148fe20acce4c9eb0eae410c0fd1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -31,6 +31,10 @@ public class Projectile : MonoBehaviour
|
||||
if (collision.gameObject.tag != "IceBolt" && collision.gameObject.tag != "Player" && !collided)
|
||||
{
|
||||
collided = true;
|
||||
if (collision.gameObject.tag == "Slime")
|
||||
{
|
||||
collision.gameObject.GetComponent<SlimeAI>().GetHit((int)damage);
|
||||
}
|
||||
if (collision.gameObject.name == "Dummy") Destroy(collision.gameObject); //REPLACE WITH ENEMY TAG CHECK AND DAMAGE CHECKING
|
||||
Destroy(gameObject);
|
||||
}
|
||||
@@ -44,10 +48,11 @@ public class Projectile : MonoBehaviour
|
||||
collided = true;
|
||||
Destroy(gameObject);
|
||||
}
|
||||
else if (other.gameObject.name == "Dummy")
|
||||
if (other.gameObject.name == "Dummy")
|
||||
{
|
||||
Destroy(other.gameObject);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class PlayerInfo : MonoBehaviour
|
||||
{
|
||||
Instance = this;
|
||||
health = 5;
|
||||
essence_basic = 0;
|
||||
essence_basic = 1000;
|
||||
rightHandHeld = null;
|
||||
leftHandHeld = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user