void UpdateActorsInheritScale() { var enumrableInterface = GameActors.GetType().GetInterface(typeof(IEnumerable).FullName, false); if (enumrableInterface != null) { int index = 0; foreach (var actorObj in (IEnumerable)GameActors) { var actor = actorObj as EngineNS.GamePlay.Component.IPlaceable; bool inheritScale; if (mInheritScale is EditorCommon.PropertyMultiValue) { inheritScale = (bool)((EditorCommon.PropertyMultiValue)mInheritScale).Values[index]; } else { inheritScale = System.Convert.ToBoolean(mInheritScale); } actor.Placement.InheritScale = inheritScale; index++; } } else { //var actor = GameActors as EngineNS.GamePlay.Actor.GActor; var actor = GameActors as EngineNS.GamePlay.Component.IPlaceable; actor.Placement.InheritScale = (bool)mInheritScale; } }
void UpdateScaleZ(float value) { var enumrableInterface = GameActors.GetType().GetInterface(typeof(IEnumerable).FullName, false); float ratio = 1; if (enumrableInterface != null) { int index = 0; foreach (var actorObj in (IEnumerable)GameActors) { var actor = actorObj as EngineNS.GamePlay.Component.IPlaceable; if (mScaleZ is EditorCommon.PropertyMultiValue) { if (LockXYZ) { ratio = value / (float)((EditorCommon.PropertyMultiValue)mScaleZ).Values[index]; } ((EditorCommon.PropertyMultiValue)mScaleZ).Values[index] = value; } else { if (LockXYZ) { ratio = value / System.Convert.ToSingle(mScaleZ); } mScaleZ = value; } if (mScaleY is EditorCommon.PropertyMultiValue) { ((EditorCommon.PropertyMultiValue)mScaleY).Values[index] = (float)((EditorCommon.PropertyMultiValue)mScaleY).Values[index] * ratio; } else { mScaleY = System.Convert.ToSingle(mScaleY) * ratio; } if (mScaleX is EditorCommon.PropertyMultiValue) { ((EditorCommon.PropertyMultiValue)mScaleX).Values[index] = (float)((EditorCommon.PropertyMultiValue)mScaleX).Values[index] * ratio; } else { mScaleX = System.Convert.ToSingle(mScaleX) * ratio; } index++; } } else { if (LockXYZ) { ratio = value / (float)mScaleZ; } mScaleZ = value; mScaleY = ratio * (float)mScaleY; mScaleX = ratio * (float)mScaleX; } }
public void AddSighting(GameActors.IDs actorModelID) { if (m_Sightings.Contains(actorModelID)) { return; } int turn = Session.Get.WorldTime.TurnCounter; m_Sightings.Add(actorModelID); AddEvent(turn, string.Format("Sighted first {0}.", GameActors.From(actorModelID).Name)); }
void UpdateActorsTranslation() { try { var enumrableInterface = GameActors.GetType().GetInterface(typeof(IEnumerable).FullName, false); if (enumrableInterface != null) { int index = 0; foreach (var actorObj in (IEnumerable)GameActors) { var actor = actorObj as EngineNS.GamePlay.Component.IPlaceable; float x, y, z; if (mPositionX is EditorCommon.PropertyMultiValue) { x = (float)((EditorCommon.PropertyMultiValue)mPositionX).Values[index]; } else { x = System.Convert.ToSingle(mPositionX); } if (mPositionY is EditorCommon.PropertyMultiValue) { y = (float)((EditorCommon.PropertyMultiValue)mPositionY).Values[index]; } else { y = System.Convert.ToSingle(mPositionY); } if (mPositionZ is EditorCommon.PropertyMultiValue) { z = (float)((EditorCommon.PropertyMultiValue)mPositionZ).Values[index]; } else { z = System.Convert.ToSingle(mPositionZ); } actor.Placement.Location = new EngineNS.Vector3(x, y, z); index++; } } else { //var actor = GameActors as EngineNS.GamePlay.Actor.GActor; var actor = GameActors as EngineNS.GamePlay.Component.IPlaceable; actor.Placement.Location = new EngineNS.Vector3(System.Convert.ToSingle(mPositionX), System.Convert.ToSingle(mPositionY), System.Convert.ToSingle(mPositionZ)); } } catch (System.Exception) { } }
public void AddKill(Actor victim, int turn) { GameActors.IDs id = victim.Model.ID; if (!m_FirstKills.ContainsKey(id)) { m_FirstKills[id] = turn; m_KillCounts[id] = 1; AddEvent(turn, string.Format("Killed first {0}.", GameActors.From(id).Name)); } else { m_KillCounts[id]++; } }
public void DescribeKills(TextFile textFile, string he_or_she /* XXX \todo calculate from m_Actor */) { if (0 >= m_KillCounts.Count) { textFile.Append(string.Format("{0} was a pacifist. Or too scared to fight.", he_or_she)); } else { foreach (var kill in m_KillCounts) { var model = GameActors.From(kill.Key); string str3 = kill.Value > 1 ? model.PluralName : model.Name; textFile.Append(string.Format("{0,4} {1}.", kill.Value, str3)); } } }
async Task UpdateActorsRotation() { await EngineNS.CEngine.Instance.EventPoster.Post(() => { mIsManual = true; return(true); }, EngineNS.Thread.Async.EAsyncTarget.Main); var delta = (float)(System.Math.PI / 180); var enumrableInterface = GameActors.GetType().GetInterface(typeof(IEnumerable).FullName, false); if (enumrableInterface != null) { int index = 0; foreach (var actorObj in (IEnumerable)GameActors) { var actor = actorObj as EngineNS.GamePlay.Component.IPlaceable; float yaw, pitch, roll; if (mRotationX is EditorCommon.PropertyMultiValue) { pitch = (((float)(((EditorCommon.PropertyMultiValue)mRotationX).Values[index]))) * delta; } else { pitch = (System.Convert.ToSingle(mRotationX)) * delta; } if (mRotationY is EditorCommon.PropertyMultiValue) { yaw = (((float)(((EditorCommon.PropertyMultiValue)mRotationY).Values[index]))) * delta; } else { yaw = (System.Convert.ToSingle(mRotationY)) * delta; } if (mRotationZ is EditorCommon.PropertyMultiValue) { roll = (((float)(((EditorCommon.PropertyMultiValue)mRotationZ).Values[index]))) * delta; } else { roll = (System.Convert.ToSingle(mRotationZ)) * delta; } actor.Placement.Rotation = EngineNS.Quaternion.RotationYawPitchRoll(yaw, pitch, roll); } } else { //var actor = GameActors as EngineNS.GamePlay.Actor.GActor; var actor = GameActors as EngineNS.GamePlay.Component.IPlaceable; actor.Placement.Rotation = EngineNS.Quaternion.RotationYawPitchRoll((System.Convert.ToSingle(mRotationY)) * delta, (System.Convert.ToSingle(mRotationX)) * delta, (System.Convert.ToSingle(mRotationZ)) * delta); var RotationAngle = GameActors as WPG.Themes.TypeEditors.TransformGradient.IRotationAngle; if (RotationAngle != null) { RotationAngle.YawPitchRoll = new EngineNS.Vector3(System.Convert.ToSingle(mRotationX), System.Convert.ToSingle(mRotationY), System.Convert.ToSingle(mRotationZ)); } } await EngineNS.CEngine.Instance.EventPoster.Post(() => { mIsManual = false; return(true); }, EngineNS.Thread.Async.EAsyncTarget.Main); }