void StartedStrike(int targetHand) { if (states.HasState(stateCharge)) { states.RemoveState(stateCharge); } //Audio AudioController.i.CmdPlay3DItemSound(playerCore.currentLocation, hands[targetHand].equipped.ID, Defs.ItemSound.StrikeSound, transform.position, 0.8f, 10, 30, 0.85f, 1.15f); //Take Cost Effectors unitCore.RunEffector(new Source(unitCore, hands[targetHand].equipped), hands[targetHand].equipped.CostEffector, false); switch (hands[targetHand].equipped.WeaponType) { case Defs.WeaponType.Melee: Slash(targetHand); //Conditions unitCore.MeleeStrike(true); break; case Defs.WeaponType.Projectile: RpcControlAnimator(targetHand, Pose.Strike, Defs.WeaponType.Projectile); SpawnProjectile(hands[targetHand].equipped); //Conditions unitCore.ProjectileWind(false); break; case Defs.WeaponType.Shield: Debug.LogError("Trying to Strike with Shield!"); break; } }
public void RegisterBlock(GameObject hit) { Debug.Log("Blocked!"); UnitCore target = hit.GetComponent <UnitCore>(); target.RunEffector(new Source(caller.unitCore, MasterListDatabase.i.FetchItem(itemID), caller), effector, true); }
void RegisterHit(GameObject hit) { //Audio AudioController.i.CmdPlay3DItemSound(caller.playerCore.currentLocation, caller.hands[hand].equipped.ID, Defs.ItemSound.HitSound, transform.position, 0.8f, 10, 30, 0.85f, 1.15f); UnitCore target = hit.GetComponent <UnitCore>(); target.RunEffector(new Source(caller.unitCore, MasterListDatabase.i.FetchItem(itemID), caller), effector, false); }
public void RegisterBlock(GameObject hit) { if (!hitTargets.Contains(hit.GetComponent <NetworkIdentity>().netId)) { hitTargets.Add(hit.GetComponent <NetworkIdentity>().netId); Debug.Log("Blocked!"); UnitCore target = hit.GetComponent <UnitCore>(); target.RunEffector(new Source(caller.unitCore, MasterListDatabase.i.FetchItem(itemID), caller), effector, true); Destroy(gameObject); } }
public void RegisterHit(GameObject hit) { //Audio AudioController.i.CmdPlay3DItemSound(caller.playerCore.currentLocation, itemID, Defs.ItemSound.HitSound, transform.position, 0.8f, 10, 30, 0.85f, 1.15f); UnitCore target = hit.GetComponent <UnitCore>(); target.RunEffector(new Source(caller.unitCore, MasterListDatabase.i.FetchItem(itemID)), effector, false); if (targetLimit != 0) { targetsHit--; if (targetsHit == 0) { Destroy(gameObject); } } }
void RunEffect(UnitCore causer, State state, Effector targetEffect) { unitCore.RunEffector(new Source(causer, state), targetEffect, false); }
public void ActionBar_UseAbility(int slot) { if (!equippedAbilities[slot].equipped) { return; } if (equippedAbilities[slot].cooldown != -1) { //HUD RpcHUDPingAbility(slot, Defs.AbilityMode.Cooldown); return; } if (EffectorMethods.CheckIfEnoughResources(unitCore, equippedAbilities[slot].ability.cost)) { for (int action = 0; action < equippedAbilities[slot].ability.actions.Count; action++) { //Target UnitCore target; switch (equippedAbilities[slot].ability.actions[action].target) { case Ability.Action.Target.Self: target = unitCore; break; } //Type switch (equippedAbilities[slot].ability.actions[action].type) { case Ability.Action.Type.ApplyState: GetComponent <HERO_StateController>().AddStates(unitCore, equippedAbilities[slot].ability.actions[action].targetStates); break; case Ability.Action.Type.RemoveState: GetComponent <HERO_StateController>().RemoveStates(equippedAbilities[slot].ability.actions[action].targetStates); break; case Ability.Action.Type.ApplyEffector: unitCore.RunEffector(new Source(unitCore, Source.Type.Ability), equippedAbilities[slot].ability.actions[action].targetEffector, false); break; case Ability.Action.Type.Animation: GetComponent <Animator>().SetTrigger(equippedAbilities[slot].ability.actions[action].animationTrigger); break; } //Movement bool cancel = false; Quaternion targetDirection = transform.rotation; switch (equippedAbilities[slot].ability.actions[action].movementType) { case Ability.Action.MovementType.None: cancel = true; break; case Ability.Action.MovementType.MoveDirection: Vector3 face = new Vector3(transform.position.x + Input.GetAxis("Horizontal"), transform.position.y, transform.position.z + Input.GetAxis("Vertical")); transform.LookAt(face); targetDirection = transform.rotation; break; case Ability.Action.MovementType.MouseDirection: targetDirection = transform.rotation; break; case Ability.Action.MovementType.CustomDirection: targetDirection = equippedAbilities[slot].ability.actions[action].direction; break; } if (!cancel) { StartCoroutine(MoveInDirection(targetDirection, equippedAbilities[slot].ability.actions[action].distance, equippedAbilities[slot].ability.actions[action].time)); } } //Cooldown equippedAbilities[slot].cooldown = 15; //Unit HUD RpcPingAbility(abilitySheet.contained.IndexOf(equippedAbilities[slot].ability)); //HUD RpcHUDPingAbility(slot, Defs.AbilityMode.Use); } else { //HUD RpcHUDPingAbility(slot, Defs.AbilityMode.Cooldown); } }