public void Unspecialize() { if (IsSpecialized) { spec = SpecializationFactory.GetSpecialization(SpecializationType.None); GetComponent <Animator>().SetInteger("Specialization", (int)SpecializationType.None); } }
void Awake() { spec = SpecializationFactory.GetSpecialization(SpecializationType.None); speed = initialSpeed; visualRadius = initialVisualRadius; damage = initialDamage; attackRange = initialAttackRange; attackCooldownTime = initialAttackCooldownTime; loadSize = initialLoadSize; loadTime = initialLoadTime; reactionTime = initialReactionTime; }
public void Specialize(SpecializationType type) { if (type != SpecializationType.None) { //This should be changed if (type == SpecializationType.Inkeeper) { gameObject.GetComponent <Controllable>().canInkeep = true; } spec = SpecializationFactory.GetSpecialization(type); GetComponent <Animator>().SetInteger("Specialization", (int)type); if (BeeSpecialized != null) { BeeSpecialized(gameObject); } } }
public CharacterController(IConfiguration configuration) { _characterFactory = new CharacterFactory(configuration); _specializationFactory = new SpecializationFactory(configuration); }
/// <summary> /// Migrates WSE XTestStep to API XTestStep.(Also Applies any transformation which are performed on Request or Response.Currently a limited list /// of transformation is supported.) /// </summary> /// <param name="rootComponentFolder">Folder on which the migration is performed</param> /// <param name="requestApiModule">Request API Module</param> /// <param name="responseApiModule">Response API Module</param> /// <param name="payloadParser">Instance of XML or JSON parser depending upon Module Type</param> /// <param name="payloadSetterFactory">Instance of XML or JSON Setter depending upon Module Type</param> /// <param name="wseTestStep">WSE XTestStep to be migrated</param> public void Migrate(TCObject rootComponentFolder, ApiModule requestApiModule, ApiModule responseApiModule, IPayloadParser payloadParser, IPayloadSetterFactory payloadSetterFactory, XTestStep wseTestStep) { try { FileLogger.Instance.Info( $"Migrating XTestStep:{wseTestStep.Name} -- NodePath:{wseTestStep.NodePath}"); bool isWseStepDisabled = wseTestStep.Disabled; //disable wse teststep wseTestStep.Disabled = true; //Get Parent of wse teststep var parent = wseTestStep.ParentFolder ?? (dynamic)wseTestStep.TestCase; //Create API Request TestStep XTestStep requestTestStep = (XTestStep)parent.CreateXTestStepFromXModule(requestApiModule); requestTestStep.Name = wseTestStep.Name; AbstractSpecializationHandler requestSpecializationHandler = SpecializationFactory.GetRequestSpecializationHandler(); requestSpecializationHandler.HandleSpecialization(wseTestStep, requestTestStep, payloadParser, payloadSetterFactory); RequestValueSetters.ForEach(setter => setter.Execute(requestTestStep, wseTestStep)); wseTestStep.Reorder(requestTestStep, "Yes"); //Create API Response TestStep XTestStep responseTestStep = (XTestStep)parent.CreateXTestStepFromXModule(responseApiModule); responseTestStep.Name = wseTestStep.Name + " Response"; ResponseValueSetters.ForEach(setter => setter.Execute(responseTestStep, wseTestStep)); requestTestStep.Reorder(responseTestStep, "Yes"); AbstractSpecializationHandler responseSpecializationHandler = SpecializationFactory.GetResponseSpecializationHandler(); responseSpecializationHandler.HandleSpecialization(wseTestStep, responseTestStep, payloadParser, payloadSetterFactory); //For Payload payloadSetterFactory.GetRequestPayloadSetter().Execute(requestTestStep, wseTestStep); payloadSetterFactory.GetResponsePayloadSetter().Execute(responseTestStep, wseTestStep); CommonParserMethods.FillTransformRequest(requestTestStep, wseTestStep); CommonParserMethods.FillTransformResponse(responseTestStep, wseTestStep); if (isWseStepDisabled) { requestTestStep.Disable(wseTestStep.DisabledDescription); responseTestStep.Disable(wseTestStep.DisabledDescription); requestTestStep.Disabled = true; responseTestStep.Disabled = true; } if (!string.IsNullOrEmpty(wseTestStep.Condition)) { requestTestStep.Condition = wseTestStep.Condition; responseTestStep.Condition = wseTestStep.Condition; } if (!string.IsNullOrEmpty(wseTestStep.Path)) { requestTestStep.Path = wseTestStep.Path; responseTestStep.Path = wseTestStep.Path; } MoveBodyAttributeAtLast(requestTestStep); MoveBodyAttributeAtLast(responseTestStep); } catch (Exception e) { FileLogger.Instance.Error(e); } }