temporary files rename
This commit is contained in:
parent
8e077e523c
commit
a87f0ed109
823 changed files with 20 additions and 5 deletions
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[RequireComponent(typeof(MinecraftUnit))]
|
||||
[RequireComponent(typeof(MovementHandler))]
|
||||
public abstract class AbstractBehaviour : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float pathFps = 1.0f;
|
||||
[SerializeField] protected float distanceGoal = 0.0f;
|
||||
|
||||
protected abstract void MoveAction();
|
||||
|
||||
protected MinecraftUnit CurrentMinecraftUnit;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
CurrentMinecraftUnit = GetComponent<MinecraftUnit>();
|
||||
StartCoroutine(pathUpdate());
|
||||
}
|
||||
|
||||
private IEnumerator pathUpdate()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
MoveAction();
|
||||
yield return new WaitForSeconds(1.0f/pathFps);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bca22bdff905462e49dd5f0d224452c6
|
|
@ -0,0 +1,23 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class DefensiveBehaviour : AbstractBehaviour
|
||||
{
|
||||
protected override void MoveAction()
|
||||
{
|
||||
if (CurrentMinecraftUnit.IsTeamA)
|
||||
{
|
||||
if (GlobalsVariable.QueenA != null) return;
|
||||
CurrentMinecraftUnit.MovementHandler.UpdateNearestFrom(GlobalsVariable.QueenA.transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GlobalsVariable.QueenB != null) return;
|
||||
CurrentMinecraftUnit.MovementHandler.UpdateNearestFrom(GlobalsVariable.QueenB.transform);
|
||||
}
|
||||
|
||||
Vector3 targetPos = CurrentMinecraftUnit.MovementHandler.TargetUnit.transform.position;
|
||||
Vector3 goalPos = targetPos + (transform.position - targetPos).normalized * distanceGoal;
|
||||
CurrentMinecraftUnit.MovementHandler.MoveTowards(goalPos);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4d7eb557429d0c73b8e60870d6370ff6
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class NeutralBehaviour : AbstractBehaviour
|
||||
{
|
||||
protected override void MoveAction()
|
||||
{
|
||||
if (CurrentMinecraftUnit.IsTeamA)
|
||||
{
|
||||
if (GlobalsVariable.AliveUnitsTeamB.Count == 0) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GlobalsVariable.AliveUnitsTeamA.Count == 0) return;
|
||||
}
|
||||
CurrentMinecraftUnit.MovementHandler.UpdateNearest();
|
||||
AbstractUnit targetUnit = CurrentMinecraftUnit.MovementHandler.TargetUnit;
|
||||
if (targetUnit == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Vector3 targetPos = targetUnit.transform.position;
|
||||
Vector3 goalPos = targetPos + (transform.position - targetPos).normalized * distanceGoal;
|
||||
CurrentMinecraftUnit.MovementHandler.MoveTowards(goalPos);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 794f919ac24609c05b9c690aaab19146
|
|
@ -0,0 +1,22 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class OffensiveBehaviour : AbstractBehaviour
|
||||
{
|
||||
protected override void MoveAction()
|
||||
{
|
||||
if (CurrentMinecraftUnit.IsTeamA)
|
||||
{
|
||||
if (GlobalsVariable.QueenB == null) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GlobalsVariable.QueenA == null) return;
|
||||
}
|
||||
|
||||
CurrentMinecraftUnit.MovementHandler.TargetUnit = GlobalsVariable.QueenB;
|
||||
Vector3 targetPos = CurrentMinecraftUnit.MovementHandler.TargetUnit.transform.position;
|
||||
Vector3 goalPos = targetPos + (transform.position - targetPos).normalized * distanceGoal;
|
||||
CurrentMinecraftUnit.MovementHandler.MoveTowards(goalPos);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 02c5dcee842138a4ab3b5db250170c31
|
Loading…
Add table
Add a link
Reference in a new issue