forked from cgvr/DeltaVR
refactored model generation code out of test box into separate pipeline manager
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
using System;
|
||||
using _PROJECT.Scripts.Bow;
|
||||
using _PROJECT.Scripts.Bow.Extra;
|
||||
using FishNet.Object;
|
||||
using FishNet.Object.Synchronizing;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class ArcheryTarget : NetworkBehaviour, IArrowHittable
|
||||
{
|
||||
@@ -13,12 +10,10 @@ public class ArcheryTarget : NetworkBehaviour, IArrowHittable
|
||||
public Vector3 endPosition;
|
||||
public float forwardSpeed = 2f;
|
||||
public Action<float> addScore;
|
||||
|
||||
private bool _flipDirection;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_flipDirection = Random.value > 0.5f;
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -28,11 +23,12 @@ public class ArcheryTarget : NetworkBehaviour, IArrowHittable
|
||||
float step = forwardSpeed * Time.deltaTime;
|
||||
var position = transform.position;
|
||||
|
||||
if (Math.Abs(position.x - endPosition.x) < 0.1) Destroy(gameObject);
|
||||
if (Math.Abs(position.x - endPosition.x) < 0.1)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
|
||||
transform.position = Vector3.MoveTowards(position,
|
||||
new Vector3(endPosition.x, position.y, position.z), step);
|
||||
transform.position = Vector3.MoveTowards(position, new Vector3(endPosition.x, position.y, position.z), step);
|
||||
}
|
||||
|
||||
public void Hit(Arrow arrow)
|
||||
|
||||
Reference in New Issue
Block a user