You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.2 KiB
80 lines
2.2 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public partial class GameModule
|
|
{
|
|
private readonly UniQuake uq;
|
|
|
|
public GameModule(UniQuake uniQuake)
|
|
{
|
|
uq = uniQuake;
|
|
BuildCallbacks();
|
|
}
|
|
|
|
private void SetEntityModel(int entityNum, string modelName)
|
|
{
|
|
if (string.IsNullOrEmpty(modelName))
|
|
{
|
|
uq.GameState.GetEntity(entityNum).ClearModel();
|
|
return;
|
|
}
|
|
|
|
if (modelName.StartsWith("*"))
|
|
{
|
|
if (!int.TryParse(modelName.Substring(1), out int subModelNum))
|
|
{
|
|
Debug.LogWarning($"Invalid world sub-model index: {modelName}");
|
|
return;
|
|
}
|
|
|
|
uq.GameState.SetEntityWorldModel(entityNum, subModelNum);
|
|
return;
|
|
}
|
|
|
|
if (modelName.EndsWith(".bsp"))
|
|
{
|
|
uq.GameState.SetEntityBrushModel(entityNum, modelName);
|
|
return;
|
|
}
|
|
|
|
if (modelName.EndsWith(".spr"))
|
|
{
|
|
// TODO: sprite
|
|
uq.GameState.GetEntity(entityNum).ClearModel();
|
|
return;
|
|
}
|
|
|
|
uq.GameState.SetEntityAliasModel(entityNum, modelName);
|
|
}
|
|
|
|
private void SetEntityTransform(int entityNum, QVec3 origin, QVec3 angles)
|
|
{
|
|
uq.GameState.GetEntity(entityNum).SetTransform(origin.ToUnityPosition(), angles.ToUnityRotation());
|
|
}
|
|
|
|
private void RemoveEntity(int entityNum)
|
|
{
|
|
uq.GameState.RemoveEntity(entityNum);
|
|
}
|
|
|
|
private void UpdateEntityAnimation(int entityNum, int pose1, int pose2, float blend)
|
|
{
|
|
uq.GameState.GetEntity(entityNum).UpdateAnimation(pose1, pose2, blend);
|
|
}
|
|
|
|
private void SetEntitySkin(int entityNum, int skinNum)
|
|
{
|
|
uq.GameState.GetEntity(entityNum).SetSkin(skinNum);
|
|
}
|
|
|
|
private void RunParticleEffect(Vector3 position, Vector3 direction, Color colorMin, Color colorMax, int count)
|
|
{
|
|
uq.CurrentStyle.Particles.RunParticleEffect(position, direction, colorMin,colorMax, count, uq.GameLayer);
|
|
}
|
|
|
|
private void ParticleExplosion(Vector3 position)
|
|
{
|
|
uq.CurrentStyle.Particles.CreateExplosion(position, uq.GameLayer);
|
|
}
|
|
}
|