public override void OnDoubleClick(Mobile from) { Target t; if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. } else { from.SendMessage("Target a crew member to board their ship."); t = new HookTarget(); from.Target = t; } }
void Update() { RaycastHit hit; Color returnCol = Color.blue; if (Physics.Raycast(Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0)), out hit, 300)) { Debug.LogWarning(hit.transform.name); returnCol = Color.red; HookTarget hook = hit.transform.GetComponent <HookTarget> (); if (hook != null) { hook.OnToggled(true); OnTargetAcquiredHandler(hit.transform.gameObject, true); } } else if (potentialTarget != null) { potentialTarget.GetComponent <HookTarget> ().OnToggled(false); OnTargetAcquiredHandler(potentialTarget.transform.gameObject, false); } if (!swinging) { if (Input.GetButtonDown("Fire1")) { SetGrapple(potentialTarget, 0); } else if (Input.GetButtonDown("Fire2")) { SetGrapple(potentialTarget, 1); } } else { xSpeed = Input.GetAxis("Horizontal"); if (Input.GetButtonUp("Fire1") || Input.GetButtonUp("Fire2")) { // Debug.LogError ("Checl"); FreeGrapple(); } } }
public void Hook(Rigidbody2D target, float distance) { hookLine.enabled = true; line.enabled = true; hookLine.connectedBody = target; hookLine.distance = distance; _swinging = true; _potentialHTarget = target.GetComponent <HookTarget>(); if (_potentialHTarget != null && _potentialHTarget.enabled) { _potentialHTarget.Moving = true; hookLine.connectedAnchor = _potentialHTarget.hookPoint.localPosition; } else { hookLine.connectedAnchor = Vector2.zero; _potentialPosition = target.position; } }
//*-------------------------------------------------------------------------*// #region INTERFACE IMPLEMENTATION public void Enter_State(Dictionary <string, object> pParam) { float power = 1.0f; _hook.CoolDownTimer.Connect("timeout", this, nameof(_onCooldownTimeout)); _hook.CoolDownTimer.Start(); HookTarget target = _hook.SnapDetector.Target; if (target != null) { _hook.Arrow.HookPosition = target.GlobalPosition; target.HookedFrom(_hook.GlobalPosition); // (from Charge state) if (pParam.ContainsKey("velocity_multiplier")) { power = (float)pParam["velocity_multiplier"]; } _hook.EmitSignal("HookedOntoTarget", target.GlobalPosition, power); } }