void OnSceneGUI() { ActionJump action = target as ActionJump; LevelBuilderCommon.Default5ActionButton(action.transform.position + new Vector3(0, 1.5f, 0), action); LevelBuilderCommon.DeleteButton(action); }
/// <summary> /// Read <see cref="SwfDotNet.IO.ByteCode.Actions.ActionJump">jump</see> action from swf. /// </summary> private ActionJump ReadActionJump(BinaryReader br) { int len = Convert.ToInt32(br.ReadInt16()); Int16 o = br.ReadInt16(); ActionJump a = new ActionJump(Convert.ToInt32(o)); //a.ByteSize = len+3; return(a); }
private void Walk(int index, IActionExaminer examiner, ArrayList visitedLabels) { while (index < actionRec.Count) { BaseAction a = (BaseAction)actionRec[index]; if (a is ActionLabel) { ActionLabel l = a as ActionLabel; if (visitedLabels.Contains(l.LabelId)) { //examiner.End(); return; } else { visitedLabels.Add(l.LabelId); } } examiner.Examine(index, a); if (a is ActionJump) { ActionJump j = a as ActionJump; index = (int)labelIndexTable[j.LabelId] - 1; } if (a is ActionIf) { ActionIf ai = a as ActionIf; if (!visitedLabels.Contains(ai.LabelId)) { Walk((int)labelIndexTable[ai.LabelId], examiner.Clone(), (ArrayList)visitedLabels.Clone()); } } if (a is ActionReturn) { //examiner.End(); return; } index++; } //examiner.End(); }
public object Jump(params object[] objs) { Vector3 _destination = (Vector3)objs[0]; bool sendMessage = false; if (objs.Length >= 2) { sendMessage = Convert.ToBoolean(objs[1]); } bool bRet = (bool)TryFinishAction(); bool bRet2 = (bool)ActionMoveToDistance(_destination, Owner.Speed, sendMessage); if (bRet || !bRet2) { ActionJump walk = new ActionJump(Owner); walk.speed = Owner.Speed; walk.IsPushStack = sendMessage; walk.endPosition = _destination; Owner.DispatchEvent(ControllerCommand.SetActiveAction, walk); } return(null); }
ActionBase IActionVisitor <XElement, ActionBase> .Visit(ActionJump action, XElement xAction) { action.BranchOffset = ParseBranchOffset(xAction.RequiredStringAttribute("byteOffset")); return(action); }
bool parseAction(IAction action, Collider collider = null, bool trigger = false) { if (action is ActionPickUp) { ActionPickUp pickUpAction = (ActionPickUp)action; pickUpAction.executePickUp(this); return(true); } else if (action is ActionTriggerRun) { ActionTriggerRun runActionTrigger = (ActionTriggerRun)action; return(this.setRunDirection(runActionTrigger, runActionTrigger.getDirection())); } else if (action is ActionRun) { ActionRun actionRun = action as ActionRun; if (trigger) { return(this.setRunDirection(actionRun, actionRun.GetTriggerDirection())); } if (this.wannaBeDirection != this.direction) { return(this.setRunDirection(actionRun, this.wannaBeDirection)); } } else if (action is ActionSafetyNetForRun) { if (this.wannaBeDirection != this.direction) { return(((ActionSafetyNetForRun)action).EarlyMove(this.wannaBeDirection)); } } else if (action is ActionTranslate) { ActionTranslate translateAction = (ActionTranslate)action; this.transform.Translate(translateAction.getTranslateVector(), Space.World); return(true); } else if (action is ActionSlide) { ActionSlide slideAction = action as ActionSlide; if (this.boarding && slideAction.slideStart) { if (this.inAir) { this.offsetAnimator.SetBool("Slide", true); } else { this.boarding = false; //this.SetupBoarding(); } } else { this.offsetAnimator.SetBool("Slide", false); this.offsetAnimator.SetTrigger("StartHover"); } } else if (action is ActionJump) { ActionJump jumpAction = action as ActionJump; if (this.boarding && this.jumping == -1f) { this.jumping = 0f; this.startJumpingVector = this.transform.position; this.endJumpingVector = jumpAction.GetTargetPosition(); } } else if (action is ActionDeath) { this.die(((ActionDeath)action).getType()); } return(false); }
// Use this for initialization; void Start() { actionJump = GetComponent <ActionJump> (); actionRun = GetComponent <ActionRun> (); }
XElement IActionVisitor <XElement, XElement> .Visit(ActionJump action, XElement param) { return(new XElement(XActionNames.FromAction(action), new XAttribute("byteOffset", FormatBranchOffset(action.BranchOffset)))); }