MOD: Zweite variante an Gegnern
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
public abstract class BasicenemyBaseState
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f4c4008ca80ef14f896f45f81438010
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class BasicEnemyMovingState: IState
|
||||
{
|
||||
public void OnEnter(BasicEnemyStateController sc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void UpdateState(BasicEnemyStateController sc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnExit(BasicEnemyStateController sc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58629341ddd353743ae4cc1cd1832d73
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class BasicEnemyPatrolState : IState
|
||||
{
|
||||
|
||||
public void OnEnter(BasicEnemyStateController sc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void UpdateState(BasicEnemyStateController sc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnExit(BasicEnemyStateController sc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4968fa0b37ab5344595f0618dc33c8db
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class BasicEnemyShootingState : IState
|
||||
{
|
||||
|
||||
public void OnEnter(BasicEnemyStateController sc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void UpdateState(BasicEnemyStateController sc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnExit(BasicEnemyStateController sc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53a5e863180374d4c941d8d393df2be2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BasicEnemyStateController : MonoBehaviour
|
||||
{
|
||||
IState currentState;
|
||||
BasicenemyBaseState currentStatee;
|
||||
public BasicEnemyPatrolState patrolState = new BasicEnemyPatrolState();
|
||||
public BasicEnemyMovingState movingState = new BasicEnemyMovingState();
|
||||
public BasicEnemyShootingState ShootingState = new BasicEnemyShootingState();
|
||||
|
||||
private void Start()
|
||||
{
|
||||
ChangeState(patrolState);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if(currentState != null)
|
||||
{
|
||||
currentState.UpdateState(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeState(IState newState)
|
||||
{
|
||||
if(currentState != null)
|
||||
{
|
||||
currentState.OnExit(this);
|
||||
}
|
||||
currentState = newState;
|
||||
currentState.OnEnter(this);
|
||||
}
|
||||
}
|
||||
|
||||
public interface IState
|
||||
{
|
||||
public void OnEnter(BasicEnemyStateController controller);
|
||||
public void UpdateState(BasicEnemyStateController controller);
|
||||
public void OnExit(BasicEnemyStateController controller);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 89c349a0b8dd3744ca4a6a956c37a102
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user