public void reloadHandler(GrappleScript grappleScript) { if (gunXrotVelocity == 0 && (grappleScript.grappleState == GrappleScript.GrappleState.REST || grappleScript.grappleState == GrappleScript.GrappleState.REELING) && ammo < 3) { gunXrotVelocity = 100; ammo = 3; } }
void Start() { playerScript = GetComponent <PlayerScript>(); inputScript = GetComponent <InputScript>(); gunScript = transform.GetComponentInChildren <GunScript>(); grappleScript = transform.GetComponentInChildren <GrappleScript>(); xRotation = 0f; }
void Start() { gun = transform.GetChild(0).gameObject; grapple = transform.GetChild(1).gameObject; playerScript = GetComponent <PlayerScript>(); gunScript = gun.GetComponent <GunScript>(); grappleScript = grapple.GetComponent <GrappleScript>(); }
private void CreateGrapple(GameObject target) { if (grappleScript == null) { currentHook = grapplePool.GetPooledObject(); currentHook.transform.position = transform.position; currentHook.transform.rotation = Quaternion.identity; currentHook.SetActive(true); grappleScript = currentHook.GetComponent <GrappleScript>(); } grappleScript.CreateGrapple(target, disJoint); }
void Start() { gun = transform.GetChild(0).gameObject; grapple = transform.GetChild(1).gameObject; gunScript = gun.GetComponent <GunScript>(); grappleScript = grapple.GetComponent <GrappleScript>(); grenadeManagerScript = GameObject.Find("Grenade Manager").GetComponent <GrenadeManagerScript>(); gunTrigger = false; grappleTrigger = false; jump = false; health = 3; }
public void ActivateItemEffect(string itemName) { switch (itemName) { default: case "": Debug.Log("nill effect"); break; case "Running Shoes": break; case "Grapple": GrappleScript gscript = GetComponent <GrappleScript>(); if (!gscript.isGrappling) { gscript.FireGrapple(); } else { gscript.ReleaseGrapple(); } break; case "Parachute": GetComponent <FpsMovement>().ToggleParachute(false); RemoveItem(itemName); break; case "Toy Bell": break; case "Sticky Noisemaker": GameObject obj = Instantiate(Resources.Load("DecoyAlarm"), Camera.main.transform.position, new Quaternion(0, 0, 0, 0)) as GameObject; CTimer escript = obj.GetComponent <CTimer>(); escript.OnLookInteract(); RemoveItem(itemName); break; case "Remote Control": break; } }
public void shootHandler(GrappleScript grappleScript, bool shoot) { if (gunXrotation < 0) { gunXrotVelocity += .1f; inactive = false; } else { gunXrotVelocity = 0; inactive = true; } if (shoot && gunXrotVelocity == 0 && (grappleScript.grappleState == GrappleScript.GrappleState.REST || grappleScript.grappleState == GrappleScript.GrappleState.REELING) && ammo > 0) { ammo--; Physics.Raycast(transform.position + transform.forward, transform.forward, out RaycastHit raycastHit); gunParticle.transform.position = raycastHit.point; if (raycastHit.collider.tag == "Obstacle") { Destroy(raycastHit.collider.gameObject); } else if (raycastHit.collider.tag == "LocalPlayer" || raycastHit.collider.tag == "Bot") { hitEvent.Invoke(); if (transform.parent.tag == "Bot") { bool hitTeam = raycastHit.collider.GetComponent <BotScript>().spawnIndex < 5; bool myTeam = transform.parent.GetComponent <BotScript>().spawnIndex < 5; if (hitTeam != myTeam) { raycastHit.collider.gameObject.GetComponent <PlayerScript>().health--; } } } gunParticle.Play(); gunXrotVelocity = -shotDuration; } gunXrotation += gunXrotVelocity; transform.localRotation = Quaternion.Euler(new Vector3(gunXrotation, 0, 0)); }
public void ActivateItemEffect(int itemId, int itemIndex) { bool validIndex = false; if (itemIndex < 0 || itemIndex > inventory.Count) { validIndex = false; } switch (itemId) { //case 0: default: Debug.Log("nill effect"); break; case 0: Debug.Log("Running Shoes effect"); break; case 1: Debug.Log("grapple effect"); GrappleScript gscript = GetComponent <GrappleScript>(); if (!gscript.isGrappling) { gscript.FireGrapple(); } else { gscript.ReleaseGrapple(); } break; case 2: FpsMovement fpsMoveScript = GetComponent <FpsMovement>(); if (!fpsMoveScript.useParachute) { if (!GetComponent <CharacterController>().isGrounded) { fpsMoveScript.ToggleParachute(true); } } else { fpsMoveScript.ToggleParachute(false); RemoveItem(itemId); } break; case 3: Debug.Log("Toy Bell effect"); break; case 4: Debug.Log("Sticky Noisemaker effect"); GameObject obj = Instantiate(Resources.Load("DecoyAlarm"), Camera.main.transform.position, new Quaternion(0, 0, 0, 0)) as GameObject; CTimer escript = obj.GetComponent <CTimer>(); escript.OnLookInteract(); if (validIndex == false) { RemoveItem(itemId); } else { RemoveKnownItem(itemIndex); } break; case 5: Debug.Log("Remote Controll effect"); break; } }
// Use this for initialization void Start() { myRigid = this.GetComponent<Rigidbody2D>(); center = this.transform.FindChild("AimingParent"); rigids = new Rigidbody2D[grapples.Length]; edges = new EdgeCollider2D[grapples.Length]; lines = new LineRenderer[grapples.Length]; springs = new SpringJoint2D[grapples.Length]; int i = 0; foreach (GameObject g in grapples) { rigids[i] = g.GetComponent<Rigidbody2D>(); edges[i] = g.GetComponent<EdgeCollider2D>(); lines[i] = g.GetComponent<LineRenderer>(); springs[i] = g.GetComponent<SpringJoint2D>(); i++; } grappleArm.gameObject.SetActive (false); firedGrapple = GameObject.Find("Grapple" + this.GetComponent<player>().playerid); firedGrappleScript = firedGrapple.GetComponent<GrappleScript>(); grappleRigid = firedGrapple.GetComponent<Rigidbody2D>(); firedGrappleScript.focus = this.gameObject; }
void Start() { grapple = GetComponent <GrappleScript>(); cam = Camera.main; arm = GameObject.FindGameObjectWithTag("Arm"); }
void Start() { grapple = GetComponent <GrappleScript>(); cam = Camera.main; }