bool AIFunction() { Vector3 direction = player.position - _transform.position; if (direction.sqrMagnitude < attackRange){ FindClosestSafe(); if (seenAround){ if(safePlace!=null){ Vector3 a = safePlace.position - _transform.position; Vector3 b = player.position - _transform.position; if(a.sqrMagnitude < b.sqrMagnitude){ delFunc = this.TakeCover; }else{ delFunc = this.Attack; } }else{ delFunc = this.Attack; } return true; } else{ if (Vector3.Dot(direction.normalized, _transform.forward) > 0 && !Physics.Linecast(_eyes.position, player.position, layerMask)){ delFunc = this.Attack; seenAround = true; return true; } return false; } }else{ delFunc = this.Walk; seenAround = false; return false; } }
public ClickCounter(DispatcherTimer clickTimer, DelFunc func = null) { _clickTimer = clickTimer; _clickTimer.Tick += new EventHandler(_clickTimer_Tick); _funcForElipsed = func; }
public TimerHelper(DispatcherTimer timer, DelFunc func = null) { _timer = timer; _timer.Tick += new EventHandler(_timer_Tick); _funcForElipsed = func; }
public void AddDataRow(Boolean refreshNow, double height, Boolean relativeObjInclude, object relativeObj, params object[] values) { if (values == null || values.Length == 0) { return; } if (values != null && values[0] is object[]) { values = values[0] as object[]; } if (values != null && values[0] is List <object> ) { values = (values[0] as List <object>).ToArray(); } ad_height = height; ad_relativeObj = relativeObj; ad_values = values; DelFunc func = AddDataRowInvoke; // try { VerifyAccess(); //if(refreshNow) _tempNewList.Clear(); AddDataRowInvoke(); if (refreshNow) { RefreshList(); } } // catch { // this.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(func)); } }
public ClickCounter(int interval, UIElement parent, DelFunc func = null, DispatcherPriority priority = DispatcherPriority.Normal) { _clickTimer = new DispatcherTimer(priority, parent.Dispatcher); _clickTimer.Interval = new TimeSpan(interval * 10000); _clickTimer.Tick += new EventHandler(_clickTimer_Tick); _funcForElipsed = func; }
void _clickCounter_OnCountedClick(CountedClickEventArgs e) { DelFunc func = OnClick; clickArg = e; Dispatcher.Invoke(DispatcherPriority.Normal, new Action(func)); }
internal void ThreadRun(DelFunc method, int time, string name) { DelFunc del = method; RunHandle handle = new RunHandle(del, time, name); ParameterizedThreadStart pts = new ParameterizedThreadStart(Run); Thread thread = new Thread(pts); thread.Name = name; thread.Start(handle); }
public static void BeginInvoke(Form frm, DelFunc del) { if (frm.InvokeRequired) { frm.BeginInvoke(del); } else { del(); } }
// endregion // region AI function bool AIFunction() { Vector3 direction = player.position - _transform.position; if (direction.sqrMagnitude < attackRange){ if (seenAround){ delFunc = this.Attack; return true; } else{ if (Vector3.Dot(direction.normalized, _transform.forward) > 0 && !Physics.Linecast(_eyes.position, player.position, layerMask)){ delFunc = this.Attack; seenAround = true; return true; } return false; } }else{ delFunc = this.Walk; seenAround = false; return false; } }
void Start() { _controller = GetComponent<CharacterController>(); _transform = GetComponent<Transform>(); _eyes = transform.Find ("Eyes"); player = GameObject.Find("Player").GetComponent<Transform>(); if (player == null) Debug.LogError("No player on scene"); if (string.IsNullOrEmpty(strTag)) Debug.LogError("No waypoint tag given"); index = 0; range = 2.5f; attackRange = 200f; GameObject[] gos = GameObject.FindGameObjectsWithTag(strTag); foreach (GameObject go in gos) { WaypointScript script = go.GetComponent<WaypointScript>(); waypoint.Add(script.index, go.transform); } GetComponent<Animation>()["victory"].wrapMode = WrapMode.Once; delFunc = this.Walk; delEnum = null; del = true; isCorouting = false; seenAround = false; layerMask = ~layerMask; }
internal RunHandle(DelFunc del, int time, string name) { del_func = del; sleep_time = time; thread_name = name; }
static void Main(string[] args) { DelFunc df = new DelFunc(Func2); df(); }