protected override BNode InnerClone(Dictionary <Value, Value> originalValueForClonedValue) { EquipTool equipTool = CreateInstance <EquipTool>(); equipTool.toolTypeValue = CloneValue(originalValueForClonedValue, toolTypeValue); return(equipTool); }
public static EquipTool CreateFromToolType(ToolType toolType) { ToolTypeValue typeValue = ToolTypeValue.Create(toolType); EquipTool equipTool = CreateInstance <EquipTool>(); equipTool.toolTypeValue = typeValue; return(equipTool); }
public override void Update() { switch (state) { // Check if there are no obvious errors case InnerState.Setup: // Let the innernode check if there is something wrong. If so return failure. if (PreCheck() == false) { CurrentStatus = Status.Failure; return; } // Save the tooltype previousEquippedTool = toy.ActiveToolType; // if the toy had an item equip, first unequip it. If it did not have an item then skip into the PickupItem case if (previousEquippedTool == ToolType.None) { state = InnerState.SubUpdate; } else { equip = EquipTool.CreateFromToolType(ToolType.None); equip.Restart(); equip.Beginn(tree); state++; } break; // Play the animation for putting a tool into the inventory case InnerState.ToolToInventory: UpdateEquipNode(); break; // Update the InnerNode case InnerState.SubUpdate: switch (SubUpdate()) { case Status.Success: state++; succeeded = true; break; case Status.Failure: state++; succeeded = false; break; } break; // Check to see if we need to reequip the node case InnerState.ToolToEquipSetup: if (previousEquippedTool == ToolType.None) { state = InnerState.Finish; } else { equip = EquipTool.CreateFromToolType(previousEquippedTool); equip.Restart(); equip.Beginn(tree); state++; } break; // Reequip the tool case InnerState.ToolToEquip: UpdateEquipNode(); break; // Set status to success or failure wheter the innernode failed or not case InnerState.Finish: CurrentStatus = succeeded == true ? Status.Success : Status.Failure; break; } }