private void CastSpell() { var spellCastRequest = new SpellCastRequest(activeSpell, spellTargetPosition.ToCoordinates()); SpatialOS.Commands.SendCommand(clientAuthorityCheck, Spells.Commands.SpellCastRequest.Descriptor, spellCastRequest, gameObject.EntityId()); SetLocalSpellCooldown(activeSpell, SimulationSettings.SpellCooldown); DeactivateSpellCastingMode(); }
public SpellCastTargets(Unit caster, SpellCastRequest spellCastRequest) { m_targetMask = spellCastRequest.Target.Flags; m_objectTargetGUID = spellCastRequest.Target.Unit; m_itemTargetGUID = spellCastRequest.Target.Item; m_strTarget = spellCastRequest.Target.Name; m_src = new SpellDestination(); m_dst = new SpellDestination(); if (spellCastRequest.Target.SrcLocation.HasValue) { m_src.TransportGUID = spellCastRequest.Target.SrcLocation.Value.Transport; Position pos; if (!m_src.TransportGUID.IsEmpty()) { pos = m_src.TransportOffset; } else { pos = m_src.Position; } pos.Relocate(spellCastRequest.Target.SrcLocation.Value.Location); if (spellCastRequest.Target.Orientation.HasValue) { pos.SetOrientation(spellCastRequest.Target.Orientation.Value); } } if (spellCastRequest.Target.DstLocation.HasValue) { m_dst.TransportGUID = spellCastRequest.Target.DstLocation.Value.Transport; Position pos; if (!m_dst.TransportGUID.IsEmpty()) { pos = m_dst.TransportOffset; } else { pos = m_dst.Position; } pos.Relocate(spellCastRequest.Target.DstLocation.Value.Location); if (spellCastRequest.Target.Orientation.HasValue) { pos.SetOrientation(spellCastRequest.Target.Orientation.Value); } } SetPitch(spellCastRequest.MissileTrajectory.Pitch); SetSpeed(spellCastRequest.MissileTrajectory.Speed); Update(caster); }
private Nothing OnSpellCastRequest(SpellCastRequest request, ICommandCallerInfo callerinfo) { CastSpell(request.spellType, request.position.ToVector3()); return(new Nothing()); }