void Start() { tpc = GameManager.instance.tpc; altOS = GameManager.instance.altOS; hookshot = GetComponent <HookshotController>(); hookshot.altweapons = this; boomerang = GetComponent <BoomerangController>(); boomerang.altweapons = this; bow = GetComponent <BowController>(); bow.altweapons = this; }
public static GameObject DrawHookshot(GameObject hookshotPrefab, Transform grappleHand, Vector3 to) { // Root trasnform location is hook location var hookshot = Instantiate(hookshotPrefab, to, Quaternion.identity); HookshotController hc = hookshot.GetComponent <HookshotController>(); if (hc == null) { Debug.LogError("No HookshotController on Hookshot prefab!"); } hc.Init(grappleHand, to); return(hookshot); }
void DrawRope() { if (!IsGrappling()) { DestroyActiveHookshot(); return; } // If the rope already exists, we only ever need to update the target; the hand transform is always the same (player's hand). if (activeHookshot != null) { HookshotController hc = activeHookshot.GetComponent <HookshotController>(); if (hc == null) { Debug.LogError("No hookshot controller on hookshot prefab!"); return; } hc.UpdateTarget(GetThisGrappleTarget()); return; } else { activeHookshot = HookshotController.DrawHookshot(hookshotPrefab, grappleHand, GetThisGrappleTarget()); } }
void Awake() { hookshotCtrl = GameManager.instance.hookshotCtrl; raycasts = GetComponent <Raycasts>(); }