public override void equip() { Viewmodel.play("equip"); this.help = (GameObject)UnityEngine.Object.Instantiate(Resources.Load(string.Concat("Prefabs/Structures/", Equipment.id)), Vector3.zero, base.transform.rotation); this.help.name = "help"; UnityEngine.Object.Destroy(this.help.transform.FindChild("model").collider); this.help.transform.FindChild("model").renderer.castShadows = false; this.help.transform.FindChild("model").renderer.receiveShadows = false; this.help.tag = "Untagged"; this.help.layer = 2; this.help.transform.FindChild("model").tag = "Untagged"; this.help.transform.FindChild("model").gameObject.layer = 2; if (this.help.transform.FindChild("nav")) { UnityEngine.Object.Destroy(this.help.transform.FindChild("nav").gameObject); } if (StructureStats.isLadder(Equipment.id)) { UnityEngine.Object.Destroy(this.help.transform.FindChild("model").FindChild("ladder").gameObject); } this.rotation = StructureStats.getRotation(Equipment.id); Transform transforms = this.help.transform; transforms.rotation = transforms.rotation * Quaternion.Euler(0f, (float)this.rotation, 0f); }
public override void startPrimary() { Equipment.busy = true; this.startedUse = Time.realtimeSinceStartup; NetworkSounds.askSound(string.Concat("Sounds/Items/", ItemSounds.getSource(Equipment.id), "/use"), Camera.main.transform.position + (Camera.main.transform.forward * 0.5f), 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 1f); Viewmodel.play("use"); }
public override void equip() { Viewmodel.play("equip"); this.marker = Equipment.model.transform.FindChild("model").FindChild("player").gameObject; if (PlayerSettings.arm) { this.marker.transform.parent.localScale = new Vector3(1f, -1f, 1f); } }
public override void startPrimary() { if (this.safe) { Equipment.busy = true; this.startedUse = Time.realtimeSinceStartup; Viewmodel.play("use"); } }
public override void startPrimary() { Physics.Raycast(Camera.main.transform.position + (Camera.main.transform.forward * -0.5f), Camera.main.transform.forward, out Jack.hit, 5f, -29365511); if (Jack.hit.collider != null && Jack.hit.collider.tag == "Vehicle" && Jack.hit.collider.GetComponent <Vehicle>().lastSpeed == 0) { this.target = Jack.hit.collider.gameObject; NetworkSounds.askSound(string.Concat("Sounds/Items/", ItemSounds.getSource(Equipment.id), "/use"), Camera.main.transform.position + (Camera.main.transform.forward * 0.5f), 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 1f); Equipment.busy = true; this.startedUse = Time.realtimeSinceStartup; Viewmodel.play("use"); } }
public override void startPrimary() { Physics.Raycast(Camera.main.transform.position + (Camera.main.transform.forward * -0.5f), Camera.main.transform.forward, out Gas.hit, 5f, -29365511); if (Gas.hit.collider != null && (Player.inventory.items[Equipment.equipped.x, Equipment.equipped.y].state == "f" && Gas.hit.collider.tag == "Vehicle" && Gas.hit.collider.GetComponent <Vehicle>().fuel < Gas.hit.collider.GetComponent <Vehicle>().maxFuel || Player.inventory.items[Equipment.equipped.x, Equipment.equipped.y].state == "e" && Gas.hit.collider.tag == "Vehicle" && Gas.hit.collider.GetComponent <Vehicle>().fuel >= 50 || Player.inventory.items[Equipment.equipped.x, Equipment.equipped.y].state == "e" && (Gas.hit.collider.name == "gasTank" || Gas.hit.collider.name == "gasPump"))) { this.target = Gas.hit.collider.gameObject; NetworkSounds.askSound(string.Concat("Sounds/Items/", ItemSounds.getSource(Equipment.id), "/use"), Camera.main.transform.position + (Camera.main.transform.forward * 0.5f), 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 1f); Equipment.busy = true; this.startedUse = Time.realtimeSinceStartup; Viewmodel.play("use"); } }
public override void startPrimary() { Physics.Raycast(Camera.main.transform.position + (Camera.main.transform.forward * -0.5f), Camera.main.transform.forward, out Fertilizer.hit, 5f, -29365511); if (Fertilizer.hit.collider != null && Fertilizer.hit.collider.tag == "Barricade" && ItemType.getType(int.Parse(Fertilizer.hit.collider.transform.parent.name)) == 22) { this.target = Fertilizer.hit.collider.gameObject; NetworkSounds.askSound(string.Concat("Sounds/Items/", ItemSounds.getSource(Equipment.id), "/use"), Camera.main.transform.position + (Camera.main.transform.forward * 0.5f), 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 1f); Equipment.busy = true; this.startedUse = Time.realtimeSinceStartup; Viewmodel.play("use"); } }
public override void equip() { Viewmodel.play("equip"); this.help = (GameObject)UnityEngine.Object.Instantiate(Resources.Load(string.Concat("Prefabs/Barricades/", Equipment.id)), Vector3.zero, base.transform.rotation); this.help.name = "help"; UnityEngine.Object.Destroy(this.help.transform.FindChild("model").collider); this.help.transform.FindChild("model").renderer.castShadows = false; this.help.transform.FindChild("model").renderer.receiveShadows = false; this.help.tag = "Untagged"; this.help.layer = 2; this.help.transform.FindChild("model").tag = "Untagged"; this.help.transform.FindChild("model").gameObject.layer = 2; if (this.help.transform.FindChild("model").GetComponent <Interactable>() != null) { UnityEngine.Object.Destroy(this.help.transform.FindChild("model").GetComponent <Interactable>()); } if (this.help.transform.FindChild("nav")) { UnityEngine.Object.Destroy(this.help.transform.FindChild("nav").gameObject); } if (this.help.transform.FindChild("nav2")) { UnityEngine.Object.Destroy(this.help.transform.FindChild("nav2").gameObject); } if (this.help.transform.FindChild("model").FindChild("clip")) { UnityEngine.Object.Destroy(this.help.transform.transform.FindChild("model").FindChild("clip").gameObject); } if (BarricadeStats.getElectric(Equipment.id)) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("Prefabs/Help/electricity")); gameObject.name = "electricity"; gameObject.transform.parent = this.help.transform.FindChild("model"); gameObject.transform.localPosition = Vector3.zero; gameObject.transform.localRotation = Quaternion.identity; } this.rotation = BarricadeStats.getRotation(Equipment.id); Transform transforms = this.help.transform; transforms.rotation = transforms.rotation * Quaternion.Euler(0f, (float)this.rotation, 0f); }
public override void trigger() { int num = Player.inventory.hasSpace(new ServerItem(int.Parse(base.name), 1, string.Empty, Vector3.zero)); if (num == 0) { if (Equipment.model == null) { Viewmodel.play("take"); } SpawnItems.takeItem(base.gameObject); } else if (num == 1) { //HUDGame.openError(Texts.ERROR_NO_SPACE, "Textures/Icons/errror"); } else if (num == 2) { //HUDGame.openError(Texts.ERROR_NO_WEIGHT, "Textures/Icons/errror"); } }
public override void startPrimary() { if (Player.inventory.items[Equipment.equipped.x, Equipment.equipped.y].state != "f") { Physics.Raycast(Camera.main.transform.position + (Camera.main.transform.forward * -0.5f), Camera.main.transform.forward, out Refillable.hit, 5f, -29365511); if (Refillable.hit.collider != null && (Refillable.hit.point.y < Ocean.level || Refillable.hit.collider.name == "well_0")) { this.self = false; Equipment.busy = true; this.startedUse = Time.realtimeSinceStartup; Viewmodel.play("use"); } } else { this.self = true; NetworkSounds.askSound(string.Concat("Sounds/Items/", ItemSounds.getSource(Equipment.id), "/use"), Camera.main.transform.position + (Camera.main.transform.forward * 0.5f), 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 1f); Equipment.busy = true; this.startedUse = Time.realtimeSinceStartup; Viewmodel.play("drink"); } }
public void Update() { if (base.networkView.isMine) { if ((Player.life.dead || Movement.isSwimming || Movement.isClimbing || Movement.isDriving) && Equipment.model != null) { Equipment.dequip(); } if (Equipment.model != null) { if (!Equipment.ready) { Equipment.ready = true; Equipment.model.transform.FindChild("model").renderer.enabled = true; Equipment.useable.equip(); Equipment.ticking = true; } else if (Equipment.ticking) { if (Equipment.setup) { Equipment.useable.tick(); } else if (Time.realtimeSinceStartup - Equipment.startedEquip > Viewmodel.model.animation["equip"].length) { Equipment.setup = true; } } if (Input.GetKeyDown(InputSettings.dropKey)) { int num = Equipment.equipped.x; int num1 = Equipment.equipped.y; Equipment.dequip(); SpawnItems.dropItem(num, num1, Input.GetKey(InputSettings.otherKey)); } else if (Input.GetKeyDown(InputSettings.itemKey)) { Equipment.dequip(); } } if (Screen.lockCursor && !Player.life.dead) { if (Input.GetKeyDown(KeyCode.Alpha1)) { Equipment.equip(0, 0); } if (Input.GetKeyDown(KeyCode.Alpha2)) { Equipment.equip(1, 0); } if (Input.GetKeyDown(KeyCode.Alpha3)) { Equipment.equip(2, 0); } if (Input.GetKeyDown(KeyCode.Alpha4)) { Equipment.equip(3, 0); } if (Input.GetKeyDown(KeyCode.Alpha5)) { Equipment.equip(4, 0); } if (Input.GetKeyDown(KeyCode.Alpha6)) { Equipment.equip(5, 0); } if (!Equipment.busy && Equipment.setup) { if (Equipment.useable != null) { if (Input.GetKeyDown(InputSettings.shootKey)) { Equipment.useable.startPrimary(); } if (Input.GetKeyUp(InputSettings.shootKey)) { Equipment.useable.stopPrimary(); } if (Input.GetKeyDown(InputSettings.aimKey)) { Equipment.useable.startSecondary(); } if (Input.GetKeyUp(InputSettings.aimKey)) { Equipment.useable.stopSecondary(); } } else if (!Player.life.dead && !Movement.isSwimming && !Movement.isClimbing && Movement.vehicle == null && Stance.state != 2) { if (Input.GetKeyDown(InputSettings.shootKey) && !this.swinging) { this.swinging = true; this.right = false; } if (Input.GetKeyDown(InputSettings.aimKey) && !this.swinging) { this.swinging = true; this.right = true; } } } } if (this.swung && Time.realtimeSinceStartup - this.lastSwing > Viewmodel.model.animation["punchRight"].length / 2f) { NetworkSounds.askSound("Sounds/Items/8001/use", Camera.main.transform.position + (Camera.main.transform.forward * 0.5f), 0.25f, UnityEngine.Random.Range(0.9f, 1.1f), 1f); this.swung = false; Physics.Raycast(Camera.main.transform.position + (Camera.main.transform.forward * -0.5f), Camera.main.transform.forward, out Equipment.hit, 2f, RayMasks.DAMAGE); if (Equipment.hit.collider != null) { if (Equipment.hit.point.y < Ocean.level) { NetworkSounds.askSound("Sounds/Impacts/rock", Equipment.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/bubbles", Equipment.hit.point + (Equipment.hit.normal * 0.05f), Quaternion.LookRotation(Equipment.hit.normal), -1f); } else if (Equipment.hit.collider.gameObject.name == "ground" || Equipment.hit.collider.material.name.ToLower() == "rock (instance)" || Equipment.hit.collider.material.name.ToLower() == "ground (instance)") { NetworkSounds.askSound("Sounds/Impacts/rock", Equipment.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/rock", Equipment.hit.point + (Equipment.hit.normal * 0.05f), Quaternion.LookRotation(Equipment.hit.normal), -1f); } else if (Equipment.hit.collider.material.name.ToLower() == "cloth (instance)") { NetworkSounds.askSound("Sounds/Impacts/concrete", Equipment.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/cloth", Equipment.hit.point + (Equipment.hit.normal * 0.05f), Quaternion.LookRotation(Equipment.hit.normal), -1f); } else if (Equipment.hit.collider.material.name.ToLower() == "wood (instance)") { NetworkSounds.askSound("Sounds/Impacts/wood", Equipment.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/splinters", Equipment.hit.point + (Equipment.hit.normal * 0.05f), Quaternion.LookRotation(Equipment.hit.normal), -1f); } else if (Equipment.hit.collider.material.name.ToLower() == "tile (instance)") { NetworkSounds.askSound("Sounds/Impacts/concrete", Equipment.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/tile", Equipment.hit.point + (Equipment.hit.normal * 0.05f), Quaternion.LookRotation(Equipment.hit.normal), -1f); } else if (Equipment.hit.collider.material.name.ToLower() == "concrete (instance)") { NetworkSounds.askSound("Sounds/Impacts/concrete", Equipment.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/concrete", Equipment.hit.point + (Equipment.hit.normal * 0.05f), Quaternion.LookRotation(Equipment.hit.normal), -1f); } else if (Equipment.hit.collider.material.name.ToLower() == "metal (instance)" || Equipment.hit.collider.material.name.ToLower() == "iron (instance)") { NetworkSounds.askSound("Sounds/Impacts/metal", Equipment.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/sparks", Equipment.hit.point + (Equipment.hit.normal * 0.05f), Quaternion.LookRotation(Equipment.hit.normal), -1f); } else if (Equipment.hit.collider.material.name.ToLower() == "flesh (instance)") { NetworkSounds.askSound("Sounds/Impacts/flesh", Equipment.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/flesh", Equipment.hit.point + (Equipment.hit.normal * 0.05f), Quaternion.LookRotation(Equipment.hit.normal), -1f); } if (Equipment.hit.collider.tag == "Enemy" && ServerSettings.pvp) { int limb = OwnerFinder.getLimb(Equipment.hit.collider.gameObject); GameObject owner = OwnerFinder.getOwner(Equipment.hit.collider.gameObject); if (owner != null && owner.GetComponent <Player>().action != 4 && (PlayerSettings.friend == string.Empty || PlayerSettings.friendHash != owner.GetComponent <Player>().owner.friend)) { if (!Network.isServer) { base.networkView.RPC("punchPlayer", RPCMode.Server, new object[] { owner.GetComponent <Player>().owner.id, limb }); } else { this.punchPlayer(owner.GetComponent <Player>().owner.id, limb); } } } else if (Equipment.hit.collider.tag == "Animal") { int limb1 = OwnerFinder.getLimb(Equipment.hit.collider.gameObject); GameObject gameObject = OwnerFinder.getOwner(Equipment.hit.collider.gameObject); if (gameObject != null && !gameObject.GetComponent <AI>().dead) { if (!Network.isServer) { base.networkView.RPC("punchAnimal", RPCMode.Server, new object[] { gameObject.networkView.viewID, limb1 }); } else { this.punchAnimal(gameObject.networkView.viewID, limb1); } } } } } if (!this.swinging || Time.realtimeSinceStartup - this.lastSwing <= Viewmodel.model.animation["punchRight"].length) { this.swinging = false; } else { this.swinging = false; this.lastSwing = Time.realtimeSinceStartup; this.swung = true; if (!this.right) { Viewmodel.play("punchLeft"); if (Stance.state == 0) { Player.play("standPunchLeft"); } else if (Stance.state == 1) { Player.play("crouchPunchLeft"); } } else { Viewmodel.play("punchRight"); if (Stance.state == 0) { Player.play("standPunchRight"); } else if (Stance.state == 1) { Player.play("crouchPunchRight"); } } } } }
public override void stopSecondary() { Viewmodel.play("stopLook"); //HUDGame.binoculars = false; Look.fov = 0f; }
public override void equip() { Viewmodel.play("equip"); }
public override void stopPrimary() { this.swinging = false; Viewmodel.play("stop"); }
public override void startPrimary() { this.swinging = true; Viewmodel.play("start"); }
public override void tick() { if (this.swung && Time.realtimeSinceStartup - this.lastSwing > Viewmodel.model.animation["swingWeak"].length / 2f) { NetworkSounds.askSound(string.Concat("Sounds/Items/", ItemSounds.getSource(Equipment.id), "/use"), Camera.main.transform.position + (Camera.main.transform.forward * 0.5f), 0.25f, UnityEngine.Random.Range(0.9f, 1.1f), 1f); this.swung = false; Physics.Raycast(Camera.main.transform.position + (Camera.main.transform.forward * -0.5f), Camera.main.transform.forward, out Flashlight.hit, MeleeStats.getRange(Equipment.id) + 0.5f, RayMasks.DAMAGE); if (Flashlight.hit.collider != null) { if (Flashlight.hit.point.y < Ocean.level) { NetworkSounds.askSound("Sounds/Impacts/rock", Flashlight.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/bubbles", Flashlight.hit.point + (Flashlight.hit.normal * 0.05f), Quaternion.LookRotation(Flashlight.hit.normal), -1f); } else if (Flashlight.hit.collider.gameObject.name == "ground" || Flashlight.hit.collider.material.name.ToLower() == "rock (instance)" || Flashlight.hit.collider.material.name.ToLower() == "ground (instance)") { NetworkSounds.askSound("Sounds/Impacts/rock", Flashlight.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/rock", Flashlight.hit.point + (Flashlight.hit.normal * 0.05f), Quaternion.LookRotation(Flashlight.hit.normal), -1f); } else if (Flashlight.hit.collider.material.name.ToLower() == "cloth (instance)") { NetworkSounds.askSound("Sounds/Impacts/concrete", Flashlight.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/cloth", Flashlight.hit.point + (Flashlight.hit.normal * 0.05f), Quaternion.LookRotation(Flashlight.hit.normal), -1f); } else if (Flashlight.hit.collider.material.name.ToLower() == "wood (instance)") { NetworkSounds.askSound("Sounds/Impacts/wood", Flashlight.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/splinters", Flashlight.hit.point + (Flashlight.hit.normal * 0.05f), Quaternion.LookRotation(Flashlight.hit.normal), -1f); } else if (Flashlight.hit.collider.material.name.ToLower() == "tile (instance)") { NetworkSounds.askSound("Sounds/Impacts/concrete", Flashlight.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/tile", Flashlight.hit.point + (Flashlight.hit.normal * 0.05f), Quaternion.LookRotation(Flashlight.hit.normal), -1f); } else if (Flashlight.hit.collider.material.name.ToLower() == "concrete (instance)") { NetworkSounds.askSound("Sounds/Impacts/concrete", Flashlight.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/concrete", Flashlight.hit.point + (Flashlight.hit.normal * 0.05f), Quaternion.LookRotation(Flashlight.hit.normal), -1f); } else if (Flashlight.hit.collider.material.name.ToLower() == "metal (instance)" || Flashlight.hit.collider.material.name.ToLower() == "iron (instance)") { NetworkSounds.askSound("Sounds/Impacts/metal", Flashlight.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/sparks", Flashlight.hit.point + (Flashlight.hit.normal * 0.05f), Quaternion.LookRotation(Flashlight.hit.normal), -1f); } else if (Flashlight.hit.collider.material.name.ToLower() == "flesh (instance)") { NetworkSounds.askSound("Sounds/Impacts/flesh", Flashlight.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/flesh", Flashlight.hit.point + (Flashlight.hit.normal * 0.05f), Quaternion.LookRotation(Flashlight.hit.normal), -1f); } if (Flashlight.hit.collider.name == "ground" || Flashlight.hit.collider.tag == "Prop" || Flashlight.hit.collider.tag == "World" || Flashlight.hit.collider.tag == "Environment" || Flashlight.hit.collider.tag == "Global") { NetworkEffects.askEffect("Effects/hole", Flashlight.hit.point + (Flashlight.hit.normal * UnityEngine.Random.Range(0.04f, 0.06f)), Quaternion.LookRotation(Flashlight.hit.normal) * Quaternion.Euler(0f, 0f, (float)UnityEngine.Random.Range(0, 360)), 20f); } if (Flashlight.hit.collider.tag == "Enemy" && ServerSettings.pvp) { int limb = OwnerFinder.getLimb(Flashlight.hit.collider.gameObject); GameObject owner = OwnerFinder.getOwner(Flashlight.hit.collider.gameObject); if (owner != null && owner.GetComponent <Player>().action != 4 && (PlayerSettings.friend == string.Empty || PlayerSettings.friendHash != owner.GetComponent <Player>().owner.friend)) { if (!Network.isServer) { base.networkView.RPC("swingPlayer", RPCMode.Server, new object[] { owner.GetComponent <Player>().owner.id, limb }); } else { this.swingPlayer(owner.GetComponent <Player>().owner.id, limb); } } } else if (Flashlight.hit.collider.tag == "Animal") { int num = OwnerFinder.getLimb(Flashlight.hit.collider.gameObject); GameObject gameObject = OwnerFinder.getOwner(Flashlight.hit.collider.gameObject); if (gameObject != null && !gameObject.GetComponent <AI>().dead) { if (!Network.isServer) { base.networkView.RPC("swingAnimal", RPCMode.Server, new object[] { gameObject.networkView.viewID, num }); } else { this.swingAnimal(gameObject.networkView.viewID, num); } } } } } if (!this.swinging || Time.realtimeSinceStartup - this.lastSwing <= Viewmodel.model.animation["swingWeak"].length) { this.swinging = false; } else { this.swinging = false; this.lastSwing = Time.realtimeSinceStartup; this.swung = true; Viewmodel.play("swingWeak"); if (Stance.state == 0) { Player.play("standMelee"); } else if (Stance.state == 1) { Player.play("crouchMelee"); } else if (Stance.state == 2) { Player.play("proneMelee"); } } }
public override void equip() { Viewmodel.play("equip"); this.sync(); }
public override void tick() { if (this.swung) { if (Time.realtimeSinceStartup - this.lastSwing > (!this.lastStrong ? Viewmodel.model.animation["swingWeak"].length / 2f : Viewmodel.model.animation["swingStrong"].length / 2f)) { NetworkSounds.askSound(string.Concat("Sounds/Items/", ItemSounds.getSource(Equipment.id), "/use"), Camera.main.transform.position + (Camera.main.transform.forward * 0.5f), 0.25f, UnityEngine.Random.Range(0.9f, 1.1f), 1f); this.swung = false; Physics.Raycast(Camera.main.transform.position + (Camera.main.transform.forward * -0.5f), Camera.main.transform.forward, out Melee.hit, MeleeStats.getRange(Equipment.id) + 0.5f, RayMasks.DAMAGE); if (Melee.hit.collider != null) { if (Melee.hit.point.y < Ocean.level) { NetworkSounds.askSound("Sounds/Impacts/rock", Melee.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/bubbles", Melee.hit.point + (Melee.hit.normal * 0.05f), Quaternion.LookRotation(Melee.hit.normal), -1f); } else if (Melee.hit.collider.gameObject.name == "ground" || Melee.hit.collider.material.name.ToLower() == "rock (instance)" || Melee.hit.collider.material.name.ToLower() == "ground (instance)") { NetworkSounds.askSound("Sounds/Impacts/rock", Melee.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/rock", Melee.hit.point + (Melee.hit.normal * 0.05f), Quaternion.LookRotation(Melee.hit.normal), -1f); } else if (Melee.hit.collider.material.name.ToLower() == "cloth (instance)") { NetworkSounds.askSound("Sounds/Impacts/concrete", Melee.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/cloth", Melee.hit.point + (Melee.hit.normal * 0.05f), Quaternion.LookRotation(Melee.hit.normal), -1f); } else if (Melee.hit.collider.material.name.ToLower() == "wood (instance)") { NetworkSounds.askSound("Sounds/Impacts/wood", Melee.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/splinters", Melee.hit.point + (Melee.hit.normal * 0.05f), Quaternion.LookRotation(Melee.hit.normal), -1f); } else if (Melee.hit.collider.material.name.ToLower() == "tile (instance)") { NetworkSounds.askSound("Sounds/Impacts/concrete", Melee.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/tile", Melee.hit.point + (Melee.hit.normal * 0.05f), Quaternion.LookRotation(Melee.hit.normal), -1f); } else if (Melee.hit.collider.material.name.ToLower() == "concrete (instance)") { NetworkSounds.askSound("Sounds/Impacts/concrete", Melee.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/concrete", Melee.hit.point + (Melee.hit.normal * 0.05f), Quaternion.LookRotation(Melee.hit.normal), -1f); } else if (Melee.hit.collider.material.name.ToLower() == "metal (instance)" || Melee.hit.collider.material.name.ToLower() == "iron (instance)") { NetworkSounds.askSound("Sounds/Impacts/metal", Melee.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/sparks", Melee.hit.point + (Melee.hit.normal * 0.05f), Quaternion.LookRotation(Melee.hit.normal), -1f); } else if (Melee.hit.collider.material.name.ToLower() == "flesh (instance)") { NetworkSounds.askSound("Sounds/Impacts/flesh", Melee.hit.point, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 0.25f); NetworkEffects.askEffect("Effects/flesh", Melee.hit.point + (Melee.hit.normal * 0.05f), Quaternion.LookRotation(Melee.hit.normal), -1f); } if (Melee.hit.collider.name == "ground" || Melee.hit.collider.tag == "Prop" || Melee.hit.collider.tag == "World" || Melee.hit.collider.tag == "Environment" || Melee.hit.collider.tag == "Global") { NetworkEffects.askEffect("Effects/hole", Melee.hit.point + (Melee.hit.normal * UnityEngine.Random.Range(0.04f, 0.06f)), Quaternion.LookRotation(Melee.hit.normal) * Quaternion.Euler(0f, 0f, (float)UnityEngine.Random.Range(0, 360)), 20f); } if (Melee.hit.collider.tag == "Barricade") { //HUDGame.lastStructmarker = Time.realtimeSinceStartup; if (!Network.isServer) { base.networkView.RPC("swingBarricade", RPCMode.Server, new object[] { Melee.hit.collider.transform.parent.position, this.lastStrong }); } else { this.swingBarricade(Melee.hit.collider.transform.parent.position, this.lastStrong); } } else if (Melee.hit.collider.tag == "Structure") { //HUDGame.lastStructmarker = Time.realtimeSinceStartup; if (!Network.isServer) { base.networkView.RPC("swingStructure", RPCMode.Server, new object[] { Melee.hit.collider.transform.parent.position, this.lastStrong }); } else { // FIXME: client stuff? //this.swingStructure(Melee.hit.collider.transform.parent.position, this.lastStrong); } } else if (Melee.hit.collider.tag == "Enemy" && ServerSettings.pvp) { int limb = OwnerFinder.getLimb(Melee.hit.collider.gameObject); GameObject owner = OwnerFinder.getOwner(Melee.hit.collider.gameObject); if (owner != null && owner.GetComponent <Player>().action != 4 && (PlayerSettings.friend == string.Empty || PlayerSettings.friendHash != owner.GetComponent <Player>().owner.friend)) { //HUDGame.lastHitmarker = Time.realtimeSinceStartup; if (!Network.isServer) { base.networkView.RPC("swingPlayer", RPCMode.Server, new object[] { owner.GetComponent <Player>().owner.id, limb, this.lastStrong }); } else { this.swingPlayer(owner.GetComponent <Player>().owner.id, limb, this.lastStrong); } } } else if (Melee.hit.collider.tag == "Animal") { int num = OwnerFinder.getLimb(Melee.hit.collider.gameObject); GameObject gameObject = OwnerFinder.getOwner(Melee.hit.collider.gameObject); if (gameObject != null && !gameObject.GetComponent <AI>().dead) { //HUDGame.lastHitmarker = Time.realtimeSinceStartup; if (!Network.isServer) { base.networkView.RPC("swingAnimal", RPCMode.Server, new object[] { gameObject.networkView.viewID, num, this.lastStrong }); } else { this.swingAnimal(gameObject.networkView.viewID, num, this.lastStrong); } } } else if (Melee.hit.collider.tag == "Vehicle" && Melee.hit.collider.GetComponent <Vehicle>().health > 0 && ServerSettings.pvp) { //HUDGame.lastHitmarker = Time.realtimeSinceStartup; if (!Network.isServer) { base.networkView.RPC("swingVehicle", RPCMode.Server, new object[] { Melee.hit.collider.networkView.viewID, this.lastStrong }); } else { this.swingVehicle(Melee.hit.collider.networkView.viewID, this.lastStrong); } } } } } if (this.swinging && Movement.vehicle == null && (!this.strong || Player.life.stamina >= 10 - (int)(Player.skills.endurance() * 10f))) { if (Time.realtimeSinceStartup - this.lastSwing <= (!this.lastStrong ? Viewmodel.model.animation["swingWeak"].length : Viewmodel.model.animation["swingStrong"].length)) { this.swinging = false; return; } if (this.strong) { Player.life.exhaust(10 - (int)(Player.skills.endurance() * 10f)); } this.lastStrong = this.strong; this.swinging = false; this.lastSwing = Time.realtimeSinceStartup; this.swung = true; if (!this.strong) { Viewmodel.play("swingWeak"); } else { Viewmodel.play("swingStrong"); } if (Stance.state == 0) { Player.play("standMelee"); } else if (Stance.state == 1) { Player.play("crouchMelee"); } else if (Stance.state == 2) { Player.play("proneMelee"); } return; } this.swinging = false; }
public override void startSecondary() { Viewmodel.play("startLook"); //HUDGame.binoculars = true; Look.fov = GameSettings.fov - 90f + 80f; }
public override void stopPrimary() { this.swinging = false; Equipment.model.transform.FindChild("bluefire").GetComponent <ParticleSystem>().Stop(); Viewmodel.play("stop"); }