64 lines
No EOL
1.5 KiB
C#
64 lines
No EOL
1.5 KiB
C#
using UnityEngine;
|
|
using System;
|
|
|
|
[Serializable]
|
|
public class Render
|
|
{
|
|
Monolith mono;
|
|
|
|
public void Start(Monolith mono)
|
|
{
|
|
this.mono = mono;
|
|
}
|
|
|
|
public Mesh meshCube, meshSphere, meshGlobe, meshMissile;
|
|
public Material matDefault;
|
|
|
|
Matrix4x4 globeM4 = new Matrix4x4();
|
|
Matrix4x4 mainConM4 = new Matrix4x4();
|
|
Matrix4x4 cursorM4 = new Matrix4x4();
|
|
public void Update()
|
|
{
|
|
globeM4.SetTRS(
|
|
mono.globePos,
|
|
Quaternion.identity,
|
|
Vector3.one * mono.radius
|
|
); Graphics.DrawMesh(meshGlobe, globeM4, matDefault, 0);
|
|
|
|
for (int i = 0; i < mono.landChunks.Length; i++)
|
|
{
|
|
Vector3 pos = mono.globePos + mono.landChunks[i] * Vector3.forward * mono.radius;
|
|
|
|
// Graphics.DrawMesh(meshCube, pos, mono.landChunks[i], matDefault, 0);
|
|
}
|
|
|
|
mainConM4.SetTRS(
|
|
mono.rig.mainConPos,
|
|
mono.rig.mainConRot,
|
|
Vector3.one * 0.1f
|
|
); Graphics.DrawMesh(meshCube, mainConM4, matDefault, 0);
|
|
|
|
cursorM4.SetTRS(
|
|
mono.rig.cursor,
|
|
mono.rig.headsetRot,
|
|
Vector3.one * 0.1f
|
|
); Graphics.DrawMesh(meshCube, cursorM4, matDefault, 0);
|
|
|
|
|
|
|
|
for (int i = 0; i < mono.missiles.Length; i++)
|
|
{
|
|
Missile missile = mono.missiles[i];
|
|
|
|
if (missile.active)
|
|
{
|
|
Graphics.DrawMesh(meshCube,
|
|
mono.globePos + missile.from * Vector3.forward * mono.radius,
|
|
missile.from.normalized, matDefault, 0
|
|
);
|
|
|
|
Graphics.DrawMesh(meshMissile, missile.pos, missile.current, matDefault, 0);
|
|
}
|
|
}
|
|
}
|
|
} |