private void Awake() { if (playerWeaponController == null) { playerWeaponController = GameObject.FindGameObjectWithTag("Player").GetComponent <UseWeapon>(); } }
void SelectWeapon(int code) { if (useWeaponController == null) { useWeaponController = GetComponent <UseWeapon>(); } switch (code) { case 1: useWeaponController.ChangeWeapon(punch, kick); break; case 2: useWeaponController.ChangeWeapon(silencedPistol, kick); break; case 3: useWeaponController.ChangeWeapon(wristDarts, kick); break; case 4: useWeaponController.ChangeWeapon(attacheCase, kick); break; default: break; } switchedWeaponsEvent.Invoke(); }
void Update() { if (Vector3.Distance(tPlayer.position, transform.position) < fRadius) { if (Input.GetKeyDown(KeyCode.F)) { this.GetComponent <Rigidbody>().useGravity = false; this.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll; bool bTaken = PlayerInventory.instance.Add(iItem); //add to hand if (bTaken) { Debug.Log("Picked up " + iItem.name); this.GetComponent <Rigidbody>().useGravity = false; this.GetComponent <Rigidbody>().isKinematic = false; this.GetComponent <Collider>().enabled = false; transform.SetParent(hand.transform); transform.localPosition = vPickPosition; transform.localEulerAngles = vPickRotation; cycle = transform.parent.GetComponent <WeaponCycle>(); uApplyStats = gameObject.GetComponent <UseWeapon>(); uApplyStats.fDamage = iItem.fDmg; uApplyStats.fSpeed = iItem.fSpd; uApplyStats.fRange = iItem.fRng; uApplyStats.fKnockback = iItem.fKbk; uApplyStats.fDurability = iItem.fDur; cycle.SelectWeapon(); gameObject.GetComponent <InteractableItem>().enabled = false; //to ensure we dont pick up more than one item next time } } } }
private void Start() { if (playerWeaponController == null) { playerWeaponController = GetComponentInParent <UseWeapon>(); } }
private void Start() { if (useWeaponController == null) { useWeaponController = GetComponent <UseWeapon>(); } SelectWeapon(1); }
private void Awake() { ButtonMapping(); controllerCustomization.gameObject.SetActive(false); _objectMovement = GetComponent <ObjectMovement>(); _objectRotation = GetComponent <ObjectRotation>(); _useWeapon = GetComponent <UseWeapon>(); _shield = GetComponent <Shield>(); _options = FindObjectOfType <Options>(); }
void Awake() { anim = this.transform.GetComponent <Animator>(); movementSpeed = this.transform.GetChild(1).GetComponent <EachCharacterStat>().speed; weapon = this.transform.GetChild(0).GetComponent <UseWeapon>(); checkCondition = this.transform.GetComponent <MakeAlgorithmForGame_1>(); healthBarImage = this.transform.GetChild(2).GetChild(0).GetChild(0).GetComponent <Image>(); rb = this.GetComponent <Rigidbody>(); shootCooldown = 0.5f; shootCooldownReset = 1.0f; isHit = false; randomNumGeneratingTime = 0f; }
// Use this for initialization and attach to its parent for animation void Start() { useWeaponObject = GameObject.FindWithTag("Player").GetComponent <UseWeapon>(); }
protected override void Apply(AttributeLoader loader, object wrapperObj) { if (!(wrapperObj is AbilityAttributesWrapper w)) { throw new System.InvalidCastException(); } if (Resource1Cost != null || Resource2Cost != null || Resource1CostMult != null || Resource2CostMult != null) { var w2 = new CostAttributesWrapper(w.Cost); loader.ApplyPPatch(Resource1Cost, () => w2.Resource1Cost); loader.ApplyPMultPatch(Resource1CostMult, () => w2.Resource1Cost); loader.ApplyPPatch(Resource2Cost, () => w2.Resource2Cost); loader.ApplyPMultPatch(Resource2CostMult, () => w2.Resource2Cost); w.Cost = w2; } loader.ApplyPPatch(EdgeOfTargetShapeMinDistance, () => w.EdgeOfTargetShapeMinDistance, Fixed64.UnsafeFromDouble); loader.ApplyPMultPatch(EdgeOfTargetShapeMinDistanceMult, () => w.EdgeOfTargetShapeMinDistance); loader.ApplyPPatch(CooldownTimeSecs, () => w.CooldownTimeSecs, Fixed64.UnsafeFromDouble); loader.ApplyPMultPatch(CooldownTimeSecsMult, () => w.CooldownTimeSecs); loader.ApplyPPatch(WarmupTimeSecs, () => w.WarmupTimeSecs, Fixed64.UnsafeFromDouble); loader.ApplyPMultPatch(WarmupTimeSecsMult, () => w.WarmupTimeSecs); loader.ApplyPPatch(SharedCooldownChannel, () => w.SharedCooldownChannel); loader.ApplyPMultPatch(SharedCooldownChannelMult, () => w.SharedCooldownChannel); loader.ApplyPPatch(AbilityType, () => w.AbilityType); loader.ApplyPPatch(TargetingType, () => w.TargetingType); loader.ApplyPPatch(TargetAlignment, () => w.TargetAlignment); loader.ApplyPPatch(AbilityMapTargetLayers, () => w.AbilityMapTargetLayers); loader.ApplyPPatch(GroundAutoTargetAlignment, () => w.GroundAutoTargetAlignment); loader.ApplyPPatch(CasterMovesToTarget, () => w.CasterMovesToTarget); loader.ApplyPPatch(GroupActivationType, () => w.GroupActivationType); loader.ApplyPPatch(StartsRemovedInGameMode, () => w.StartsRemovedInGameMode); loader.ApplyPPatch(SkipCastOnArrivalConditions, () => w.SkipCastOnArrivalConditions); loader.ApplyPPatch(IsToggleable, () => w.IsToggleable); loader.ApplyPPatch(CastOnDeath, () => w.CastOnDeath); if (TargetHighlighting != null) { using (loader.logger.BeginScope($"TargetHighlighting:")) { var w2 = new TargetHighlightingAttributesWrapper(w.TargetHighlighting); TargetHighlighting.Apply(loader, w2, null); w.TargetHighlighting = w2; } } if (Charges != null) { using (loader.logger.BeginScope($"Charges:")) { var w2 = new ChargeAttributesWrapper(w.Charges); Charges.Apply(loader, w2, null); w.Charges = w2; } } if (Autocast != null) { using (loader.logger.BeginScope($"Autocast:")) { var w2 = new AutocastAttributesWrapper(w.Autocast); Autocast.Apply(loader, w2, null); w.Autocast = w2; } } if (ProduceUnit != null) { using (loader.logger.BeginScope($"ProduceUnit:")) { var w2 = new ProduceUnitAttributesWrapper(w.ProduceUnit); ProduceUnit.Apply(loader, w2, null); w.ProduceUnit = w2; } } if (UseWeapon != null) { using (loader.logger.BeginScope($"UseWeapon:")) { var w2 = new UseWeaponAttributesWrapper(w.UseWeapon); UseWeapon.Apply(loader, w2, null); w.UseWeapon = w2; } } if (ChangeContext != null) { var w2 = new ChangeContextAttributesWrapper(w.ChangeContext); loader.ApplyPPatch(ChangeContext, () => w2.TargetContext); w.ChangeContext = w2; } if (AirSortie != null) { using (loader.logger.BeginScope($"AirSortie:")) { var w2 = new AirSortieAttributesWrapper(w.AirSortie); AirSortie.Apply(loader, w2, null); w.AirSortie = w2; } } if (Salvage != null) { using (loader.logger.BeginScope($"Salvage:")) { var w2 = new SalvageAttributesWrapper(w.Salvage); Salvage.Apply(loader, w2, null); w.Salvage = w2; } } if (ApplyStatusEffect.Count > 0) { using (loader.logger.BeginScope($"ApplyStatusEffect:")) { var w2 = new ApplyStatusEffectAttributesWrapper(w.ApplyStatusEffect); var statusEffectWrappers = w2.StatusEffectsToApply?.Select(x => new StatusEffectAttributesWrapper(x)).ToList() ?? new List <StatusEffectAttributesWrapper>(); loader.ApplyNamedLPatch(ApplyStatusEffect, statusEffectWrappers, (x) => new StatusEffectAttributesWrapper(x), nameof(StatusEffectAttributes)); w2.StatusEffectsToApply = statusEffectWrappers.ToArray(); w.ApplyStatusEffect = w2; } } if (Repair != null) { var w2 = new RepairAttributesWrapper(w.Repair); loader.ApplyPPatch(Repair, () => w2.WeaponID); w.Repair = w2; } if (SelfDestruct != null) { using (loader.logger.BeginScope($"SelfDestruct:")) { var w2 = new SelfDestructAttributesWrapper(w.SelfDestruct); SelfDestruct.Apply(loader, w2, null); w.SelfDestruct = w2; } } if (ModifyInventory != null) { using (loader.logger.BeginScope($"ModifyInventory:")) { var w2 = new ModifyInventoryAttributesWrapper(w.ModifyInventory); ModifyInventory.Apply(loader, w2, null); w.ModifyInventory = w2; } } if (RequiredResearch != null) { var w2 = new ResearchDependenciesAttributesWrapper(w.ResearchDependencies); loader.ApplyArrayPropertyPatch(RequiredResearch, w2, "RequiredResearch"); w.ResearchDependencies = w2; } if (ActivationDependencies != null) { using (loader.logger.BeginScope($"ActivationDependencies:")) { var w2 = new ActivationDependenciesAttributesWrapper(w.ActivationDependencies); ActivationDependencies.Apply(loader, w2, null); w.ActivationDependencies = w2; } } if (AutoToggleOffConditions != null) { using (loader.logger.BeginScope($"AutoToggleOffConditions:")) { var w2 = new AutoToggleOffConditionsAttributesWrapper(w.AutoToggleOffConditions); AutoToggleOffConditions.Apply(loader, w2, null); w.AutoToggleOffConditions = w2; } } if (ChainCasting != null) { using (loader.logger.BeginScope($"ChainCasting:")) { var w2 = new ChainCastingAttributesWrapper(w.ChainCasting); ChainCasting.Apply(loader, w2, null); w.ChainCasting = w2; } } }
private void Awake() { _useWeapon = GetComponent <UseWeapon>(); }