public BurstGenerator(BurstAttributes attributes, GameObject sourcePos, WeaponScript owner) { _attributes = attributes; _sourcePos = sourcePos; _ownerWeapon = owner; _ownerActor = owner.GetComponentInParent<ActorScript>(); }
public void GetModifierRangeForWeapon( WeaponScript.WeaponType weapon, out int start, out int end ) { switch( weapon ) { case WeaponScript.WeaponType.BEAM: start = (int)WeaponModifier.BEAM_WEP_START; end = (int)WeaponModifier.BEAM_WEP_END; break; case WeaponScript.WeaponType.LASER_MACHINE_GUN: start = (int)WeaponModifier.PROJ_WEP_START; end = (int)WeaponModifier.PROJ_WEP_END; break; case WeaponScript.WeaponType.MINE_LAUNCHER: start = (int)WeaponModifier.MINE_WEP_START; end = (int)WeaponModifier.MINE_WEP_END; break; case WeaponScript.WeaponType.MISSILE_LAUNCHER: start = (int)WeaponModifier.MISSILE_WEP_START; end = (int)WeaponModifier.MISSILE_WEP_END; break; case WeaponScript.WeaponType.SCATTER_SHOT: start = (int)WeaponModifier.SCATTER_WEP_START; end = (int)WeaponModifier.SCATTER_WEP_END; break; case WeaponScript.WeaponType.SNIPER: start = (int)WeaponModifier.PROJ_WEP_START; end = (int)WeaponModifier.PROJ_WEP_END; break; default: start = (int)WeaponModifier.PROJ_WEP_START; end = (int)WeaponModifier.PROJ_WEP_END; break; } }
void Start() { spriteRenderer = GetComponent<SpriteRenderer>(); weaponScript = GetComponentInChildren<WeaponScript>(); // should probably be set in inspector, but there are too many objects for that now weaponScript.muzzleVelocity = 3; }
void Start() { enemyScript = GetComponent<Enemy>(); enemyAnimator = GetComponentInChildren<Animator>(); weaponScript = GetComponentInChildren<WeaponScript>(); weaponList.Add(weaponScript); //SetWeapon = GetComponentInChildren<WeaponScript>(); }
public void ChangeWeapon(WeaponScript weaponScript) { //Stores a local copy of the weapon parameters for when bullets get fired _bulletSpeed = weaponScript.baseSpeed; _bulletPrefab = weaponScript.bulletPrefab; _fireDelay = weaponScript.fireDelay; _bulletDamage = weaponScript.damage; }
public WeaponInfo(WeaponScript.WeaponType weaponType, WeaponModifier.ModifierNames p_Modifier) { GameObject prefab = GameMaster.WeaponMngr.GetWeaponPrefab( weaponType ); weaponPrefab = prefab; WeaponModifier.GetModifiedName( p_Modifier, prefab.name, out name ); modifier = p_Modifier; attributes = new Dictionary<string, string>(); }
public BeamGenerator(BurstAttributes attributes, GameObject sourcePos, WeaponScript owner) : base(attributes, sourcePos, owner) { _renderer = sourcePos.AddComponent<LineRenderer>(); _renderer.material = new Material(Shader.Find("Self-Illumin/Diffuse")); _renderer.SetColors(Color.blue, Color.blue); _renderer.SetWidth(0.2f, 0.2f); _renderer.SetVertexCount(2); }
public void OnBeginDrag(PointerEventData eventData) { if (weapon != null) { iconBeingDragged = Instantiate(weaponIcon, this.transform.position, Quaternion.identity) as GameObject; iconBeingDragged.transform.SetParent (this.transform); weaponBeingDragged = weapon; } }
public bool addWeapon(WeaponScript weapon) { foreach (InventorySlotScript slot in slots) { if (slot.weapon == null) return slot.addWeapon(weapon); } return false; }
public void SetWeapon( GameObject weapon ) { RemoveWeapon(); weapon.transform.position = transform.position; weapon.transform.rotation = transform.rotation; weapon.transform.SetParent( transform ); m_weapon = weapon.GetComponent<WeaponScript>(); }
public bool addWeapon(WeaponScript weapon) { this.weapon = weapon; weaponIcon = this.weapon.weaponIcon; GetComponent<Image> ().sprite = weapon.weaponIcon.GetComponent<Image> ().sprite; if (PlayerScript.instance.weapon == null) PlayerScript.instance.attachWeapon (weapon); else this.weapon.gameObject.SetActive (false); GetComponent <Image> ().color = Color.white; return true; }
void Start() { //weaponScript = transform.Find("Weapon").GetComponent<WeaponScript>(); weaponScript = GetComponentInChildren<WeaponScript>(); Joystick = GetComponent<ControllerScript>(); healthObject = GameObject.Find("Health"); pauseObject = GameObject.Find("PauseMenu").transform.Find("Menu").gameObject; Controller = transform.GetComponent<CharacterController>(); characterAnimator = GetComponentInChildren<Animator>(); cameraObject = GameObject.Find("Camera Object"); }
public GameObject GetWeaponPrefab( WeaponScript.WeaponType type ) { if( (int)type < (int)WeaponScript.WeaponType.NUM_WEAPONS ) { return weaponPrefabs[ (int)type ]; } else { return weaponPrefabs[ (int)WeaponScript.WeaponType.LASER_MACHINE_GUN ]; } }
void Start() { startPos = this.gameObject.transform.position; endPos = endPos + startPos; float distance = Vector3.Distance (startPos, endPos); if (distance != 0) { speed = speed/distance; } weapon = GetComponent<WeaponScript>(); }
void Init() { agent = GetComponent<NavMeshAgent>(); animator = GetComponent<Animator>(); weapon = GameObject.Find("Weapon").GetComponent<WeaponScript>(); target = GameObject.Find("Player").transform; animator.SetFloat("X", 0); animator.SetFloat("Y", 0); phase = 1; }
protected override void Awake() { //_equipSlots = new EquipmentScript[typeof(EquipType)] base.Awake(); _equipSlots = new EquipmentScript[7]; helper = new HelperUtil(); mSingleton = this; shieldReactionTime = 0.2f; weaponScript = WeaponHand.GetComponent<WeaponScript>(); }
float upgradeMultiplier = 2; //Set through inspector! public override void Apply() { print(string.Format("UPGRADE UNLOCKED: '{0}'", upgradeName)); weapons = GameManager.Instance.weaponManager.weaponsOnPlayer; for (int i = 0; i < weapons.Length; i++) { if (weapons[i] != null) { weaponScript = weapons[i].GetComponent<WeaponScript>(); print("Old DAM: " + weaponScript.damage); weaponScript.damage = Mathf.FloorToInt(weaponScript.damage * upgradeMultiplier); print("New DAM: " + weaponScript.damage); } } print(string.Format("Weapon damage multiplied by {0}", upgradeMultiplier)); }
float upgradeMultiplier = 0.5f; //Set through inspector! public override void Apply() { print(string.Format("UPGRADE UNLOCKED: '{0}'", upgradeName)); weapons = GameManager.Instance.weaponManager.weaponsOnPlayer; for (int i = 0; i < weapons.Length; i++) { if (weapons[i] != null) { weaponScript = weapons[i].GetComponent<WeaponScript>(); print("OLD aimDamp: " + weaponScript.aimingDamp + " fovDamp: " + weaponScript.fovDamp); weaponScript.aimingDamp *= upgradeMultiplier; weaponScript.fovDamp *= (upgradeMultiplier / 2); print("NEW aimDamp: " + weaponScript.aimingDamp + " fovDamp: " + weaponScript.fovDamp); } } print(string.Format("AimDownSightSpeed multiplied by {0}", upgradeMultiplier)); }
[SerializeField] float upgradeMultiplier = 2; //Set through inspector! public override void Apply() { print(string.Format("UPGRADE UNLOCKED: '{0}'", upgradeName)); weapons = GameManager.Instance.weaponManager.weaponsOnPlayer; for (int i = 0; i < weapons.Length; i++) { if (weapons[i] != null) { weaponScript = weapons[i].GetComponent<WeaponScript>(); weaponScript.maxAmmoInClip = Mathf.FloorToInt(weaponScript.maxAmmoInClip * upgradeMultiplier); if (weaponScript.gameObject.activeInHierarchy) weaponScript.UpdateHudValues(); } } print(string.Format("AmmoClipSize multiplied by {0}", upgradeMultiplier)); }
void Start() { /* DEV SHIT GOES HERE */ //weapons = new WeaponScript[2]; /*weapons = new List<WeaponScript> (); weapons.Add (GameObject.Find ("MP9").GetComponent<WeaponScript> ()); weapons.Add (GameObject.Find ("MP5K").GetComponent<WeaponScript> ());*/ Weapon = GameObject.Find ("MP5K").GetComponent<WeaponScript> (); /* DEV SHIT GOES HERE */ originalPosition = GameObject.Find ("OriginalGunPosition"); adsPosition = GameObject.Find ("adsGunPosition"); Physics.IgnoreLayerCollision( LayerMask.NameToLayer("Bullet"), LayerMask.NameToLayer("IgnoreBullets") ); }
void Update() { GameCtrlScript.activeWeapon = weaponCounter; bool fire = false; if(Weapon.Automatic && Input.GetButton("Fire1")) { fire = true; } if(!Weapon.Automatic && Input.GetButtonDown("Fire1")) { fire = true; } if(fire && Weapon.CanFire()) { Screen.lockCursor = true; Weapon.Fire(); } for (int i = 0; i < weapons.Length; i++) { weapons[i].transform.localPosition = new Vector3(1000,0,0); } if (Input.GetButtonDown ("Weapon1")) weaponCounter -= 1; //weaponCounter = (weaponCounter + 1) % weapons.Length;//Weapon = weapons [0]; else if (Input.GetButtonDown ("Weapon2")) { //print (weaponCounter); weaponCounter += 1; //weaponCounter = (weaponCounter - 1) % weapons.Length;//Weapon = weapons[1]; } if(weaponCounter >= weapons.Length) weaponCounter -= weapons.Length; if(weaponCounter < 0) weaponCounter += weapons.Length; Weapon = weapons [weaponCounter]; gun = Weapon.gameObject; ads = Input.GetButton ("Fire2"); gun.transform.localPosition = ads ? //adsPosition.transform.localPosition : gun.transform.Find ("adsGunPosition").transform.localPosition : //originalPosition.transform.localPosition gun.transform.Find ("OriginalGunPosition").transform.localPosition ; gun.transform.localPosition += gunOffset; gunOffset -= gunOffset * 3f * Time.deltaTime; Camera.main.fieldOfView = ads ? 45 : 60; }
float upgradeMultiplier = 2; //Set through inspector! public override void Apply() { print(string.Format("UPGRADE UNLOCKED: '{0}'", upgradeName)); weapons = GameManager.Instance.weaponManager.weaponsOnPlayer; for (int i = 0; i < weapons.Length; i++) { if (weapons[i] != null) { weaponScript = weapons[i].GetComponent<WeaponScript>(); weaponScript.maxTotalAmmo = Mathf.FloorToInt(weaponScript.maxTotalAmmo * upgradeMultiplier); //Only do this for the weapon you are currently holding. Changed for upgrades to prevent the wrong info showing. if (weaponScript.gameObject.activeInHierarchy) weaponScript.UpdateHudValues(); } } print(string.Format("Total ammocap multiplied by {0}", upgradeMultiplier)); }
void OnTriggerEnter(Collider hit) { if (hit.CompareTag("Player")) { if(typeOfAmmo == AmmoType.Pistol) { weapon = wepManager.inventory[0].GetComponent<WeaponScript>(); weapon.IncreaseTotalAmmo(AmmoGiveAmount); } else if (typeOfAmmo == AmmoType.Shotgun) { weapon = wepManager.inventory[1].GetComponent<WeaponScript>(); weapon.IncreaseTotalAmmo(AmmoGiveAmount); } if (weapon.gameObject.activeInHierarchy) weapon.UpdateHudValues(); Destroy(gameObject); } }
public void OnDrop(PointerEventData eventData) { if (iconBeingDragged != null && iconBeingDragged.transform.parent.gameObject != this.gameObject) { GameObject parent = iconBeingDragged.transform.parent.gameObject; GameObject weaponIcon = this.weaponIcon; WeaponScript weapon = this.weapon; parent.GetComponent<Image>().sprite = this.GetComponent<Image>().sprite; parent.GetComponent<Image>().color = this.GetComponent<Image>().color; Destroy (iconBeingDragged); this.weapon = weaponBeingDragged; this.weaponIcon = weaponBeingDragged.weaponIcon; GetComponent<Image> ().sprite = this.weaponIcon.GetComponent<Image> ().sprite; GetComponent <Image> ().color = Color.white; if (weaponIcon != null) { parent.GetComponent<Image>().sprite = weaponIcon.GetComponent<Image>().sprite; } parent.GetComponent<InventorySlotScript>().weapon = weapon; parent.GetComponent<InventorySlotScript>().weaponIcon = weaponIcon; } }
public void Start() { moveScript = GetComponent<MoveScript>(); weaponScript = GetComponentInChildren<WeaponScript>(); spriteRenderer = GetComponent<SpriteRenderer>(); dying = false; cel = 1; celPeriod = 1 / animSpeed; celTime = 0; cycleCount = 0; if (leftBound > rightBound) { Debug.LogError("left bound greater than right bound!"); } GameManager.Instance.AdjustLives(lives); startPos = transform.position; startSpeed = moveScript.speed; }
// Update is called once per frame void Start() { fist = GetComponentInChildren <WeaponScript>(); }
private void Start() { // start with weapon sheathed weaponSocket.SetActive(!weaponSheathed); weapon = GetComponentInChildren <WeaponScript>(); }
// Use this for initialization void Start() { myWeaponScript = gameObject.GetComponent <WeaponScript>(); myNavScript = gameObject.GetComponent <EnemyNavScript>(); }
// Update is called once per frame void Update() { // Retrieve axis information // We use the default axis that can be redefined in // "Edit" -> "Project Settings" -> "Input". This will // return a value between [-1, 1], 0 being the idle // state, 1 the right, -1 the left. // Equivalent to button pressing (which only give 0 or 1), // whereas an axis gives a whole float. float inputX = Input.GetAxis("Horizontal"); float inputY = Input.GetAxis("Vertical"); // Movement per direction movement = new Vector2( speed.x * inputX, speed.y * inputY ); // Shooting bool shoot = Input.GetButtonDown("Fire1"); shoot |= Input.GetButtonDown("Fire2"); // Careful: For Mac users, ctrl + arrow is a bad idea if (shoot) { WeaponScript weapon = GetComponent <WeaponScript>(); if (weapon != null) { // false because the player is not an enemy weapon.Attack(false); // Sound! SoundEffectsHelper.Instance.MakePlayerShotSound(); } } // Make sure we are not outside the camera bounds var dist = (transform.position - Camera.main.transform.position).z; var leftBorder = Camera.main.ViewportToWorldPoint( new Vector3(0, 0, dist) ).x; var rightBorder = Camera.main.ViewportToWorldPoint( new Vector3(1, 0, dist) ).x; var topBorder = Camera.main.ViewportToWorldPoint( new Vector3(0, 0, dist) ).y; var bottomBorder = Camera.main.ViewportToWorldPoint( new Vector3(0, 1, dist) ).y; transform.position = new Vector3( Mathf.Clamp(transform.position.x, leftBorder, rightBorder), Mathf.Clamp(transform.position.y, topBorder, bottomBorder), transform.position.z ); }
public abstract void Initialize(WeaponScript weaponScript);
void Awake() { // Retrieve the weapon only once weapon = GetComponent <WeaponScript>(); }
public override void Initialize(WeaponScript weaponScript) { weapon = weaponScript; }
// Token: 0x06000A34 RID: 2612 RVA: 0x00052A2C File Offset: 0x00050C2C private void SpecialEffect(WeaponScript weapon, SanityType sanityType) { this.BloodEffect = this.OriginalBloodEffect; if (weapon.WeaponID == 14) { this.BloodEffect = weapon.HeartBurst; } if (weapon.Type == WeaponType.Knife) { if (!this.Stealth) { if (sanityType == SanityType.High) { if (this.EffectPhase == 0 && this.YandereAnim[this.AnimName].time > 1.06666672f) { this.Yandere.Bloodiness += 20f; this.Yandere.StainWeapon(); UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.1f, Quaternion.identity); this.EffectPhase++; return; } } else if (sanityType == SanityType.Medium) { if (this.EffectPhase == 0) { if (this.YandereAnim[this.AnimName].time > 2.16666675f) { this.Yandere.Bloodiness += 20f; this.Yandere.StainWeapon(); UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.1f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 1 && this.YandereAnim[this.AnimName].time > 3.0333333f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.1f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 0) { if (this.YandereAnim[this.AnimName].time > 2.76666665f) { this.Yandere.Bloodiness += 20f; this.Yandere.StainWeapon(); UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.1f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 1) { if (this.YandereAnim[this.AnimName].time > 3.5333333f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.1f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 2 && this.YandereAnim[this.AnimName].time > 4.16666651f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.1f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 0 && this.YandereAnim[this.AnimName].time > 0.966666639f) { this.Yandere.Bloodiness += 20f; this.Yandere.StainWeapon(); UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.1f, Quaternion.identity); this.EffectPhase++; return; } } else if (weapon.Type == WeaponType.Katana) { if (!this.Stealth) { if (sanityType == SanityType.High) { if (this.EffectPhase == 0 && this.YandereAnim[this.AnimName].time > 0.483333319f) { this.Yandere.Bloodiness += 20f; this.Yandere.StainWeapon(); UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.5f, Quaternion.identity); this.EffectPhase++; return; } } else if (sanityType == SanityType.Medium) { if (this.EffectPhase == 0) { if (this.YandereAnim[this.AnimName].time > 0.55f) { this.Yandere.Bloodiness += 20f; this.Yandere.StainWeapon(); UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.5f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 1 && this.YandereAnim[this.AnimName].time > 1.51666665f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.5f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 0) { if (this.YandereAnim[this.AnimName].time > 0.5f) { this.Yandere.Bloodiness += 20f; this.Yandere.StainWeapon(); UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.6666667f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 1) { if (this.YandereAnim[this.AnimName].time > 1f) { weapon.transform.localEulerAngles = new Vector3(0f, 180f, 0f); this.EffectPhase++; return; } } else if (this.EffectPhase == 2) { if (this.YandereAnim[this.AnimName].time > 2.33333325f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.6666667f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 3) { if (this.YandereAnim[this.AnimName].time > 2.73333335f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.6666667f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 4) { if (this.YandereAnim[this.AnimName].time > 3.13333344f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.6666667f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 5) { if (this.YandereAnim[this.AnimName].time > 3.5333333f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.6666667f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 6) { if (this.YandereAnim[this.AnimName].time > 4.133333f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.6666667f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 8 && this.YandereAnim[this.AnimName].time > 5f) { weapon.transform.localEulerAngles = Vector3.zero; this.EffectPhase++; return; } } else if (this.EffectPhase == 0) { if (this.YandereAnim[this.AnimName].time > 0.366666675f) { this.Yandere.Bloodiness += 20f; this.Yandere.StainWeapon(); UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.6666667f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 1 && this.YandereAnim[this.AnimName].time > 1f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.333333343f, Quaternion.identity); this.EffectPhase++; return; } } else if (weapon.Type == WeaponType.Bat) { if (this.Stealth) { this.Yandere.TargetStudent.Ragdoll.NeckSnapped = true; this.Yandere.TargetStudent.NeckSnapped = true; return; } if (sanityType == SanityType.High) { if (this.EffectPhase == 0 && this.YandereAnim[this.AnimName].time > 0.733333349f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.5f, Quaternion.identity); this.EffectPhase++; return; } } else if (sanityType == SanityType.Medium) { if (this.EffectPhase == 0) { if (this.YandereAnim[this.AnimName].time > 1f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.5f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 1 && this.YandereAnim[this.AnimName].time > 2.9666667f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.5f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 0) { if (this.YandereAnim[this.AnimName].time > 0.7f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.5f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 1) { if (this.YandereAnim[this.AnimName].time > 3.1f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.5f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 2) { if (this.YandereAnim[this.AnimName].time > 3.76666665f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.5f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 3 && this.YandereAnim[this.AnimName].time > 4.4f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.5f, Quaternion.identity); this.EffectPhase++; return; } } else if (weapon.Type == WeaponType.Saw) { if (!this.Stealth) { if (sanityType == SanityType.High) { if (this.EffectPhase == 0) { if (this.YandereAnim[this.AnimName].time > 0f) { weapon.Spin = true; this.EffectPhase++; return; } } else if (this.EffectPhase == 1) { if (this.YandereAnim[this.AnimName].time > 0.733333349f) { this.Yandere.Bloodiness += 20f; this.Yandere.StainWeapon(); weapon.BloodSpray[0].Play(); weapon.BloodSpray[1].Play(); this.EffectPhase++; return; } } else if (this.EffectPhase == 2 && this.YandereAnim[this.AnimName].time > 1.43333328f) { weapon.Spin = false; weapon.BloodSpray[0].Stop(); weapon.BloodSpray[1].Stop(); this.EffectPhase++; return; } } else if (sanityType == SanityType.Medium) { if (this.EffectPhase == 0) { if (this.YandereAnim[this.AnimName].time > 0f) { weapon.Spin = true; this.EffectPhase++; return; } } else if (this.EffectPhase == 1) { if (this.YandereAnim[this.AnimName].time > 1.1f) { this.Yandere.Bloodiness += 20f; this.Yandere.StainWeapon(); weapon.BloodSpray[0].Play(); weapon.BloodSpray[1].Play(); this.EffectPhase++; return; } } else if (this.EffectPhase == 2) { if (this.YandereAnim[this.AnimName].time > 1.43333328f) { weapon.BloodSpray[0].Stop(); weapon.BloodSpray[1].Stop(); this.EffectPhase++; return; } } else if (this.EffectPhase == 3) { if (this.YandereAnim[this.AnimName].time > 2.36666656f) { weapon.BloodSpray[0].Play(); weapon.BloodSpray[1].Play(); this.EffectPhase++; return; } } else if (this.EffectPhase == 4 && this.YandereAnim[this.AnimName].time > 2.4f) { weapon.Spin = true; weapon.BloodSpray[0].Stop(); weapon.BloodSpray[1].Stop(); this.EffectPhase++; return; } } else if (this.EffectPhase == 0) { if (this.YandereAnim[this.AnimName].time > 0f) { weapon.Spin = true; this.EffectPhase++; return; } } else if (this.EffectPhase == 1) { if (this.YandereAnim[this.AnimName].time > 0.6666667f) { this.Yandere.Bloodiness += 20f; this.Yandere.StainWeapon(); weapon.BloodSpray[0].Play(); weapon.BloodSpray[1].Play(); this.EffectPhase++; return; } } else if (this.EffectPhase == 2) { if (this.YandereAnim[this.AnimName].time > 0.733333349f) { weapon.BloodSpray[0].Stop(); weapon.BloodSpray[1].Stop(); this.EffectPhase++; return; } } else if (this.EffectPhase == 3) { if (this.YandereAnim[this.AnimName].time > 3f) { weapon.BloodSpray[0].Play(); weapon.BloodSpray[1].Play(); this.EffectPhase++; return; } } else if (this.EffectPhase == 4 && this.YandereAnim[this.AnimName].time > 4.866667f) { weapon.Spin = false; weapon.BloodSpray[0].Stop(); weapon.BloodSpray[1].Stop(); this.EffectPhase++; return; } } else if (this.EffectPhase == 0 && this.YandereAnim[this.AnimName].time > 1f) { this.Yandere.Bloodiness += 20f; this.Yandere.StainWeapon(); UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.right * 0.2f + weapon.transform.forward * -0.06666667f, Quaternion.identity); this.EffectPhase++; return; } } else if (weapon.Type == WeaponType.Weight) { if (this.Stealth) { this.Yandere.TargetStudent.Ragdoll.NeckSnapped = true; this.Yandere.TargetStudent.NeckSnapped = true; return; } if (sanityType == SanityType.High) { if (this.EffectPhase == 0 && this.YandereAnim[this.AnimName].time > 0.6666667f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.1f, Quaternion.identity); this.EffectPhase++; return; } } else if (sanityType == SanityType.Medium) { if (this.EffectPhase == 0) { if (this.YandereAnim[this.AnimName].time > 1f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.1f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 1 && this.YandereAnim[this.AnimName].time > 2.83333325f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.1f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 0) { if (this.YandereAnim[this.AnimName].time > 2.16666675f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.1f, Quaternion.identity); this.EffectPhase++; return; } } else if (this.EffectPhase == 1 && this.YandereAnim[this.AnimName].time > 4.16666651f) { UnityEngine.Object.Instantiate <GameObject>(this.BloodEffect, weapon.transform.position + weapon.transform.forward * 0.1f, Quaternion.identity); this.EffectPhase++; return; } } else if (weapon.Type == WeaponType.Garrote) { this.Yandere.TargetStudent.Ragdoll.NeckSnapped = true; this.Yandere.TargetStudent.NeckSnapped = true; } }
protected virtual void EnableWeaponCollider(WeaponScript weapon) { if (colliderSwitch) { weapon.GetComponent<BoxCollider>().enabled = true; colliderSwitch = false; } }
private void OnEnable() { targetweapon = target as WeaponScript; }
void Awake() { weapon = GetComponentInChildren <WeaponScript> (); }
// Start is called before the first frame update void Start() { weapon = GetComponent <WeaponScript>(); }
void Update() { if (health.hp > 0) { //Moviment float inputX = Input.GetAxis("Horizontal"); float inputY = Input.GetAxis("Vertical"); movement = new Vector2(speed.x * inputX, speed.y * inputY); if (Mathf.Abs(movement.x) > 0.01 || Mathf.Abs(movement.y) > 0.01) //0.01 = Error margin { animator.SetBool("Running", true); if (movement.x > 0.01) { transform.localScale = new Vector3(1f, 1f, 1f); weapon.toTheRight = true; } else if (movement.x < -0.01) { transform.localScale = new Vector3(-1f, 1f, 1f); weapon.toTheRight = false; } } else { animator.SetBool("Running", false); } //Jump bool inputJ = Input.GetButtonDown("Jump"); var pos = transform.position; if (inputJ && !jumping) { animator.SetBool("Jumping", true); jumping = true; velocity = impulse; yInitial = pos.y; } if (jumping) { pos.y += velocity; velocity -= gravity; if (pos.y <= yInitial) { jumping = false; animator.SetBool("Jumping", false); pos.y = yInitial; } } transform.position = pos; //Attack bool shoot = Input.GetButtonDown("Fire1"); if (shoot) { animator.SetBool("Attacking", true); WeaponScript weapon = GetComponentInChildren <WeaponScript>(); if (weapon != null && weapon.CanAttack) { //false because the player is not an enemy weapon.Attack(false); } } else { animator.SetBool("Attacking", false); } //Block bool inputB = Input.GetButton("Fire3"); if (inputB) { animator.SetBool("Defending", true); } else { animator.SetBool("Defending", false); } //Bounds /*var dist = (transform.position - Camera.main.transform.position).z; * var leftBorder = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, dist)).x; * var rightBorder = Camera.main.ViewportToWorldPoint(new Vector3(1, 0, dist)).x; * var topBorder = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, dist)).y; * var bottomBorder = Camera.main.ViewportToWorldPoint(new Vector3(0, 1, dist)).y; * transform.position = new Vector3( * Mathf.Clamp(transform.position.x, leftBorder, rightBorder), * Mathf.Clamp(transform.position.y, topBorder, bottomBorder), * transform.position.z);*/ } else { movement = new Vector2(0, 0); } //Disable Hurt and Dead Animation if (animator.GetCurrentAnimatorStateInfo(0).IsName("Hit")) { animator.SetBool("Hit", false); } if (animator.GetCurrentAnimatorStateInfo(0).IsName("Dead")) { animator.SetBool("Dead", false); } EnforceBounds(); }
void LoadWeapon() { // here we load the last weapon the user had equipped if (!reloading) { reloading = true; weaponInHand++; if (weaponInHand > 2) { weaponInHand = 0; } if (weaponInHand == 0) { if (macheteSpawn != null) { Destroy(macheteSpawn.gameObject); } if (shotgunSpawn != null) { Destroy(shotgunSpawn.gameObject); } WS = null; PlayerPrefs.SetString("currentWeapon", ""); } else if (weaponInHand == 1) { macheteSpawn = GameObject.Instantiate(Machete, HandNull.position, Quaternion.identity) as GameObject; macheteSpawn.transform.parent = HandNull; macheteSpawn.transform.rotation = HandNull.rotation; WS = macheteSpawn.GetComponent <WeaponScript>(); PlayerPrefs.SetString("currentWeapon", "machete"); if (shotgunSpawn != null) { Destroy(shotgunSpawn.gameObject); } } else if (weaponInHand == 2) { shotgunSpawn = GameObject.Instantiate(Shotgun, HandNull.position, Quaternion.identity) as GameObject; shotgunSpawn.transform.parent = HandNull; shotgunSpawn.transform.rotation = HandNull.rotation; WS = shotgunSpawn.GetComponent <WeaponScript>(); PlayerPrefs.SetString("currentWeapon", "shotgun"); if (macheteSpawn != null) { Destroy(macheteSpawn.gameObject); } } if (WS != null) { WS.ShowAmmunition(); } else { startScript.Ammunition = 0; } StartCoroutine(Pause(0.2f)); } }
// Update is called once per frame void Update() { // if(Input.GetKey(this.RightKey) && transform.position.x < arenaRef.spaceLimitHorizontal ) // { // transform.position = transform.position + transform.right * speed * Time.deltaTime; // } // if(Input.GetKey(this.LeftKey) && transform.position.x > -arenaRef.spaceLimitHorizontal ) // { // transform.position = transform.position - transform.right * speed * Time.deltaTime; // } // if(Input.GetKey(this.UpKey) && transform.position.y < arenaRef.spaceLimitUp ) // { // transform.position = transform.position + transform.up * speed * Time.deltaTime; // } // if(Input.GetKey(this.DownKey) && transform.position.y > -arenaRef.spaceLimitDown ) // { // transform.position = transform.position - transform.up * speed * Time.deltaTime; // } float speedVertical = Input.GetAxisRaw(verticalAxis); float speedHorizontal = Input.GetAxisRaw(horizontalAxis); if ((speedHorizontal > 0.5 || Input.GetKey(this.RightKey)) && transform.position.x < arenaRef.spaceLimitHorizontal && canMove) { transform.position = transform.position + transform.right * speed * Time.deltaTime; myAnimator.SetInteger("WalkState", 1); directionId = 1; if (!audios[0].isPlaying) { audios[0].Play(); } } else if ((speedHorizontal < -0.5 || Input.GetKey(this.LeftKey)) && transform.position.x > -arenaRef.spaceLimitHorizontal && canMove) { transform.position = transform.position - transform.right * speed * Time.deltaTime; myAnimator.SetInteger("WalkState", -1); directionId = -1; if (!audios[0].isPlaying) { audios[0].Play(); } } if ((speedVertical > 0.5 || Input.GetKey(this.UpKey)) && transform.position.y < arenaRef.spaceLimitUp && canMove) { transform.position = transform.position + transform.up * speed * Time.deltaTime; myAnimator.SetInteger("WalkState", 2); if (!audios[0].isPlaying) { audios[0].Play(); } } else if ((speedVertical < -0.5 || Input.GetKey(this.DownKey)) && transform.position.y > -arenaRef.spaceLimitDown && canMove) { transform.position = transform.position - transform.up * speed * Time.deltaTime; myAnimator.SetInteger("WalkState", 2); if (!audios[0].isPlaying) { audios[0].Play(); } } if (speedVertical > -0.5 && speedVertical < 0.5 && speedHorizontal > -0.5 && speedHorizontal < 0.5 && !Input.GetKey(UpKey) && !Input.GetKey(DownKey) && !Input.GetKey(LeftKey) && !Input.GetKey(RightKey) && canMove) { myAnimator.SetInteger("WalkState", 0); audios[0].Stop(); } if (!haveGun && ((Input.GetButtonDown(fireButton) || Input.GetKeyDown(FireKey)))) { canDig = false; canMove = false; diggingStartTime = Time.realtimeSinceStartup; myAnimator.SetBool("Digging", true); my2dPosition = new Vector2(transform.position.x, transform.position.y); audios[2].Play(); } if (Time.realtimeSinceStartup - diggingStartTime > diggingAnimationTime && !canMove) { canMove = true; myAnimator.SetBool("Digging", false); if (arenaRef.gunFound(my2dPosition)) { if (!x.alreadydo) { x.alreadydo = true; x.showdown = true; Time.timeScale = 0; baseclip.Stop(); this.nowclip.Play(); StartCoroutine(slowNow()); } haveGun = true; arenaRef.generateGunSpawn(); GameObject newWeapon = arenaRef.GetRandomWeapon(); newWeapon.transform.SetParent(transform); WeaponScript ws = newWeapon.GetComponent <WeaponScript>(); newWeapon.transform.localPosition = ws.localPosition; ws.SetControls(playerId, this); } else if (haveGun) { canDig = true; } } }
private void Awake() { weapon = GetComponent <WeaponScript>(); }
public void changeWeapon(WeaponScript weapon) { dropWeapon(); pickWeapon(weapon); }
void Start() { animator = GetComponent <Animator>(); weapon = GetComponent <WeaponScript>(); health = GetComponent <HealthScript>(); }
// Use this for initialization void Start() { player = transform.parent.gameObject.GetComponent <PlayerScript>(); sprite = GetComponent <SpriteRenderer>(); weapon = GetComponent <WeaponScript> (); }
// Update is called once per frame void Update() { nlife = GetComponent <PlayerInventory>().life; if (nlife > 0) { //SHOOT************************************************************** bool shoot = Input.GetButtonDown("Fire1"); //shoot |= Input.GetButtonDown("Fire2"); // Astuce pour ceux sous Mac car Ctrl + flèches est utilisé par le système if (shoot) { WeaponScript weapon = GetComponent <WeaponScript>(); if (weapon != null) { // false : le joueur n'est pas un ennemi weapon.Attack(false); } } //******************************************************************* //JUMPS************************************************************** grounded = Physics2D.OverlapCircle(groundCheck.position, groundCheckRadius, groundLayer); if (grounded == true) { countJumps = true; } if (grounded && (Input.GetKeyDown(KeyCode.UpArrow))) { // On verifie si l'utilisateur est au sol, et si l'input jump est en appui playerAnim.SetBool("IsGrounded", false); // On defini le parametre danimation IsGrounded a faux car nous nous aprettons a sauter playerRB.velocity = new Vector2(playerRB.velocity.x, 0f); // On defini la velocite y a 0 pour etre sur d'avoir la même hauteur quelque soit le contexte playerRB.AddForce(new Vector2(0, jumpPower), ForceMode2D.Impulse); // On ajoute de la force sur notre rigidbody afin de le faire s'envoler, on precise bien un forcement a impulse pour avoir toute la force d'un seul coup grounded = false; // On defini notre grounded a false pour garder en memoire l'etat du personnage countJumps = true; } if (canDoubleJumps) { if (countJumps == true && (Input.GetKeyDown(KeyCode.UpArrow))) { playerRB.velocity = new Vector2(playerRB.velocity.x, 0f); playerRB.AddForce(new Vector2(0, jumpPower), ForceMode2D.Impulse); countJumps = false; } } //******************************************************************* //print(countJumps); // on utilise ici notre moteur physique pour crér un petit cercle àn endroit bien precis(position du ground check personnage) // On defini aussi son radius pour dessiner le cercle // Et on defini le layer sur lequel on veut checker l'overlap // Si le cercle overlap avec le ground layer, ç va nous renvoyer vrai, car le player est au sol // Sinon cela veut dire que le personnage est en l'air // Cela va nous permetre aussi de declencer la condition permettant d'appliquer la force sur notre personnage //MOVEMENT************************************************************* playerAnim.SetBool("IsGrounded", grounded); // On utilise donc cette information pour mettre a jour note animator float move = Input.GetAxis("Horizontal"); // Rédiger ci dessous le code permettant de déerminer quand le player doit se retourner if (canMove == true) { if (move < 0 && facingRight || move > 0 && !facingRight) { Flip(); } playerRB.velocity = new Vector2(move * maxSpeed, playerRB.velocity.y); // On utilise playerAnim.SetFloat("MoveSpeed", Mathf.Abs(move)); // Defini une valeur pour le float MoveSpeed dans notre animator } else { playerRB.velocity = new Vector2(0, playerRB.velocity.y); // Si movement non autorise, on arrete la velocite playerAnim.SetFloat("MoveSpeed", 0); // on arrete aussi l'animation en cours si on etait en train de courir } //*********************************************************************** //SLEEP****************************************************************** targetTime -= Time.deltaTime; //print("Temps: " + targetTime); if (Input.GetAxis("Horizontal") == 0 && !(Input.GetKeyDown(KeyCode.UpArrow)) && targetTime <= 0) { playerAnim.SetBool("Sleep", true); } if (Input.GetAxis("Horizontal") != 0 || (Input.GetKeyDown(KeyCode.UpArrow))) { playerAnim.SetBool("Sleep", false); targetTime = 3; } //*********************************************************************** if (facingRight) { weapons.transform.eulerAngles = new Vector2(0, 0); weapons.transform.localPosition = new Vector2(0.2f, -0.02f); } else { weapons.transform.eulerAngles = new Vector2(0, 180); weapons.transform.localPosition = new Vector2(-0.2f, -0.02f); } } else { EndGame.MakeDead(); } }
// Es llamado al equipar la gema en un arma, se puede modificar valores del arma, o no hacer nada si solo se quiere modificar el proyectil. public abstract void ApplyEffectToWeapon(WeaponScript weapon);
// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.A)) { rb.velocity = new Vector2(-movespeed, rb.velocity.y); animation.enabled = true; player.transform.GetChild(1).gameObject.GetComponent <AudioSource>().Play(); } if (Input.GetKeyUp(KeyCode.A)) { animation.enabled = false; player.GetComponent <SpriteRenderer> ().sprite = four; player.transform.GetChild(1).gameObject.GetComponent <AudioSource>().Pause(); } if (Input.GetKeyUp(KeyCode.D)) { animation.enabled = false; player.GetComponent <SpriteRenderer> ().sprite = four; player.transform.GetChild(1).gameObject.GetComponent <AudioSource>().Pause(); } if (Input.GetKeyUp(KeyCode.W)) { animation.enabled = false; player.GetComponent <SpriteRenderer> ().sprite = four; player.transform.GetChild(1).gameObject.GetComponent <AudioSource>().Pause(); } if (Input.GetKey(KeyCode.D)) { rb.velocity = new Vector2(movespeed, rb.velocity.y); animation.enabled = true; player.transform.GetChild(1).gameObject.GetComponent <AudioSource>().Play(); } if (moveright) { rb.velocity = new Vector2(movespeed, rb.velocity.y); } if (moveleft) { rb.velocity = new Vector2(-movespeed, rb.velocity.y); } if (Input.GetKey(KeyCode.W)) { rb.velocity = new Vector2(rb.velocity.x, jumpheight); animation.enabled = true; player.transform.GetChild(1).gameObject.GetComponent <AudioSource>().Pause(); } if (jump) { rb.velocity = new Vector2(rb.velocity.x, jumpheight); jump = false; SoundEffectsHelper.Instance.MakeEnemyShotSound(); } if (Input.GetKeyDown(KeyCode.S)) { carriedObject = Instantiate(BULLET, SpawnPos.transform.position, SpawnPos.transform.rotation) as GameObject; carriedObject.gameObject.GetComponent <Rigidbody> ().isKinematic = false; carriedObject.gameObject.GetComponent <Rigidbody> ().useGravity = true; carriedObject.gameObject.GetComponent <Rigidbody> ().AddForce(SpawnPos.transform.right * 1000); Destroy(carriedObject, 1f); } // ... // - Shooting bool shoot = Input.GetButtonDown("Fire1"); shoot |= Input.GetButtonDown("Fire2"); // Careful: For Mac users, ctrl + arrow is a bad idea if (shoot) { WeaponScript weapon = GetComponent <WeaponScript>(); if (weapon != null) { // false because the player is not an enemy weapon.Attack(false); SoundEffectsHelper.Instance.MakeEnemyShotSound(); } } // ... }
// Es llamado al remover la gema de un arma, tiene que deshacer todos los efectos que se pusieron en ApplyEffectToWeapon. public abstract void RemoveEffectFromWeapon(WeaponScript weapon);
public override void Initialize(WeaponScript weaponScript) { weapon = weaponScript; _animationHash = Animator.StringToHash(animationTrigger); }
private void OnTriggerStay(Collider other) { if (this.Yandere.enabled) { bool flag = false; if (this.MissionMode.GameOverID == 0 && other.gameObject.layer == 13) { for (int i = 1; i < 4; i++) { WeaponScript weaponScript = this.Yandere.Weapon[i]; flag |= (weaponScript != null && weaponScript.Metal); if (!flag) { if (this.Yandere.Container != null && this.Yandere.Container.Weapon != null) { weaponScript = this.Yandere.Container.Weapon; flag = weaponScript.Metal; } if (this.Yandere.PickUp != null) { if (this.Yandere.PickUp.TrashCan != null && this.Yandere.PickUp.TrashCan.Weapon) { weaponScript = this.Yandere.PickUp.TrashCan.Item.GetComponent <WeaponScript>(); flag = weaponScript.Metal; } if (this.Yandere.PickUp.StuckBoxCutter != null) { weaponScript = this.Yandere.PickUp.StuckBoxCutter; flag = true; } } } } if (flag && !this.Yandere.Inventory.IDCard) { if (this.MissionMode.enabled) { this.MissionMode.GameOverID = 16; this.MissionMode.GameOver(); this.MissionMode.Phase = 4; base.enabled = false; return; } if (!this.Yandere.Sprayed) { this.MyAudio.clip = this.Alarm; this.MyAudio.loop = true; this.MyAudio.Play(); this.MyAudio.volume = 0.1f; AudioSource.PlayClipAtPoint(this.PepperSpraySFX, base.transform.position); if (this.Yandere.Aiming) { this.Yandere.StopAiming(); } this.PepperSprayEffect.transform.position = new Vector3(base.transform.position.x, this.Yandere.transform.position.y + 1.8f, this.Yandere.transform.position.z); this.Spraying = true; this.Yandere.CharacterAnimation.CrossFade("f02_sprayed_00"); this.Yandere.FollowHips = true; this.Yandere.Punching = false; this.Yandere.CanMove = false; this.Yandere.Sprayed = true; this.Yandere.StudentManager.YandereDying = true; this.Yandere.StudentManager.StopMoving(); this.Yandere.Blur.blurIterations = 1; this.Yandere.Jukebox.Volume = 0f; Time.timeScale = 1f; } } } } }
void Awake() { //Retrieve the weapon only once weapon = GetComponent<WeaponScript>(); }
// Token: 0x06000A33 RID: 2611 RVA: 0x000525E4 File Offset: 0x000507E4 private void Update() { if (this.IsAttacking()) { this.VictimAnim.CrossFade(this.VictimAnimName); if (this.Censor) { if (this.AttackTimer == 0f) { this.Yandere.Blur.enabled = true; this.Yandere.Blur.blurSize = 0f; this.Yandere.Blur.blurIterations = 0; } if (this.AttackTimer < this.YandereAnim[this.AnimName].length - 0.5f) { this.Yandere.Blur.blurSize = Mathf.MoveTowards(this.Yandere.Blur.blurSize, 10f, Time.deltaTime * 10f); if (this.Yandere.Blur.blurSize > (float)this.Yandere.Blur.blurIterations) { this.Yandere.Blur.blurIterations++; } } else { this.Yandere.Blur.blurSize = Mathf.Lerp(this.Yandere.Blur.blurSize, 0f, Time.deltaTime * 10f); if (this.Yandere.Blur.blurSize < (float)this.Yandere.Blur.blurIterations) { this.Yandere.Blur.blurIterations--; } } } this.AttackTimer += Time.deltaTime; WeaponScript equippedWeapon = this.Yandere.EquippedWeapon; SanityType sanityType = this.Yandere.SanityType; this.SpecialEffect(equippedWeapon, sanityType); if (sanityType == SanityType.Low) { this.LoopCheck(equippedWeapon); } this.SpecialEffect(equippedWeapon, sanityType); if (this.YandereAnim[this.AnimName].time > this.YandereAnim[this.AnimName].length - 0.333333343f) { this.YandereAnim.CrossFade("f02_idle_00"); equippedWeapon.Flip = false; } if (this.AttackTimer > this.YandereAnim[this.AnimName].length) { if (this.Yandere.TargetStudent == this.Yandere.StudentManager.Reporter) { this.Yandere.StudentManager.Reporter = null; } if (!this.Yandere.CanTranq) { this.Yandere.TargetStudent.DeathType = DeathType.Weapon; } else { this.Yandere.TargetStudent.Tranquil = true; this.Yandere.NoStainGloves = true; this.Yandere.CanTranq = false; this.Yandere.StainWeapon(); this.Yandere.Followers--; equippedWeapon.Type = WeaponType.Knife; } this.Yandere.TargetStudent.DeathCause = equippedWeapon.WeaponID; this.Yandere.TargetStudent.BecomeRagdoll(); this.Yandere.Sanity -= ((PlayerGlobals.PantiesEquipped == 10) ? 10f : 20f) * this.Yandere.Numbness; this.Yandere.Attacking = false; this.Yandere.FollowHips = false; this.Yandere.HipCollider.enabled = false; bool flag = false; if (this.Yandere.EquippedWeapon.Type == WeaponType.Bat) { flag = true; } if (!flag) { this.Yandere.EquippedWeapon.Evidence = true; } this.Victim = null; this.VictimAnimName = null; this.AnimName = null; this.Stealth = false; this.EffectPhase = 0; this.AttackTimer = 0f; this.Timer = 0f; this.CheckForSpecialCase(equippedWeapon); this.Yandere.Blur.enabled = false; this.Yandere.Blur.blurSize = 0f; if (equippedWeapon.Blunt) { this.Yandere.TargetStudent.Ragdoll.NeckSnapped = true; this.Yandere.TargetStudent.NeckSnapped = true; } if (!this.Yandere.Noticed) { this.Yandere.EquippedWeapon.MurderWeapon = true; this.Yandere.CanMove = true; return; } equippedWeapon.Drop(); } } }
// Update is called once per frame void Update() { if (player.shotLevel < 100) { WeaponScript weapon = GetComponent <WeaponScript> (); if (weapon != null) { weapon.shotPrefab = shotPrefab0; weapon.shootingRate = 0.35f; } } else if ((player.shotLevel >= 100) && (player.shotLevel < 200)) { if (player.shotElement == 0) { WeaponScript weapon = GetComponent <WeaponScript> (); if (weapon != null) { weapon.shotPrefab = shotPrefab0; weapon.shootingRate = 0.15f; } } else if (player.shotElement == 1) { WeaponScript weapon = GetComponent <WeaponScript> (); if (weapon != null) { weapon.shotPrefab = shotPrefab1; weapon.shootingRate = 0.3f; } } else if (player.shotElement == 2) { WeaponScript weapon = GetComponent <WeaponScript> (); if (weapon != null) { weapon.shotPrefab = shotPrefab2; weapon.shootingRate = 0.6f; } } else if (player.shotElement == 3) { WeaponScript weapon = GetComponent <WeaponScript> (); if (weapon != null) { weapon.shotPrefab = shotPrefab3; weapon.shootingRate = 0.25f; } } else if (player.shotElement == 4) { WeaponScript weapon = GetComponent <WeaponScript> (); if (weapon != null) { weapon.shotPrefab = shotPrefab4; weapon.shootingRate = 0.15f; } } } else if (player.shotLevel >= 200) { if (player.shotElement == 0) { WeaponScript weapon = GetComponent <WeaponScript> (); if (weapon != null) { weapon.shotPrefab = shotPrefab0; weapon.shootingRate = 0.15f; } optionShots = GetComponentsInChildren <WeaponScript> (); optionGraphics = GetComponentsInChildren <SpriteRenderer> (); if (optionShots[2] != null) { optionShots[2].shotPrefab = optionPrefab0; optionShots[2].shootingRate = 0.25f; } if (optionShots[1] != null) { optionShots[1].shotPrefab = optionPrefab0; optionShots[1].shootingRate = 0.25f; } if (optionGraphics [2] != null) { optionGraphics [2].color = new Color(1, 1, 1, 1); } if (optionGraphics [1] != null) { optionGraphics [1].color = new Color(1, 1, 1, 1); } } else if (player.shotElement == 1) { WeaponScript weapon = GetComponent <WeaponScript> (); if (weapon != null) { weapon.shotPrefab = shotPrefab1; weapon.shootingRate = 0.3f; } optionShots = GetComponentsInChildren <WeaponScript> (); optionGraphics = GetComponentsInChildren <SpriteRenderer> (); if (optionShots[2] != null) { optionShots[2].shotPrefab = optionPrefab1; optionShots[2].shootingRate = 0.35f; } if (optionShots[1] != null) { optionShots[1].shotPrefab = optionPrefab1; optionShots[1].shootingRate = 0.35f; } if (optionGraphics [2] != null) { optionGraphics [2].color = new Color(0, 1, 1, 1); } if (optionGraphics [1] != null) { optionGraphics [1].color = new Color(0, 1, 1, 1); } } else if (player.shotElement == 2) { WeaponScript weapon = GetComponent <WeaponScript> (); if (weapon != null) { weapon.shotPrefab = shotPrefab2; weapon.shootingRate = 0.5f; } optionShots = GetComponentsInChildren <WeaponScript> (); optionGraphics = GetComponentsInChildren <SpriteRenderer> (); if (optionShots[2] != null) { optionShots[2].shotPrefab = optionPrefab2; optionShots[2].shootingRate = 0.8f; } if (optionShots[1] != null) { optionShots[1].shotPrefab = optionPrefab2; optionShots[1].shootingRate = 0.8f; } if (optionGraphics [2] != null) { optionGraphics [2].color = new Color(0, 1, 0, 1); } if (optionGraphics [1] != null) { optionGraphics [1].color = new Color(0, 1, 0, 1); } } else if (player.shotElement == 3) { WeaponScript weapon = GetComponent <WeaponScript> (); if (weapon != null) { weapon.shotPrefab = shotPrefab3; weapon.shootingRate = 0.25f; } optionShots = GetComponentsInChildren <WeaponScript> (); optionGraphics = GetComponentsInChildren <SpriteRenderer> (); if (optionShots[2] != null) { optionShots[2].shotPrefab = optionPrefab3; optionShots[2].shootingRate = 0.7f; } if (optionShots[1] != null) { optionShots[1].shotPrefab = optionPrefab5; optionShots[1].shootingRate = 0.7f; } if (optionGraphics [2] != null) { optionGraphics [2].color = new Color(0.75f, 0, 1, 1); } if (optionGraphics [1] != null) { optionGraphics [1].color = new Color(0.75f, 0, 1, 1); } } else if (player.shotElement == 4) { WeaponScript weapon = GetComponent <WeaponScript> (); if (weapon != null) { weapon.shotPrefab = shotPrefab5; weapon.shootingRate = 0.15f; } optionShots = GetComponentsInChildren <WeaponScript> (); optionGraphics = GetComponentsInChildren <SpriteRenderer> (); if (optionShots[2] != null) { optionShots[2].shotPrefab = optionPrefab4; optionShots[2].shootingRate = 0.05f; } if (optionShots[1] != null) { optionShots[1].shotPrefab = optionPrefab4; optionShots[1].shootingRate = 0.05f; } if (optionGraphics [2] != null) { optionGraphics [2].color = new Color(1, 0.75f, 0.5f, 1); } if (optionGraphics [1] != null) { optionGraphics [1].color = new Color(1, 0.75f, 0.5f, 1); } } } }
// Token: 0x06000A35 RID: 2613 RVA: 0x00053F68 File Offset: 0x00052168 private void LoopCheck(WeaponScript weapon) { if (Input.GetButtonDown("X") && !this.Yandere.Chased && this.Yandere.Chasers == 0) { if (weapon.Type == WeaponType.Knife) { if (this.YandereAnim[this.AnimName].time > 3.5333333f && this.YandereAnim[this.AnimName].time < 4.16666651f) { this.LoopStart = 106f; this.LoopEnd = 125f; this.LoopPhase = 2; this.Loop = true; } } else if (weapon.Type == WeaponType.Katana) { if (this.YandereAnim[this.AnimName].time > 3.36666656f && this.YandereAnim[this.AnimName].time < 3.9f) { this.LoopStart = 101f; this.LoopEnd = 117f; this.LoopPhase = 5; this.Loop = true; } } else if (weapon.Type == WeaponType.Bat) { if (this.YandereAnim[this.AnimName].time > 3.76666665f && this.YandereAnim[this.AnimName].time < 4.4f) { this.LoopStart = 113f; this.LoopEnd = 132f; this.LoopPhase = 2; this.Loop = true; } } else if (weapon.Type == WeaponType.Saw) { if (this.YandereAnim[this.AnimName].time > 3.0333333f && this.YandereAnim[this.AnimName].time < 4.5666666f) { this.LoopStart = 91f; this.LoopEnd = 137f; this.LoopPhase = 3; this.PingPong = true; } } else if (weapon.Type == WeaponType.Weight && this.YandereAnim[this.AnimName].time > 3f && this.YandereAnim[this.AnimName].time < 4.5f) { this.LoopStart = 90f; this.LoopEnd = 135f; this.LoopPhase = 1; this.Loop = true; } } if (this.PingPong) { if (this.YandereAnim[this.AnimName].time > this.LoopEnd / 30f) { weapon.MyAudio.pitch = 1f + UnityEngine.Random.Range(0.1f, -0.1f); weapon.MyAudio.time = this.LoopStart / 30f; this.VictimAnim[this.VictimAnimName].speed = -1f; this.YandereAnim[this.AnimName].speed = -1f; this.EffectPhase = this.LoopPhase; this.AttackTimer = 0f; } else if (this.YandereAnim[this.AnimName].time < this.LoopStart / 30f) { weapon.MyAudio.pitch = 1f + UnityEngine.Random.Range(0.1f, -0.1f); weapon.MyAudio.time = this.LoopStart / 30f; this.VictimAnim[this.VictimAnimName].speed = 1f; this.YandereAnim[this.AnimName].speed = 1f; this.EffectPhase = this.LoopPhase; this.AttackTimer = this.LoopStart / 30f; this.EffectPhase = this.LoopPhase; this.PingPong = false; } } if (this.Loop && this.YandereAnim[this.AnimName].time > this.LoopEnd / 30f) { weapon.MyAudio.pitch = 1f + UnityEngine.Random.Range(0.1f, -0.1f); weapon.MyAudio.time = this.LoopStart / 30f; this.VictimAnim[this.VictimAnimName].time = this.LoopStart / 30f; this.YandereAnim[this.AnimName].time = this.LoopStart / 30f; this.AttackTimer = this.LoopStart / 30f; this.EffectPhase = this.LoopPhase; this.Loop = false; } }
private void Start() { _animator = GetComponent<Animator>(); _weapon = GetComponentInChildren<WeaponScript>(); }
internal static void InvokeShotFiredSecondary(WeaponScript weapon, int burstCount) => ShotFired?.Invoke(null, new WeaponFireEventArgs(weapon.gameObject) { IsPrimaryFire = false, BurstCount = burstCount });
protected virtual void DisableWeaponCollider(WeaponScript weapon) { weapon.GetComponent<BoxCollider>().enabled = false; }
public static WeaponParameters CreateWeaponSetInFolder(string folderPath, string weaponName) { WeaponScript baseWeaponPrefab = AssetDatabase.LoadAssetAtPath <WeaponScript>("Assets/Weapons/BaseWeapon.prefab"); return(CreateWeaponSetInFolder(folderPath, weaponName, baseWeaponPrefab)); }
// Use this for initialization void Start() { proximity = gameObject.GetComponent<Deactivation>(); controller = gameRules.GetComponent<GameRules>(); playerWeapon = controller.playerWeapon.GetComponent<WeaponScript>(); }
public static WeaponParameters CreateWeaponSetInFolder(string folderPath, string weaponName, WeaponScript linkedWeapon) { WeaponParameters weaponParams = ScriptableObject.CreateInstance <WeaponParameters>(); ShootParameters shootParams = ScriptableObject.CreateInstance <ShootParameters>(); ProjectileParameters projectileParams = ScriptableObject.CreateInstance <ProjectileParameters>(); weaponParams.weaponName = weaponName; weaponParams.SetWeaponPrefab(linkedWeapon); weaponParams.SetShootParameters(shootParams); ProjectileScript baseProjectilePrefab = AssetDatabase.LoadAssetAtPath <ProjectileScript>("Assets/Weapons/BaseProjectile.prefab"); shootParams.SetProjectilePrefab(baseProjectilePrefab); shootParams.SetProjectileParameters(projectileParams); string weaponPath = AssetDatabase.GenerateUniqueAssetPath(folderPath + "/" + weaponName + " Weapon Parameters.asset"); string shootPath = AssetDatabase.GenerateUniqueAssetPath(folderPath + "/" + weaponName + " Shoot Parameters.asset"); string projectilePath = AssetDatabase.GenerateUniqueAssetPath(folderPath + "/" + weaponName + " Projectiles Parameters.asset"); AssetDatabase.CreateAsset(weaponParams, weaponPath); AssetDatabase.CreateAsset(shootParams, shootPath); AssetDatabase.CreateAsset(projectileParams, projectilePath); EditorUtility.SetDirty(weaponParams); EditorUtility.SetDirty(shootParams); EditorUtility.SetDirty(projectileParams); return(weaponParams); }