void OnTriggerEnter(Collider collider) { if (collider.tag == "GiveBoxMelee" && GiveBoxes.Contains(collider) == false) { if (Body.isRagdoll == false && Body.entityStats.faction != collider.transform.root.GetComponent <EntityStats>().faction) { ActionObject giveAction = collider.transform.GetComponent <GiveBoxMelee>().currentAction; //add hit force Body.entRigBody.AddForce((Body.entRigBody.transform.position - collider.transform.position).normalized * giveAction.force, ForceMode.Impulse); Vector3 direction; direction = UnityEngine.Random.insideUnitCircle.normalized; Body.entRigBody.AddTorque(direction * 30, ForceMode.Impulse); GiveBoxes.Add(collider); //replace with status managers //get weapon stats from collider's givebox script, replace with status managers Damage = giveAction.giveStatuses[0].debuffValue; Body.damageToApply = Damage; Damage = 0; camShaker.shake = true; } } if (collider.tag == "GiveBoxProj" && GiveBoxes.Contains(collider) == false) { if (Body.isRagdoll == false) { GiveBoxProj giveBox = collider.transform.GetComponent <GiveBoxProj>(); //add hit force Body.entRigBody.AddForce((Body.entRigBody.transform.position - collider.transform.position).normalized * giveBox.currentAction.force, ForceMode.Impulse); Vector3 direction; direction = UnityEngine.Random.insideUnitCircle.normalized; Body.entRigBody.AddTorque(direction * 30, ForceMode.Impulse); GiveBoxes.Add(collider); //replace with status managers //get weapon stats from collider's givebox script, replace with status managers Damage = giveBox.currentAction.giveStatuses[0].debuffValue; Body.damageToApply = Damage; Damage = 0; // camShaker.shake = true; giveBox.disabled = true; giveBox.giveCollider.enabled = false; //collider.transform.root.GetComponent<BoxCollider>().enabled = false; collider.transform.root.position = new Vector3(transform.root.position.x, UnityEngine.Random.Range(0.4f, 0.5f), transform.root.position.z); Destroy(collider.transform.root.GetComponent <Rigidbody>()); collider.transform.root.parent = transform.root; } } }
private int createActionButtons() { int createdButtonCount = 0; ActionObject actionTable = Manager.Instance.DT.Action; int count = actionTable.Count; for (int id = 0; id < count; ++id) { if (_actionType != actionTable[id].type) { continue; } GameObject o = Instantiate(PrefActionButton); o.transform.SetParent(_content, false); ActionButton btn = o.GetComponent <ActionButton>(); btn.SetActionId(id); ++createdButtonCount; } return(createdButtonCount); }
/// <summary> /// 리스소 로드 후 생성. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="type"></param> /// <param name="path"></param> /// <param name="callback"></param> public void InstantiateResource <T>(ResourceType type, string path, ActionObject <T> callback) where T : Component { string fullPath = resourceTypeNameArray[(int)type] + "/" + path; Debug.Log("InstantiateResource : " + fullPath); StartCoroutine(InstantiateResourceCor(fullPath, callback)); }
public IEnumerator CreateResource <T>(GameObject prefab, ActionObject <T> callback) where T : Component { GameObject go = ObjectUtil.Instantiate(prefab) as GameObject; callback(go.GetComponent <T>()); yield return(null); }
public async override Task <bool> Show(InteractiveObject obj, bool lockTree) { if (obj is ActionObject actionObject) { if (actionObject.IsRobot()) { return(false); } else { if (await base.Show(obj, lockTree) && await SceneManager.Instance.SelectedRobot.WriteLock(false)) { lockedObjects.Add(SceneManager.Instance.SelectedRobot.GetInteractiveObject()); } else { return(false); } currentObject = actionObject; } } else { return(false); } await UpdateMenu(); EditorHelper.EnableCanvasGroup(CanvasGroup, true); RobotInfoMenu.Instance.Show(); return(true); }
void Shrink(ActionObject item1, ActionObject item2) { ShrinkHelper(item1); ShrinkHelper(item2); UpdateTime(); }
void ShrinkHelper(ActionObject item) { if (item.scale [0] > 0.5) { item.Grow(0.95f); } }
public async void RobotSteppingButtonClick() { if (!SceneManager.Instance.SceneStarted) { Notifications.Instance.ShowNotification("Failed to open robot manipulation menu", "Scene offline"); return; } else if (!SceneManager.Instance.IsRobotAndEESelected()) { OpenRobotSelector(RobotSteppingButtonClick); return; } if (!SelectorMenu.Instance.gameObject.activeSelf && !RobotSteppingButton.GetComponent <Image>().enabled) //other menu/dialog opened { SetActiveSubmenu(CurrentSubmenuOpened); //close all other opened menus/dialogs and takes care of red background of buttons } if (RobotSteppingButton.GetComponent <Image>().enabled) //hide menu { RobotSteppingButton.GetComponent <Image>().enabled = false; SelectorMenu.Instance.gameObject.SetActive(true); RobotSteppingMenu.Instance.Hide(); } else //open menu { ActionObject robot = SceneManager.Instance.GetActionObject(SceneManager.Instance.SelectedRobot.GetId()); RobotSteppingButton.GetComponent <Image>().enabled = true; SelectorMenu.Instance.gameObject.SetActive(false); RobotSteppingMenu.Instance.Show(); } }
//draw // private string[] cmd_popup = new string[3]{"MoveForward","MoveRight","Jump"}; // private string[] ease_type_popup = new string[5]{"None","Line", "EaseInCubic", "EaseOutCubic", "EaseInOutCubic"}; public override void Draw(ActionObject aco) { base.Draw(aco); GUILayout.BeginVertical(); mCMD = (CMD)EditorGUILayout.EnumPopup(mCMD); GUILayout.BeginHorizontal(); GUILayout.Label("Speed"); this.mSpeed = EditorGUILayout.FloatField(this.mSpeed); GUILayout.EndHorizontal(); if (mCMD == CMD.Jump) { GUILayout.BeginHorizontal(); GUILayout.Label("Jump Speed"); this.mJumpSpeed = EditorGUILayout.FloatField(this.mJumpSpeed); GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); GUILayout.Label("Duration"); this.mDuration = EditorGUILayout.FloatField(this.mDuration); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Ease Type"); this.mEaseType = (EaseType)EditorGUILayout.EnumPopup(mEaseType); GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
void ShrinkHelper(ActionObject item) { if (item.scale [0] > 0.5) { item.Grow (0.95f); } }
//get event public List <ActionObject.Event> GetEvents(ActionObject ac, float old_time, float now_time) { List <ActionObject.Event> events = new List <ActionObject.Event>(); if (old_time <= now_time) { foreach (ActionObject.Event ev in ac.m_Events) { //|xxxxx old -> oooooo <- now xxxxxxx| if (old_time < ev.time && ev.time <= now_time) { events.Add(ev); } } } else { //|ooo <- now xxxxxxxxxxxxxx old -> ooo| foreach (ActionObject.Event ev in ac.m_Events) { if (old_time < ev.time) { events.Add(ev); } } foreach (ActionObject.Event ev in ac.m_Events) { if (ev.time <= now_time) { events.Add(ev); } } } return(events); }
Vector3 GetNewTarget(ActionObject a) { Vector3 currentLocation = a.pos; if (currentLocation.x == targetPos.x) // In a vertical line { return(new Vector3(targetPos.x, 50 + targetPos.y, Utility.Z)); } else if (currentLocation.y == targetPos.y) // In a horizontal line { return(new Vector3(50 + targetPos.x, targetPos.y, Utility.Z)); } float slope = (targetPos.y - currentLocation.y) / (targetPos.x - currentLocation.x); float diff = 10f; if (currentLocation.x < targetPos.x) // left { return(new Vector3(targetPos.x - diff, targetPos.y - (slope * diff), Utility.Z)); } else // right { return(new Vector3(targetPos.x + diff, targetPos.y + (slope * diff), Utility.Z)); } }
public async Task <IActionResult> Edit([Bind("UserEntity, Roles")] UsersCreateUpdateViewModel model) { if (!UserIsAdmin()) { return(Error("You need to be logged in as admin to do this.")); } if (!ModelState.IsValid) { model.RoleDropDown = RoleDefaults(); return(View(model)); } if (model.UserEntity.Password != model.UserEntity.ConfirmPassword) { model.RoleDropDown = RoleDefaults(); ViewBag.errorMessage = "Password and Confirm Password fields must match!"; return(View(model)); } ActionObject _actionObject = await _accountActions.EditPost(model, User.Identity.Name); if (!_actionObject.Success) { return(Error(_actionObject.Message)); } ViewBag.successMessage = "User details have been modified."; return(RedirectToAction("Index")); }
public void TestInsertAction(InsertPosition insertPosition) { string firstPath = Path.Combine(TestSupport.CreatedFilesDirectory, "first.xml"); string secondPath = Path.Combine(TestSupport.CreatedFilesDirectory, "second.xml"); TestCasesRootContainer tcrc = new TestCasesRootContainer(); tcrc.TestCasesRoot.Save(firstPath); SelectedValuesByConditionsAndActions selValues = new SelectedValuesByConditionsAndActions(); selValues.CollectValues(tcrc.TestCasesRoot); selValues.Check(tcrc.TestCasesRoot); int indexWhereToInsert = TestUtils.CalculateIndex(tcrc.TestCasesRoot.Conditions, insertPosition); string newActionName = "new action" + DateTime.Now.ToString("F"); int actionCount = tcrc.TestCasesRoot.Actions.Count; tcrc.TestCasesRoot.InsertAction(indexWhereToInsert, ActionObject.Create(newActionName, new ObservableCollection <EnumValue>() { new EnumValue("new test", "new value") })); TestUtils.CheckTestCasesAndConditionsAndActions(tcrc.TestCasesRoot); Assert.That(actionCount == 3); // adjust last testcase on failue Assert.That(tcrc.TestCasesRoot.Actions.Count == actionCount + 1); Assert.That(tcrc.TestCasesRoot.Actions[indexWhereToInsert].Name.Equals(newActionName)); Assert.That(tcrc.ConditionChangeCount == 0); Assert.That(tcrc.ActionChangeCount == 2); selValues.InsertAction(insertPosition, tcrc.TestCasesRoot.TestCases.Count); selValues.Check(tcrc.TestCasesRoot); tcrc.TestCasesRoot.Save(secondPath); // only for manual check of testcase //TestSupport.CompareFile(firstPath, secondPath); }
public bool UpdateMouseCursor() { if (cursorRelativeTransform) { interactionRange = (Vector3.Distance(cursorWorldEndPos, cursorRelativeTransform.position) < interactionDistance); } if (interactionRange && !gInput.actionController.inAction) { SetInRangeCursor(); if (CastMouse(castToItemLayer)) { hitTransform = castHit.transform; if (hitTransform) { hitAction = hitTransform.GetComponent <ActionObject>(); } if (hitAction) { SetUseSprite(); return(true); } } } else { SetDefaultSprite(); } return(false); }
public void TestAddAction() { string firstPath = Path.Combine(TestSupport.CreatedFilesDirectory, "first.xml"); string secondPath = Path.Combine(TestSupport.CreatedFilesDirectory, "second.xml"); TestCasesRootContainer tcrc = new TestCasesRootContainer(); tcrc.TestCasesRoot.Save(firstPath); SelectedValuesByConditionsAndActions selValues = new SelectedValuesByConditionsAndActions(); selValues.CollectValues(tcrc.TestCasesRoot); selValues.Check(tcrc.TestCasesRoot); string newActionName = "new action" + DateTime.Now.ToString("F"); int actionCount = tcrc.TestCasesRoot.Actions.Count; tcrc.TestCasesRoot.AppendAction(ActionObject.Create(newActionName, new ObservableCollection <EnumValue>() { new EnumValue("new test", "new value") })); TestUtils.CheckTestCasesAndConditionsAndActions(tcrc.TestCasesRoot); Assert.That(tcrc.TestCasesRoot.Actions.Count == actionCount + 1); Assert.That(tcrc.TestCasesRoot.Actions.Last().Name.Equals(newActionName)); Assert.That(tcrc.ConditionChangeCount == 0); Assert.That(tcrc.ActionChangeCount == 2); selValues.AppendAction(tcrc.TestCasesRoot.TestCases.Count); selValues.Check(tcrc.TestCasesRoot); tcrc.TestCasesRoot.Save(secondPath); // only for manual check of testcase //TestSupport.CompareFile(firstPath, secondPath); }
/// <summary> /// /// </summary> public async Task <ActionObjectResult <bool> > SendAsync(string phone, string smsCode, int appId, string content, ValidationType type, string ip, int expiresMinute = 5) { var uniqueKey = GetSmsKey(phone); if (!await CheckOverLimit(phone)) { return(ActionObject.Ok(false, -1, "请求频率过高,请稍后再试")); } var smsLimit = new SmsCache { Code = smsCode, StartTime = DateTime.Now, ValidateCount = 0, ExpiresMinute = expiresMinute }; await _redisCache.AddAsync(uniqueKey, smsLimit, new TimeSpan(0, 0, expiresMinute * 60)); if (!_appSettings.DeveloperMode) { var(code, msg, msgId) = await _passportClient.SendSms(phone, content, _smsServerOptions.SignatureCode); _backgroundRunService.Transfer <IValidationComponent>(x => x.SaveLog(appId, content, type, phone, ip, code == "0", smsCode, expiresMinute, msgId, msg)); } return(ActionObject.Ok(true)); }
/// <summary> /// /// </summary> /// <param name="phone"></param> /// <param name="code"></param> /// <returns></returns> public async Task <ActionObjectResult <bool> > ValidSmsAsync(string phone, string code) { var uniqueKey = GetSmsKey(phone); var smsCache = await _redisCache.GetAsync <SmsCache>(uniqueKey); if (smsCache == null) { return(ActionObject.Ok(false, -1, "未发送验证码或验证码已超时")); } if (smsCache.ValidateCount >= 3) //0 1 2 { return(ActionObject.Ok(false, -1, "输入错误的次数超过3次,请重新获取验证码")); } if (code == smsCache.Code) { await _redisCache.KeyDeleteAsync(uniqueKey); return(ActionObject.Ok(true)); } var timeSpan = smsCache.StartTime.AddMinutes(smsCache.ExpiresMinute) - DateTime.Now; if (timeSpan.TotalSeconds <= 0) { return(ActionObject.Ok(false, -1, "未发送验证码或验证码已超时")); } smsCache.ValidateCount += 1; //更新验证次数,不延长时间 await _redisCache.AddAsync(uniqueKey, smsCache, timeSpan); return(ActionObject.Ok(false, -1, "输入验证码不正确")); }
public ActionObject DeleteConfirmed(int userId, string currentUserName) { ActionObject _actionObject = new ActionObject(); if (_unitOfWork.UserRepository.UserExists(userId)) { var user = _unitOfWork.UserRepository.Find(u => u.UserId == userId).FirstOrDefault(); if (currentUserName == user.UserName) { _actionObject.Success = false; _actionObject.RedirectToError = true; _actionObject.Message = "You can not delete your own user."; } else { _unitOfWork.UserRepository.Remove(user); _unitOfWork.LogRepository.CreateLog( currentUserName, "Deleted a user. With user name: [" + user.UserName + "].", DateTime.Now, null); } } else { _actionObject.Success = false; _actionObject.RedirectToError = true; _actionObject.Message = "User doesn't exist"; } _unitOfWork.Complete(); return(_actionObject); }
void _server_MessageReceived(object sender, SocketLibrary.SocketBase.MessageEventArgs e) { System.Console.WriteLine("收到调试信息:" + e.Message.MessageBody); try { SpeakerLibrary.Message.DebugMessage dm = SpeakerLibrary.Message.DebugMessage.FromJson(e.Message.MessageBody); switch (dm.Command) { case CommandConst.ActionRun: //动作记录 ActionObject ao = ((Newtonsoft.Json.Linq.JToken)dm.Content).ToObject <ActionObject>(); //入队 TaskQueues.Enqueue(new DebugActionQueueObject(e.Connecction.ConnectionName, dm.MsgId, ao)); break; case CommandConst.UploadDataBase: //更新动作库 UpdateDB(dm); break; } //发送回复 SendMessage(e.Connecction, dm); } catch (Exception ex) { System.Console.WriteLine(ex.ToString()); } }
public async Task <IActionResult> Edit(Order order) { if (!User.IsInRole("Orders")) { return(RedirectToAction("Logout", "Account")); } if (!ModelState.IsValid) { //Tino:ToDo order.StatusDefaultsDropdown = StatusDefaults(GetStatusIntValue(order.Status)); return(View(order)); } ActionObject _actionObject = _orderActions.EditPost(order, User.Identity.Name); if (!_actionObject.Success) { ViewBag.errorMessage = _actionObject.Message; //Tino:ToDo order.StatusDefaultsDropdown = StatusDefaults(GetStatusIntValue(order.Status)); return(View(order)); } TempData["success"] = _actionObject.Message; return(RedirectToAction("Details", new { id = order.OrderId })); }
void Shrink(ActionObject item1, ActionObject item2) { ShrinkHelper (item1); ShrinkHelper (item2); UpdateTime (); }
public ActionExcute StartAction(ActionObject actObj, ICustomObject o) { ActionExcute ac = new ActionExcute(); ac.StartAction(o, actObj); mListExcute.Add(ac); return(ac); }
//draw // private string[] cmd_popup = new string[1]{"Shake"}; public override void Draw(ActionObject aco) { base.Draw(aco); GUILayout.BeginVertical(); mCMD = (CMD)EditorGUILayout.EnumPopup(mCMD); GUILayout.EndVertical(); }
turn turnState = turn.START; // which fish should grow next? #endregion Fields #region Methods void Grow(ActionObject item, turn new_state) { item.Grow (1.05f); turnState = new_state; UpdateTime (); }
public EditAction(ActionObject actionObject, WindowPosition position) { defaultPosition = position; DataContext = actionObject; InitializeComponent(); defaultPosition?.SetWindowPosition(this); }
public void PlayCard(ActionObject action, IPEndPoint groupEP) { if (action.Player != MatchController.CurrentPlayer) { return; } MatchController.PlayCard(action.Player, action.Card); }
protected WakeLock(ActionObject action, int interval, int tolerance, bool reoccurring) { Action = action; Interval = interval; Tolerance = tolerance; Reoccurring = reoccurring; Update(); }
public void Pass(ActionObject action, IPEndPoint groupEP, MatchController match) { if (action.Player != match.CurrentPlayer) { return; } match.Pass(action.Player); }
void Grow(ActionObject item, turn new_state) { item.Grow(1.05f); turnState = new_state; UpdateTime(); }
public void Guess(ActionObject action, IPEndPoint groupEP) { if (action.Player != MatchController.CurrentPlayer) { return; } MatchController.Guess(action.Player, action.Guess); }
public void CopyFrom(ActionObject src) { // m_ActionObjects = new List<ActionObject>(); // orderingActionTable = src.orderingActionTable; // m_IsLookTarget = src.m_IsLookTarget; m_ActionObject = new ActionObject(); m_ActionObject.CopyFrom(src); }
public void OnLoad(string path) { string json_str = File.ReadAllText(path); object obj = MiniJSON.Json.Deserialize(json_str); m_ActionObject = new ActionObject(); m_ActionObject.ReadJson((Dictionary <string, object>)obj); }
/// <summary> /// Gets options froma URL and adds to a select box. /// </summary> /// <param name="url"></param> /// <param name="parameters"></param> /// <param name="select"></param> /// <param name="function">Param: args</param> /// <param name="args"></param> /// <returns></returns> public jQuerySelectBoxesObject AjaxAddOption( string url, Dictionary parameters, bool select, ActionObject function, object[] args) { return null; }
void Shrink(ActionObject item1, ActionObject item2) { music.PlayFeedback (music.neg); ShrinkHelper (item1); ShrinkHelper (item2); UpdateTime (); }
turn turnState = turn.START; // which fish should grow next? #endregion Fields #region Methods void Grow(ActionObject item, turn new_state) { music.PlayFeedback (music.pos); item.Grow (1.05f); turnState = new_state; UpdateTime (); }
Vector3 GetNewTarget(ActionObject a) { Vector3 currentLocation = a.pos; if (currentLocation.x == targetPos.x) // In a vertical line return new Vector3 (targetPos.x, 50+targetPos.y, Utility.Z); else if (currentLocation.y == targetPos.y) // In a horizontal line return new Vector3 (50+targetPos.x, targetPos.y, Utility.Z); float slope = (targetPos.y - currentLocation.y) / (targetPos.x - currentLocation.x); float diff = 10f; if (currentLocation.x < targetPos.x) // left return new Vector3 (targetPos.x - diff, targetPos.y - (slope * diff), Utility.Z); else // right return new Vector3 (targetPos.x + diff, targetPos.y + (slope * diff), Utility.Z); }
bool WinningScale(ActionObject item) { return item.scale [0] >= WINNER_SCALE; }
public Observer(ActionObject onNext, ActionObject onError, Action onCompleted) { }
public static Observer Create(ActionObject onNext, ActionObject onError) { return null; }
public static Observer Create(ActionObject onNext, ActionObject onError, Action onCompleted) { return null; }
public Object(ActionObject prototype, ActionFunc constructor) { }
public Observer(ActionObject onNext, ActionObject onError) { }
public void Setup(Transform parent, ActionObject.Effect ef) { m_ActEf = ef; m_Parent = parent; gameObject.SetActive (false); }
public Action Subscribe(ActionObject handler) { return null; }
public Observer(ActionObject onNext) { }