private void Update() { if (!isPointerOut) { movementTime += Time.deltaTime; } if (isPointerOut) { timePassed += Time.deltaTime; // after feedbackTime seconds float feedbackTime = .3f; if (timePassed > feedbackTime) { // make pointer and target disappear trialManager.isPointerVisible = false; // pointer disappears // target disappears target target = GameObject.FindObjectOfType <target>(); target.isVisible = false; pointer.isVisible = false; //trialManager.movePointerWithMouse = true; trialManager.isTrialStarted = false; } } }
public static void loadImage(Image elem, string path, target target) { // CARA PAKAI // loadImage(<component image>, path) if (path == "") { MessageBox.Show("ERR! Can't load image :)", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (target == target.item) { path = getItemImagePath(path); } if (target == target.seller) { path = getSellerImagePath(path); } if (target == target.customer) { path = getCustomerImagePath(path); } using (var stream = new FileStream(path, FileMode.Open)) { BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.StreamSource = stream; bitmapImage.EndInit(); bitmapImage.Freeze(); elem.Source = bitmapImage; } }
void shoot() { //var newbullet = Instantiate(bulletPrefab, (transform.position + transform.up * 1.5f + transform.forward), Quaternion.identity); // Destroy(newbullet, 2f); shaker.Triggershake(); muzzleFlash.Play(); currentAmmo--; ammo--; RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { Debug.Log(hit.transform.name); target target = hit.transform.GetComponent <target>(); if (target != null) { target.TakeDamage(damage); } if (hit.rigidbody != null) { hit.rigidbody.AddForce(-hit.normal * impactForce); } GameObject impactGO = Instantiate(impactEffect, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(impactGO, 2f); } }
IEnumerator waitSpawner() { yield return(new WaitForSeconds(startwait)); // wait for sstartwait and then executes the code bellow while (!stopSpawn) { CurrentShape = Random.Range(0, shape.Length); CurrentspawnPosition = new Vector3(Random.Range(-randomPosition.x, randomPosition.x), 1, Random.Range(-randomPosition.z, randomPosition.z)); CurrentMaterial = Random.Range(0, material.Length); GameObject holderShape = shape[CurrentShape]; target t = holderShape.transform.GetComponent <target>(); if (t != null) { t.changeMaterial(material[CurrentMaterial]); Instantiate(holderShape, CurrentspawnPosition + transform.TransformPoint(0, 0, 0), gameObject.transform.rotation); } yield return(new WaitForSeconds(spawnRate)); } }
void Shoot() { RaycastHit hit; //Calcula8r damage respecte temperatura damage = (damageMax - damageMin) * curve.Evaluate(heat) + damageMin; //Definir segons la funcio que volguem utilitzar pel calor i com crear-la. heat += heatStep; Debug.Log(curve.Evaluate(heat)); //Feedback jugador CameraShaker.Instance.Shake(screenShakeTime, screenShakeForce); muzzleFlash.Play(); //Calcular fisiques del raycast if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { Debug.Log(hit.transform.name); target _target = hit.transform.GetComponent <target>(); if (_target != null) { _target.takeDamage(damage, impactForce, hit.point, hit.normal); } } //Feedback post dispar fpsCam.GetComponent <CamLook>().Recoil(recoilForce); GameObject impactGo = Instantiate(impactParticle, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(impactGo, 1); }
public void main() { var m = new target(std, "David"); m.hello(); m.goodbye(); }
protected int nearestPlayer(PointF spot, target target, int exceptThisPlayer) { int nearestPlayersID = -1; double nearestDistance = double.MaxValue; List <int> players = null; switch (target) { case target.allPlayers: players = allPlayers; break; case target.myPlayers: players = myPlayers; break; case target.opositePlayers: players = opositePlayers; break; } for (int i = 0; i < players.Count; i++) { if (players[i] == exceptThisPlayer) { continue; } double playersDistance = getDistanceSquared(locations[players[i]], spot); if (playersDistance < nearestDistance) { nearestDistance = playersDistance; nearestPlayersID = players[i]; } } return(nearestPlayersID); }
public void Start() { t = this.gameObject.GetComponent <target>(); nonchange = this.gameObject; }
void Update() { if (isDestinationReached()) { Destroy(gameObject); return; } transform.Translate(Vector3.forward * speed * Time.deltaTime); if (destination != Vector3.zero) { return; } RaycastHit hit; if (Physics.Raycast(transform.position, transform.forward, out hit, 5f)) { CheckDistructable(hit); target target = hit.transform.GetComponent <target>(); if (target != null) { target.TakeDamage(damage); } } if (hit.rigidbody != null) { hit.rigidbody.AddForce(-hit.normal * impactforces); } }
void lostTarget(target _target){ if(Target.Contains(_target)) Target.Remove(_target); if(Target.Count <= 0) StopAttack(); }
private void createTarget() { try { // Get the information from the targetData float distance = targetData[currentTargetIndex].distance; float angularSize = targetData[currentTargetIndex].angularSize; // Psuedo-randomize spawn position Quaternion randAng = Quaternion.Euler(Random.Range(0, 10), Random.Range(-20, 20), 0); // Randomize angle Vector3 spawnPosition = (Vector3.up * 5) + (randAng * Vector3.forward * distance); // Destroy the old target if it exists destroyTarget(); // Create the new target, update it's angular size, and set it to be the currentTarget currentTarget = GameObject.Instantiate(targetPrefab, spawnPosition, Quaternion.identity) as GameObject; target currentTargetComponent = currentTarget.GetComponent <target>(); currentTargetComponent.Initialize(angularSize); // currentTargetIndex++; // Increase the target index for the next cycle. Debug.Log("Target Created."); } catch (System.IndexOutOfRangeException) { // Do Nothing Debug.LogWarning("Index Out of Range"); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Enemy") { Debug.Log(other.gameObject.tag); target target1 = other.transform.GetComponent <target>(); if (target1 != null) { target1.takedamage(damage); if (target1.health <= 0) { Destroy(other.gameObject); } var bullet = GameObject.Instantiate(impacteffect); bullet.transform.position = transform.position; Destroy(bullet, 2f); Destroy(this.gameObject); } Debug.Log("enemy health: " + target1.health); } if (other.gameObject.tag == "static_obj") { Debug.Log(other.gameObject.tag); var bullet = GameObject.Instantiate(impacteffect); bullet.transform.position = transform.position; Destroy(this.gameObject); Destroy(bullet, 2f); } }
void shoot() { muzzleFlash.Play(); RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { Debug.Log(hit.transform.name); target target = hit.transform.GetComponent <target> (); if (target != null) { target.TakeDamage(damage); } if (hit.rigidbody != null) { hit.rigidbody.AddForce(-hit.normal * impactForce); } GameObject impactGO = Instantiate(impactEffect, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(impactGO, 2f); } }
public void shoot() { MuzzleFlash.Play(); RaycastHit hit; //Instantiate(muzzle, a.gameObject.transform.position, Quaternion.identity); if (Physics.Raycast(fps.transform.position, fps.transform.forward, out hit, range)) { Debug.Log(hit.transform.name); target Target = hit.transform.GetComponent <target>(); if (Target != null) { Target.takedamage(damage); } target1 Target1 = hit.transform.GetComponent <target1>(); if (Target1 != null) { Target1.takedamage(damage); } target2 Target2 = hit.transform.GetComponent <target2>(); if (Target2 != null) { Target2.takedamage(damage); } GameObject im = Instantiate(a, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(im, 2f); } }
public ZoneObserver(string name, source source = source.All, secure secure = secure.Either, target target = target.Anonymous) { this.src = source; this.trgt = target; this.sec = secure; this.zone = name; }
void Shoot() { muzzleFlash.Play(); RaycastHit hit; if (Physics.Raycast(FpsCam.transform.position, FpsCam.transform.forward, out hit, range)) { Debug.Log(hit.transform.name); if (hit.transform.name == "cible(Clone)") { GameObject.Find("cible(Clone)").GetComponent <cibleBehavior>().gethit = true; } target Target = hit.transform.GetComponent <target>(); if (Target != null) { Target.TakeDamage(damage); } if (hit.rigidbody != null) { hit.rigidbody.AddForce(-hit.normal * impactForce); } } }
public void shoot(bool isPlayer) { RaycastHit hit; if (Physics.Raycast(transform.position + transform.forward / 10, transform.forward, out hit)) { source.PlayOneShot(shotgun, 0.5f); //hit.collider.GetComponent<Renderer>().material.color = Color.white; Rigidbody hitRb = hit.rigidbody; if (hitRb != null) { hitRb.AddForceAtPosition((isPlayer? playerController.transform.forward : enemyController.transform.forward) * 200f, hit.point); } target target = hit.collider.gameObject.GetComponent <target>(); Debug.Log(hit.collider.name); if (target != null) { target.takeHealth(1f); } GameObject impactGO = Instantiate(impact, hit.point, (isPlayer ? playerController.transform.rotation * Quaternion.Euler(0, 180, 0) : enemyController.transform.rotation * Quaternion.Euler(0, 180, 0))); Destroy(impactGO, 2); } }
private GameObject GetEnemyInFocus(target x) { try { switch (x) { case target.first: //get first target foreach (GameObject enemy in enemyList) { if (enemy != null) { return(enemy); } else { enemyList.Remove(enemy); } } return(null); case target.last: //get last target for (int i = enemyList.Count - 1; i >= 0; i--) { if (enemyList[i] != null) { return(enemyList[i]); } else { enemyList.RemoveAt(i); } } return(null); case target.strong: //placeholder return(enemyList[0]); case target.weak: //placeholder return(enemyList[0]); default: //placeholder return(enemyList[0]); } } catch (System.Exception e) { if (e is System.InvalidOperationException) { return(null); } else { Debug.Log("ERROR in GetEnemyInFocus() Tower1: " + e); Destroy(gameObject); return(null); } } }
void Awake() { Instance = this; SelfPV = GetComponent <PhotonView>(); ani = GetComponentInParent <Animator>(); AS = GetComponentInParent <AudioSource>(); plManager = PhotonView.Find((int)SelfPV.InstantiationData[0]).GetComponent <PlayerManager>(); }
public PLAction(type action, double priority, target focus, SpellList spell, StatusEffect effect, Character Char) { character = Char; Action = action; Priority = priority; Focus = focus; Spell = spell; Effect = effect; }
void Update() { if (Input.GetKeyDown(KeyCode.Space) && Time.time > nextFire && !is_fire) { is_fire = true; anim.Play("recul"); audio_fire.enabled = false; first_collider.GetComponent <BoxCollider>().enabled = false; nextFire = Time.time + fireRate; StartCoroutine(ShotEffect()); Vector3 rayOrigin = fpsCam.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0)); RaycastHit hit; laserLine.SetPosition(0, gunEnd.position); if (Physics.Raycast(rayOrigin, fpsCam.transform.forward, out hit, weaponRange)) { laserLine.SetPosition(1, hit.point); target Target = hit.transform.GetComponent <target>(); BoxCollider Target_collider = hit.transform.GetComponent <BoxCollider>(); if (Target != null && !Target_collider.isTrigger) { Target.TakeDamage(gunDamage); GameObject impact = Instantiate(ImpactEffect, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(impact, 0.5f); } if (hit.rigidbody != null) { hit.rigidbody.AddForce(-hit.normal * hitForce); } else { laserLine.SetPosition(1, rayOrigin + (fpsCam.transform.forward * weaponRange)); } } first_collider.GetComponent <BoxCollider>().enabled = true; } if (is_fire) { is_fire_time += Time.deltaTime; if (is_fire_time > anim.clip.length) { is_fire = false; is_fire_time = 0; } } }
private void OnTriggerExit2D(Collider2D collision) { if (target != null) { if (target.transform.name == collision.name) { target = null; } } }
private void OnTriggerEnter(Collider other) { target tar = other.GetComponent <target>(); if (tar != null) { tar.TakeDamage(damage); } Destroy(gameObject); }
private void OnTriggerEnter2D(Collider2D collision) { Debug.Log(collision.name); target target = collision.transform.GetComponent <target>(); if (target) { target.takeDamage(damage); } Destroy(gameObject); }
private void Start() { if (GetComponent <Enemy_AI>()) { currentTarget = target.ENEMY; } else { currentTarget = target.EXPLODABLE; } }
int OnTargetEvent(int nEventType, int nTargetType, long dwID) { target radarTarget = null; m_np.m_dicTargetCollection.TryGetValue(dwID, out radarTarget); if (radarTarget != null) { ReportSensorArpa(dwID); } return(0); }
// Private methods private void Init() { blocks = GameObject.FindGameObjectWithTag("Blocks").GetComponent <blocks>(); target = GameObject.FindGameObjectWithTag("Target").GetComponent <target>(); sum = GameObject.FindGameObjectWithTag("Sum").GetComponent <sum>(); combo = GameObject.FindGameObjectWithTag("Combo").GetComponent <combo>(); timer = GameObject.FindGameObjectWithTag("Timer").GetComponent <timer>(); lifes_score = GameObject.FindGameObjectWithTag("LifesScore").GetComponent <lifes_score>(); game_over = GameObject.FindGameObjectWithTag("GameOver").GetComponent <game_over>(); stage = GameObject.FindGameObjectWithTag("Stage").GetComponent <stage>(); refresh = GameObject.FindGameObjectWithTag("Refresh").GetComponent <refresh>(); }
//! 上报新的ARPA目标数据 /*! * \param dwArpaID:ARPA目标ID * \return ARPA数据是否进入统计列表 * \remark 上报新的ARPA目标数据 */ bool ReportSensorArpa(long dwArpaID) { bool bResult = false; target radarTarget = null; AISTarget aisTarget = null; m_np.m_dicTargetCollection.TryGetValue(dwArpaID, out radarTarget); if (radarTarget == null) { return(false); } int nIndex = -1; nIndex = FindUnionAisTarget(dwArpaID, UNION_STATE_SENSOR, UNION_ASSCI | UNION_DISASSCI); if (nIndex != -1) { m_np.m_AISCollection.TryGetValue((int)dwArpaID, out aisTarget); if (aisTarget != null) { bResult = TryUnionTarget(aisTarget, radarTarget, UNION_STATE_SENSOR, nIndex); } } else { float fMinRng = 926 * 1.0f; long dwMinRngID = -1; foreach (var item in m_np.m_AISCollection) { if (FindUnionArpaTarget(item.Value.MMSI, UNION_STATE_SENSOR, UNION_ASSCI | UNION_DISASSCI) != -1) { continue; } tagTARGET_DIFF stTargetDiff = new tagTARGET_DIFF(); if (RetCurState(aisTarget, radarTarget, stTargetDiff) == UNION_ASSCI) { if (stTargetDiff.fRngDiff < fMinRng) { fMinRng = stTargetDiff.fRngDiff; dwMinRngID = item.Value.MMSI; } } if (dwMinRngID != -1) { m_np.m_AISCollection.TryGetValue((int)dwMinRngID, out aisTarget); bResult = TryUnionTarget(aisTarget, radarTarget, UNION_STATE_SENSOR, nIndex); } } } return(true); }
public string TestGetThreeDSessionPaycell() { string msisdn = "905465553333"; string cardId = "4aa05cfe-af9c-43d5-971f-a69234ffaf4d"; string amount = "112"; target target = target.MERCHANT; transactionType transactionType = transactionType.AUTH; string threeDSessionId = GetThreeDSessionId(target, msisdn, cardId, transactionType, amount, false); Assert.IsNotNull(threeDSessionId); return(threeDSessionId); }
private void SpawnAnimationForCharacterAndItem(Character characterToAdd, Item itemToAdd, int setItemNumberToUse) { string targetLocationString = "SetButton" + setItemNumberToUse.ToString(); Transform targetLocation = GameObject.Find(targetLocationString).transform; // string targetToActivateString = "Target" + setItemNumberToUse.ToString(); target targetToActivate = targetList[setItemNumberToUse - 1]; targetToActivate.hasCharacter = true; toggleCamera(); AnimationScript animationToSpawn = animationSpawner.ReturnRequestedAnimation(characterToAdd, itemToAdd); AnimationScript setAnimation = Instantiate(animationToSpawn, targetLocation.position, Quaternion.identity) as AnimationScript; StartCoroutine(WaitThenRemoveAnimation(setAnimation, itemToAdd)); }
void Shoot() { LayerMask mask = LayerMask.GetMask("Terrain", "Enemy"); RaycastHit2D hit = Physics2D.Raycast(fireStart.position, fireStart.up, range, mask); if (hit.collider != null) { target gametarget = hit.transform.GetComponent <target>(); if (gametarget != null) { gametarget.TakeDamage(damage); } } }
void add_targetList(target _target){ }
330 >= Player.Distance(target.Position) : 265 >= Player.Distance(target.Position);