private void Awake() { mover = GetComponent <Mover>(); actionSchedule = GetComponent <ActionSchedule>(); animator = GetComponent <Animator>(); baseStats = GetComponent <BaseStats>(); }
public static bool SaveActionSchedule(ActionSchedule schedule) { var successfullySaved = false; var schedules = GetActionSchedules(schedule.AppName); var existingSchedule = schedules.FirstOrDefault(s => s.ActionName == schedule.ActionName); if (existingSchedule != null) { //delete existing schedule schedules.Remove(existingSchedule); } schedules.Add(schedule); var filePath = GetFilePath(schedule.AppName); if (filePath != null) { var json = JsonConvert.SerializeObject(schedules, Formatting.Indented); File.WriteAllText(filePath, json); successfullySaved = true; } //todo: return false if anything goes wrong return(successfullySaved); }
void Awake() { navMeshAgent = GetComponent <NavMeshAgent>(); animator = GetComponent <Animator>(); actionSchedule = GetComponent <ActionSchedule>(); health = GetComponent <Health>(); }
private void Awake() { player = GameObject.FindGameObjectWithTag("Player"); fighter = GetComponent <Fighter>(); health = GetComponent <Health>(); mover = GetComponent <Mover>(); actionSchedule = GetComponent <ActionSchedule>(); }
private void Awake() { mover = GetComponent <Mover>(); fighter = GetComponent <Fighter>(); health = GetComponent <Health>(); actionSchedule = GetComponent <ActionSchedule>(); player = GameObject.FindWithTag("Player"); guardPosition = new LazyValue <Vector3>(GetGuardPosition); }
/// <summary> /// 行動できるプレイヤーを次に進める /// </summary> private void IncrementTurn() { if (NoEnqueue) { NoEnqueue = false; return; } ActionSchedule.Enqueue(ActionSchedule.Dequeue()); MatchInfo.NextPlayerID = ActionSchedule.Peek(); }
public ActionSchedule Create(ActionSchedule schedule) { if (schedule.ActionId == 0) { throw new ArgumentException("Action ID is missing."); } int accountId = schedule.AccountId > 0 ? schedule.AccountId : CurrentAccount; return(Create(accountId, schedule.ActionId, schedule)); }
public void Delete(ActionSchedule schedule) { if (schedule.ActionId == 0) { throw new ArgumentException("Action ID is missing."); } if (schedule.Id == 0) { throw new ArgumentException("Schedule ID is missing."); } int accountId = schedule.AccountId > 0 ? schedule.AccountId : CurrentAccount; Delete(accountId, schedule.ActionId, schedule.Id); }
private bool ShouldActionBeScheduled(ActionSchedule actionSchedule) { if (actionSchedule.NextRun == DateTime.MinValue) { return(false); } if (actionSchedule.StopDateTime == DateTime.MinValue) { return(true); } if (actionSchedule.StopDateTime > DateTime.UtcNow) { return(true); } return(false); }
public ActionTimer(ActionSchedule actionSchedule) { var state = new TimerState(actionSchedule); var dueTime = TimeSpan.FromSeconds(1); //one second if (actionSchedule.NextRun > DateTime.UtcNow) { dueTime = actionSchedule.NextRun - DateTime.UtcNow; } // Create a timer. The timer fires once, and gets a new due-time when the action has finished running. var timer = new Timer(RunScheduledAction, state, dueTime, TimeSpan.FromMilliseconds(-1)); //-1 disables periodic runs // Keep a handle to the timer, so it can be disposed. state.Timer = timer; }
/// <summary> /// 試合を開始する処理 /// </summary> public void Start() { MatchInfo.Turn++; MatchInfo.NextPlayerID = ActionSchedule.Peek(); }
public ActionSchedule Create(int actionId, ActionSchedule schedule) { int accountId = schedule.AccountId > 0 ? schedule.AccountId : CurrentAccount; return(Create(accountId, actionId, schedule)); }
public ActionSchedule Create(int accountId, int actionId, ActionSchedule schedule) { var rval = TDClient.Add(LIST, new { accountId, actionId }, schedule); return(rval); }
public TimerState(ActionSchedule actionSchedule) { Counter = 0; IsRunning = false; ActionSchedule = actionSchedule; }
public ActionSchedule Create(int accountId, int actionId, ActionSchedule schedule) { return(Api.Post($"/account/{accountId}/action/{actionId}/schedule", schedule)); }
public ActionSchedule Update(int accountId, int actionId, int scheduleId, ActionSchedule schedule) { var rval = TDClient.Update(ITEM, new { accountId, actionId, scheduleId }, schedule); return(rval); }
public ActionSchedule Update(int accountId, int actionId, int scheduleId, ActionSchedule schedule) { return(Api.Put($"/account/{accountId}/action/{actionId}/schedule/{scheduleId}", schedule)); }
public ActionSchedule Update(int actionId, int scheduleId, ActionSchedule schedule) { return(Update(CurrentAccount, actionId, scheduleId, schedule)); }
public Timer(int time) { _timeGeneral = time; _schedule = new ActionSchedule(this); }