protected override void OnSetUnitData(UnitData unitData) { base.OnSetUnitData(unitData); // When the tower's unit data is set, set the material to the first object in it's UpgradPath data. NativeEntity.SetMaterial(CurrentTower.Material); }
public void SetUnitData(UnitData unitData) { UnitData = unitData; Health.SetMaxHealth(unitData.MaxHealth); Health.SetHealth(unitData.MaxHealth); NativeEntity.LoadGeometry(0, unitData.Mesh); NativeEntity.SetMaterial(unitData.Material); OnSetUnitData(unitData); }
// GameObject core; public override void OnInitialize() { base.OnInitialize(); Health = new Health(); NativeEntity.LoadGeometry(0, AssetLibrary.Meshes.BasePlate); NativeEntity.SetMaterial(AssetLibrary.Materials.BasePlate); NativeEntity.LoadGeometry(1, AssetLibrary.Meshes.Diamond); NativeEntity.SetSlotMaterial(1, AssetLibrary.Materials.BaseCore); NativeEntity.SetSlotLocalTM(1, Matrix34.Create(Vec3.One, Quat.Identity, new Vec3(0, 0, 2f))); }
public override void OnInitialize() { base.OnInitialize(); // Load default geometry. NativeEntity.LoadGeometry(0, "objects/default/primitive_sphere.cgf"); // Load default material. NativeEntity.SetMaterial("materials/matref_chrome128.mtl"); // Physicalize. Physics.Physicalize(10, EPhysicalizationType.ePT_Rigid); }
/// <summary> /// Upgrades the tower if another upgrade is available. /// </summary> public void Upgrade() { if (NextTower != null) { NativeEntity.SetMaterial(NextTower.Material); SetupWeapon(); Level++; } else { Log.Warning("Cannot Upgrade unit because there is no upgrade path!"); } }