forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCameraSystem.cs
More file actions
24 lines (22 loc) · 716 Bytes
/
Copy pathCameraSystem.cs
File metadata and controls
24 lines (22 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using Unity.Burst;
using Unity.Entities;
using Unity.Mathematics;
using UnityEngine;
namespace Tutorials.Tornado
{
//[UpdateInGroup(typeof(FixedStepSimulationSystemGroup), OrderFirst = true)]
public partial struct CameraSystem : ISystem
{
[BurstCompile]
public void OnCreate(ref SystemState state)
{
state.RequireForUpdate<Config>();
}
public void OnUpdate(ref SystemState state)
{
var tornadoPosition = BuildingSystem.Position((float)SystemAPI.Time.ElapsedTime);
var cam = Camera.main.transform;
cam.position = new Vector3(tornadoPosition.x, 10f, tornadoPosition.y) - cam.forward * 60f;
}
}
}