public void EffectUpdate() { am = getAM(); if (am == null) { return; } if (am.effectsFolder == null) { am.effectsFolder = am.gameObject; } splodes = getAM().effectsFolder.GetComponentsInChildren <HitEffect>(true); hitAliases = new string[splodes.Length]; if (shots.Length == 0) { hitAliases = new string[1]; hitAliases[0] = "No Effects in Effects Folder"; } for (int i = 0; i < splodes.Length; i++) { hitAliases[i] = splodes[i].getAlias(); } }
void MuzzleBang(Transform Muzzle) { if (AmmoManager.checkAlias(fireEffectAlias)) { Instantiate(AmmoManager.getHit(fireEffectAlias).gameObject, Muzzle.position, Muzzle.rotation); } }
public void AmmoUpdate() { am = getAM(); if (am == null) { return; } if (am.ammoFolder == null) { am.ammoFolder = am.gameObject; } shots = getAM().ammoFolder.GetComponentsInChildren <Ammunition>(true); ammoAliases = new string[shots.Length]; if (shots.Length == 0) { ammoAliases = new string[1]; ammoAliases[0] = "No Ammo in Ammo Folder"; } for (int i = 0; i < shots.Length; i++) { ammoAliases[i] = shots[i].getAlias(); } }
void FixedUpdate() { float horizontal = Input.GetAxis(horizontalAxis); float vertical = Input.GetAxis(verticalAxis); Vector3 direction = new Vector3(horizontal, 0, vertical); theBody.AddForce(direction.normalized * maxSpeed); theBody.velocity = new Vector3( Mathf.Clamp(theBody.velocity.x, -maxSpeed, maxSpeed), Mathf.Clamp(theBody.velocity.y, -maxSpeed, maxSpeed), Mathf.Clamp(theBody.velocity.z, -maxSpeed, maxSpeed)); if (mouseLook) { Vector3 mousePositionInScreen = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0.0f); Vector3 mousePositionInWorld = Camera.main.ScreenToWorldPoint(mousePositionInScreen); mousePositionInWorld = new Vector3(mousePositionInWorld.x, 0.0f, mousePositionInWorld.z); Vector3 positionToLook = mousePositionInWorld - theTransform.position; theTransform.localRotation = Quaternion.LookRotation(positionToLook.normalized, Vector3.up); } if (Input.GetButtonDown(fireAxis) && canFire) { foreach (Transform transform in weaponTransforms) { AmmoManager.SpawnAmmo(transform.position, transform.rotation); } canFire = false; Invoke("EnableFire", reloadDelay); } }
/* Spawn Ammo/Weapon for Enemy*/ public void Shoot(bool Enemy) { foreach (Transform T in transform) { AmmoManager.SpawnAmmoEnemy(T.position, T.rotation, this); } }
// setup everything void Start() { ammoManager = weapon.GetComponent <AmmoManager>(); ammo = ammoManager.AmmoCount(); MaxCount = ammo; Count = ammo; for (int i = 0; i < Count; i++) { GameObject ThisIndicator = Instantiate(IndicatorGameObject, gameObject.transform.position, Quaternion.Euler(0f, 0f, ((360f / (float)MaxCount) * i))) as GameObject; //ThisIndicator.transform.parent = gameObject.transform; ThisIndicator.transform.SetParent(gameObject.transform); ThisIndicator.transform.localScale = new Vector3(1f, 1f, 1f); Images.Add(gameObject.transform.GetChild(i).gameObject.GetComponent <Image>()); } if (CounterClockWise) { RotateDirection = -1f; } else { RotateDirection = 1f; Images.Reverse(); } }
private void Start() { if (GetComponentInParent <AmmoManager>() != null) { ammoManager = GetComponentInParent <AmmoManager>(); } }
// Update is called once per frame void Update() { //firing turret if (Input.GetButtonDown(FireAxis) && CanFire) { AmmoManager.SpawnAmmo(transform.position, transform.rotation); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.UpArrow) && (AmmoManager.GetAmmoCount() > 0)) { Instantiate(Projectile, FirePoint.position, FirePoint.rotation); AmmoManager.AddAmmo(-1); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.RightControl) && AmmoManager.Ammo > 0) { AmmoManager.SubtractPoints(PointsToSubtract); Instantiate(Projectiles, FirePoint.position, FirePoint.rotation); } }
private void Awake() { if (instance != null) { Destroy(this); } instance = this; }
// Use this for initialization void Start() { enemyColors = new List <float>(); score = GameObject.FindObjectOfType <Score>(); enemyCounter = 0; enemiesAllowed = 0; AmmoManager.UpdateAmmo(5, 5); }
//接口----------------------------------- public void Shoot() { if (!isWorking) { return; } AmmoManager.GenerateAmmo(GunPivot.position, transform.up, ammoSpeed, id, tank.campFlag); }
//public GameObject ammoPrefab = null; // Update is called once per frame void Update() { if (Input.GetButtonDown("Fire1")) { AmmoManager.SpawnAmmo(transform.position, transform.rotation); //Instantiate(ammoPrefab, transform.position, transform.rotation); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.LeftControl) && AmmoManager.Ammo > 0) { AmmoManager.RemovePoints(PointsToRemove); Instantiate(Projectile, FirePoint.position, FirePoint.rotation); } }
// Able to shoot void Update() { if (Input.GetKeyDown(KeyCode.RightControl) && AmmoManager.Ammo > 0) { Instantiate(Projectile, FirePoint.position, FirePoint.rotation); AmmoManager.SubAmmo(1); } }
private void Shooting() { currentDeltaTime += Time.deltaTime; if (AmmoManager.instance.magazine > 0 && currentDeltaTime >= timeDelay && Input.GetMouseButtonDown(0)) { AmmoManager.SpawnAmmo(transform.position, transform.rotation); currentDeltaTime = 0f; } }
/// <summary> /// Function that instanciate the amunition prefab whenever the player press fire1 /// </summary> private void SpawnAmmo() { if (Input.GetButtonDown("Fire1")) { //Instantiate(ammunition, transform.position,transform.rotation); //we now go through the ammomanager instead of instanciating ammunition into the scene via this function. AmmoManager.SpawnAmmo(transform.position, transform.rotation); } }
void OnTriggerEnter2D(Collider2D Other) { if (Other.GetComponent <Rigidbody2D> () == null) { return; } AmmoManager.AddPoints(AmmoToAdd); }
private void Awake() { if (AmmoManagerSingleton != null) { DestroyImmediate(gameObject); return; } AmmoManagerSingleton = this; }
void Awake() { if (ammoManagerSingelton != null) { DestroyImmediate(gameObject); return; } ammoManagerSingelton = this; }
void Awake() { ammo = 30; RemainingAmmo = 100; SystemMesUI = GameObject.Find("SystemMesUI"); TimerDisPlay = SystemMesUI.GetComponent <TimerDisPlay>(); AmmoManagerObject = GameObject.Find("AmmoManager"); AmmoManager = AmmoManagerObject.GetComponent <AmmoManager>(); }
private void Start() { player = GameObject.FindGameObjectWithTag("Player"); GameObject gameOver = GameObject.Find("GameOver Panel"); score = GameObject.FindObjectOfType <Score>(); core = GameObject.FindObjectOfType <Core>(); ammoManager = GetComponentInChildren <AmmoManager>(); }
void Start() { playMissileClicker2 = FindObjectOfType <PlayerMissileClicker>(); ammoManager2 = FindObjectOfType <AmmoManager>(); middleShooter2 = GameObject.FindGameObjectWithTag("MiddlePlayer"); leftShooter2 = GameObject.FindGameObjectWithTag("LeftPlayer"); rightShooter2 = GameObject.FindGameObjectWithTag("RightPlayer"); }
void FixedUpdate() { if (Input.GetKey(KeyCode.Space) && canFire) { AudioSource.PlayClipAtPoint(laserAudio, transform.position); AmmoManager.SpawnAmmo(transform.position, transform.rotation); canFire = false; Invoke("EnableFire", reloadDelay); } }
void OnTriggerEnter2D(Collider2D other) { if (other.GetComponent <Rigidbody2D>() == null) { return; } AmmoManager.AddPoints(PointsToAdd); Destroy(gameObject); }
private void Awake() { if (ammoManagerSingleton != null) { Destroy(this.gameObject); return; } ammoManagerSingleton = this; }
void OnTriggerEnter2D(Collider2D Other) { if (Other.GetComponent <CharacterMove> () == null) { return; } AmmoManager.AddAmmo(AmmoToAdd); Destroy(gameObject); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } }
void OnTriggerEnter2D(Collider2D Other) { if (Other.GetComponent <CharacterMove> () == null) { return; } print("Ammo Value:" + AmmoValue); AmmoManager.AddAmmo(AmmoValue); Destroy(gameObject); }