public void ChangEQuip(Entity host, WeaponStatus trangthai) { if (trangthai == WeaponStatus.Pocket) { Host = host; OnBoVaoTui(); } if (trangthai == WeaponStatus.Free) { reset(); OnTuDo(); } if (trangthai == WeaponStatus.Equiping) { Host = host; transform.parent = host.transform; transform.position = host.PositionSpawnWeapon; if (GetComponent <PositionControl>() != null) { Destroy(GetComponent <PositionControl>()); } Notification.NoticeBelow(Languages.getString("DaTrangBi") + " <color=" + getColorNameByLevelWeapon(TypeOfWeapon) + ">" + nameOfWeapon + "</color>"); OnEquip(); } TrangThai = trangthai; }
IEnumerator ActivateWeapon(WeaponStatus weaponStatus) { var weapon = weaponStatus.WeaponObject; var model = weaponStatus.WeaponModel; if (Animator == null) { yield return(null); } _weaponActive = true; if (model != null) { model.SetActive(true); } weapon.gameObject.SetActive(true); Animator.SetBool(weapon.Data.AnimationFlag, true); yield return(new WaitForSeconds(weapon.Data.AnimationTime)); weapon.Attack(); Animator.SetBool(weapon.Data.AnimationFlag, false); weapon.gameObject.SetActive(false); if (model != null) { model.SetActive(false); } _weaponActive = false; }
public void Init(WeaponStatus status) { this.status = new WeaponStatus(status.target, status.damage, status.attack_range, status.attack_duration); }
public void Reload() { animator.SetTrigger("Reload"); weaponstate = WeaponStatus.Loading; Debug.Log("Reloading"); StartCoroutine(ReloadCountDown()); }
IEnumerator ReloadCountDown() { yield return(new WaitForSeconds(ReloadTime)); Debug.Log("ReloadCompelete"); CurrentAmmo = AmmoCapacity; weaponstate = WeaponStatus.ReadyToFire; }
public void Destroy() { status = WeaponStatus.IDLE; if (CachePool<Weapon>.Instance.ReturnObject (this)) gameObject.SetActive (false); else DestroyObject (gameObject); }
public void Init(WeaponStatus status) { this.status = new WeaponStatus(status.target, status.damage, status.attack_range, status.attack_duration); this.transform.localScale = new Vector3(2 * status.attack_range, 2 * status.attack_range, 2 * status.attack_range); }
//初期化関数 public override void Initialize(GameObject usingObj) { status = usingObj.GetComponentInParent <PlayerStatus>(); weaponStatus = usingObj.GetComponent <WeaponStatus>(); intervalTimer = 0; thretholdTime = weaponStatus.gunIntervalTime; preAttakcButton = false; bulletNum = bulletMaxNum; }
// Use this for initialization void Start() { instance = this; if (weaponMPProgress != null) { weaponMP = weaponMPProgress.width; } SubscribeEvents(); }
// Use this for initialization void Start() { gm = GameManager.instance; status = gm.weaponStatus; bulletBody = GetComponent <Rigidbody2D>(); bulletBody.velocity = bulletBody.transform.up * status.bulletSpeed; GetComponent <AudioSource>().Play(); }
public void Init(WeaponStatus status, int upgd_level) { this.status = new WeaponStatus(status.target, status.damage, status.attack_range, status.attack_duration); float r = 1.625f + 1.625f * this.status.attack_range; this.transform.localScale = new Vector3(r, r, r); reducedenemyspeedlevel = upgd_level; }
public override void Initialize(GameObject usingObj) { eneTree = usingObj.GetComponent <BaseEnemyTree>(); status = usingObj.GetComponent <EnemyStatus>(); weaponStat = usingObj.GetComponent <WeaponStatus>(); bulletPrefab = weaponStat.enemyBulletPrefab; shootCount = 0; intervalTimer = 0; thresholdTime = weaponStat.gunIntervalTime; anim = GetComponent <Animator>(); }
void FireCountDown() { if (IntervalCounter > 0) { IntervalCounter -= Time.deltaTime; } if (IntervalCounter <= 0) { weaponstate = WeaponStatus.ReadyToFire; } }
private void Awake() { anim = GetComponent <Animator>(); weapon = Instantiate(weaponPrototype, weaponHook); if (createView) { weaponStatus = Instantiate(weaponStatusPrototype, revolverStatusHook); weaponStatus.weapon = weapon; } }
IEnumerator Reload() { weaponStatus = WeaponStatus.Reloading; while (timeSinceLastShot < reloadTime) { timeSinceLastShot += Time.deltaTime; reloadBar.transform.localScale = new Vector3(timeSinceLastShot / reloadTime, reloadBar.transform.localScale.y, reloadBar.transform.localScale.z); yield return(null); } weaponStatus = WeaponStatus.Ready; timeSinceLastShot = 0; }
void Awake() { weaponStatus = WeaponStatus.Unarmed; velocity = Vector3.zero; forwardInput = sidewaysInput = turnInput = jumpInput = shootInput = 0; targetRotation = transform.rotation; playerRigidbody = gameObject.GetComponent <Rigidbody>(); reloadBar.transform.parent.GetComponent <Image>().enabled = false; reloadBar.GetComponent <Image>().enabled = false; }
// Use this for initialization void Start() { animator = GetComponentInParent <Animator>(); Muzzle = GetComponent <Transform>(); FireInterval = 60f / RPM; character = GetComponentInParent <Character>(); weaponstate = WeaponStatus.Down; CurrentAmmo = AmmoCapacity; IntervalCounter = 0; FireDir = Muzzle.forward; Recoil = Vector3.zero; }
void FixedUpdate() { switch (status) { case WeaponStatus.FIRE: LaunchProjectile (); status = WeaponStatus.RELOAD; weaponReloadedAt = Time.timeSinceLevelLoad + reloadTime; break; case WeaponStatus.RELOAD: if (Time.timeSinceLevelLoad >= weaponReloadedAt) status = WeaponStatus.IDLE; break; } }
public void ReceiveDamageInfo(int attackNum, float damage, WeaponStatus weapon) { if (hp > 0) { if (!monsterAttack.passive) { monsterAttack.target = GameObject.FindGameObjectWithTag("Player").transform; monsterAttack.onCombat = true; } for (int i = 0; i < playerAttack.Count; i++) { if (playerAttack[i] == attackNum) { Debug.Log("in1"); return; } } playerAttack.Add(attackNum); weapon.HitSuccessful(); hp -= damage; StopCoroutine(ResetCount()); StartCoroutine(ResetCount()); if (monsterMovement.canBeInterrupted == true && !monsterAttack.isAttacking) { bool fall = CheckForce(attackNum); if (!fall) { animator.SetTrigger("attacked"); } } if (hp <= 0) { isDead = true; } } }
public void Init(WeaponStatus status, Vector3 startpos) { this.status = new WeaponStatus(status.target, status.damage, status.attack_range, status.attack_duration); if (status.target.GetComponent <EnemyControl>() != null) { Debug.Log("enemy is target"); weapon_from_enemy = false; } else if (status.target.GetComponent <TowerControl>() != null) { Debug.Log("enemy is tower"); weapon_from_enemy = true; } this.transform.position = startpos; this.startpos = startpos; this.cango = true; }
// Update is called once per frame void FixedUpdate() { Recoil = Vector3.Lerp(Recoil, Vector3.zero, RecoilReturnSpeed * Time.deltaTime); FireDir = Muzzle.forward; switch (weaponstate) { case WeaponStatus.Down: break; case WeaponStatus.ReadyToFire: { //Fire(); if (IntervalCounter > 0) { weaponstate = WeaponStatus.Interval; } if (CurrentAmmo <= 0) { weaponstate = WeaponStatus.OutofAmmo; } break; } case WeaponStatus.Interval: { FireCountDown(); break; } case WeaponStatus.OutofAmmo: { Reload(); break; } case WeaponStatus.Loading: break; } }
public void Arm() { reloadBar.transform.parent.GetComponent <Image>().enabled = true; reloadBar.GetComponent <Image>().enabled = true; weaponStatus = WeaponStatus.Ready; }
public void Reload() { nextFireTime = Time.time + stats.reloadTime; weaponStatus = WeaponStatus.Reloading; AmmoUI.SetReloading(nextFireTime); }
public void FinishReload() { weaponStatus = WeaponStatus.Normal; magAmmo = stats.magazineSize; AmmoUI.UpdateAmmo(magAmmo); }
void Start() { playerStat = GetComponent <PlayerStatus>(); wStatus = GetComponentInChildren <WeaponStatus>(); }
public void Fire() { if (status == WeaponStatus.IDLE) status = WeaponStatus.FIRE; }
public void SetEquip(GameObject weapon) { equip = weapon; weaponStatus = equip.GetComponent <WeaponStatus>(); }
//初期化関数 public override void Initialize(GameObject callObj) { status = callObj.GetComponent <WeaponStatus>(); ammoText = GetComponentInChildren <Text>(); }