1
This commit is contained in:
33
Assets/Artists/Scripts/Entities/GameMode/EntitySpawnPoint.cs
Normal file
33
Assets/Artists/Scripts/Entities/GameMode/EntitySpawnPoint.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITFALL.Scene;
|
||||
using BITKit;
|
||||
using BITKit.Entities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITFALL.Entities.GameMode
|
||||
{
|
||||
public class EntitySpawnPoint : EntityBehavior
|
||||
{
|
||||
[SerializeReference, SubclassSelector, Inject]
|
||||
private ISpawnPointService _spawnPointService;
|
||||
|
||||
[Inject] private IEntityMovement _movement;
|
||||
public override void OnStart()
|
||||
{
|
||||
base.OnStart();
|
||||
try
|
||||
{
|
||||
Matrix4x4 spawnPoint = _spawnPointService.RequestSpawnPoint();
|
||||
_movement.Position = spawnPoint.GetPosition();
|
||||
_movement.Rotation = spawnPoint.rotation;
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user