// Initialize Function Box Process. public void InitChangeBox(SCRIPTTYPE scKind) { this.scriptKind = scKind; switch (scKind) { case SCRIPTTYPE.SWAPARRAY: case SCRIPTTYPE.EQUAL: case SCRIPTTYPE.LESS: case SCRIPTTYPE.GREATER: MakeSaucer(2); break; case SCRIPTTYPE.ADD: case SCRIPTTYPE.SUB: case SCRIPTTYPE.DIV: case SCRIPTTYPE.MUL: case SCRIPTTYPE.REM: case SCRIPTTYPE.SUBSTITUTE: case SCRIPTTYPE.COUNTER: case SCRIPTTYPE.MINIMUMINDEX: case SCRIPTTYPE.INCREMET: case SCRIPTTYPE.INTIALIZE: MakeSaucer(1); break; case SCRIPTTYPE.CAPSEL: MakeSaucer(1); break; } return; }
void GoToFlag(SCRIPTTYPE flag) { // Find an aiming object. if nothing, return null. GameObject aimObj = GameObject.FindGameObjectsWithTag("Function") .Where(go => go.GetComponent <FlowBoxBehaviorControl> ().scriptKind == flag) .FirstOrDefault(); // Output a top element. ElementsList[0].SendMessage("PopElement", this.transform.position + Vector3.up * 3F); // Get rigidbody from the outputed element. Rigidbody2D objRigid = ElementsList[0].GetComponent <Rigidbody2D>(); objRigid.Sleep(); objRigid.AddForce(new Vector2(0F, 15F), ForceMode2D.Impulse); // If set an aiming flag, flay away to the flag! if (aimObj != null) { float dump = 0.3F; Vector3 aimPos = aimObj.transform.position; ElementsList[0].SendMessage("SetAimPosition", aimPos); Vector3 vec = aimPos - this.transform.position; objRigid.AddForce(vec * dump, ForceMode2D.Impulse); } return; }
public void ApplyChangeButton(GameObject obj, SCRIPTTYPE scKind) { if (changeObj == null) { return; } changeObj.GetComponent <Image>().sprite = obj.GetComponent <Image>().sprite; changeObj.GetComponent <FlowBoxBehaviorControl>().InitChangeBox(scKind); }
// Change subject and detail from XLS Data. public void UpdateText(SCRIPTTYPE type) { scType = type; BoxHelop_Sheet1.Param dataParam = boxHelpData.sheets [0].list .Where(data => data.procedure == scType.ToString()) .FirstOrDefault(); subjectText.text = dataParam.name; detailText.text = dataParam.detail; }
void PutHelpDialog() { GameObject obj = GameObject.FindWithTag("SelectMeFunction"); GameObject dialog = Instantiate(Resources.Load("BoxHelpDialog")) as GameObject; SCRIPTTYPE scriptType = obj.GetComponent <FlowBoxBehaviorControl> ().scriptKind; obj.tag = "Function"; dialog.SendMessage("UpdateText", scriptType); // Save a log. this.SendMessage("RecordData", "12, Watch a box help : script = " + scriptType.ToString() + ", " + ((int)scriptType).ToString()); }
public Script(SCRIPTTYPE type = SCRIPTTYPE.UNKNOWN) => this.Type = type;