public Coroutine _CharAnimateTurn(GroundChar ch, Dir8 direction, int framedur, bool ccw) { if (ch == null || direction == Dir8.None) { return(new Coroutine(LuaEngine._DummyWait())); } return(new Coroutine(_DoAnimatedTurn(ch, _CountDirectionDifference(ch.CharDir, direction), framedur, ccw))); }
public Coroutine _CharTurnToCharAnimated(GroundChar curch, GroundChar turnto, int framedur) { if (curch == null || turnto == null) { return(new Coroutine(LuaEngine._DummyWait())); } return(new Coroutine(_DoAnimatedTurn(curch, _CountDirectionDifference(curch.CharDir, turnto.CharDir.Reverse()), framedur))); }
public Coroutine _CharAnimateTurnTo(GroundChar ch, Dir8 direction, int framedur) { if (ch == null || direction == Dir8.None) { return(new Coroutine(LuaEngine._DummyWait())); } int turn = _CountDirectionDifference(ch.CharDir, direction); return(new Coroutine(_DoAnimatedTurn(ch, turn, framedur, turn < 0))); }
public Coroutine _CharTurnToCharAnimated(GroundChar curch, GroundChar turnto, int framedur) { if (curch == null || turnto == null) { return(new Coroutine(LuaEngine._DummyWait())); } Dir8 destDir = DirExt.ApproximateDir8(turnto.MapLoc - curch.MapLoc); if (destDir == Dir8.None) { destDir = turnto.CharDir.Reverse(); } int turn = _CountDirectionDifference(curch.CharDir, destDir); return(new Coroutine(_DoAnimatedTurn(curch, turn, framedur, turn < 0))); }
/// <summary> /// Helper function to invoke the Wait() function of the current task of the specified entity. /// </summary> /// <param name="ent">Entity which task we'll wait on.</param> /// <returns></returns> public Coroutine _WaitEntityTask(GroundEntity ent) { try { if (ent.GetType().IsSubclassOf(typeof(BaseTaskUser))) { BaseTaskUser tu = (BaseTaskUser)ent; if (tu.CurrentTask() != null) { return(tu.CurrentTask().Wait()); } } } catch (Exception ex) { DiagManager.Instance.LogInfo(String.Format("ScriptTask._WaitEntityTask(): Got exception :\n{0}", ex.Message)); } return(new Coroutine(LuaEngine._DummyWait())); }
/// <summary> /// Same as StartEntityTask, but this one blocks until the task is set /// </summary> /// <param name="ent"></param> /// <param name="fn"></param> public Coroutine _WaitStartEntityTask(GroundEntity ent, LuaFunction fn) { try { if (ent == null || fn == null) { DiagManager.Instance.LogInfo(String.Format("ScriptTask._WaitStartEntityTask(): Got null entity or function pointer!")); } if (ent.GetType().IsSubclassOf(typeof(BaseTaskUser))) { BaseTaskUser tu = (BaseTaskUser)ent; return(new Coroutine(tu.WaitSetTask(new GroundScriptedTask(fn)))); } } catch (Exception ex) { DiagManager.Instance.LogInfo(String.Format("ScriptTask._WaitStartEntityTask(): Got exception :\n{0}", ex.Message)); } return(new Coroutine(LuaEngine._DummyWait())); }