private async Task <bool> TypeZeroVehicleBehavior() { while (Me.IsAlive) { if (_vehicle == null || !_vehicle.IsValid) { _vehicle = VehicleList.FirstOrDefault(); } if (_vehicle.Location.Distance(FirePoint) <= 5) { TreeRoot.StatusText = "Firing Vehicle - " + _vehicle.SafeName + " Using Spell Index: " + AttackButton + " Height: " + FireHeight; WoWMovement.ClickToMove(TargetPoint); await Coroutine.Sleep(500); WoWMovement.MoveStop(); Lua.DoString("VehicleAimRequestNormAngle(0.{0})", FireHeight); Lua.DoString("CastPetAction({0})", AttackButton); Counter++; return(true); } TreeRoot.StatusText = "Moving To FireLocation - Yards Away: " + FirePoint.Distance(_vehicle.Location); WoWMovement.ClickToMove(MoveToLocation); _vehicle.Target(); await Coroutine.Yield(); } return(false); }
public void MergeFirePoints(FirePoint firePointToMerge) { for (int i = 0; i < firePointToMerge.gunsPoints.Count; i++) { for (int j = 0; j < gunsPoints.Count; j++) { if (gunsPoints[j].locationPath == firePointToMerge.gunsPoints[i].locationPath) { gunsPoints.Remove(gunsPoints[j]); GunPointsDictionary.Remove(firePointToMerge.gunsPoints[i].locationPath); } } } List <GunPoint> newGunPoints = new List <GunPoint>(gunsPoints.Count + firePointToMerge.gunsPoints.Count); for (int i = 0; i < gunsPoints.Count; i++) { newGunPoints.Add(gunsPoints[i]); } for (int i = 0; i < firePointToMerge.gunsPoints.Count; i++) { newGunPoints.Add(firePointToMerge.gunsPoints[i]); } gunsPoints = newGunPoints; CreateFirePointsDictionaries(); }
public void PermanentSetUpFirePoint(FirePoint firePoint) { firePoint.CreateFirePointsDictionaries(); for (int i = 0; i < gunsConfigurations.Length; i++) { if (gunsConfigurations[i].gunType == GameEnums.Gun.None) { continue; } if (firePoint.GunPointsDictionary.ContainsKey(gunsConfigurations[i].locationPath.ToString())) { GameObject gun = ObjectPoolersHolder.GunsPooler.PermanentSpawn(gunsConfigurations[i].gunType.ToString()); FirePoint.GunPoint gunPoint = firePoint.GunPointsDictionary[gunsConfigurations[i].locationPath.ToString()]; gun.transform.parent = gunPoint.gunsLocation; gun.transform.localPosition = Vector3.zero; Gun gunComponent = gun.GetComponent <Gun>(); gunComponent.battleType = gunsConfigurations[i].battleType; gunComponent.SetAnglesData(null); gunComponent.SetAnglesData(gunPoint.allowableAnglesOnPoint); gunComponent.SetGunData(gunsConfigurations[i].gunDataType); firePoint.TrackingGroupsDictionary[gunsConfigurations[i].trackingGroup].Add(gunComponent); } } }
// Start is called before the first frame update void Start() { gm = GameMaster.instance; audioManager = AudioManager.instance; stats = PlayerStats.instance; stats.Health = stats.maxHealth; objectPooler = ObjectPooler.instance; mainCamera = Camera.main; animator = GetComponent <Animator>(); rigidBody = GetComponent <Rigidbody2D>(); if (rigidBody == null) { Debug.LogError("No rigidBody in Player"); } firePoint = GetComponentInChildren <FirePoint>(); if (firePoint == null) { Debug.LogError("No firePoint in Player"); } firePointOffset = Vector2.Distance((Vector2)firePoint.transform.position, (Vector2)transform.position); }
void Start() { playerMovement = GameObject.Find("Player").GetComponent <PlayerMovementControl>(); playerInput = GameObject.Find("Player").GetComponent <PlayerInput>(); anim = GameObject.Find("Player").GetComponent <Animator>(); firePoint = GameObject.Find("Player").GetComponent <FirePoint>(); }
public void RebuildTrucks() { for (int i = 0; i < OldTrucksToReBuild.Length; i++) { GameObject newTruck = NewTrucks[i]; newTruck.transform.position = OldTrucksToReBuild[i].transform.position; FirePoint newTrucksNewFirePoint = newTruck.GetComponent <FirePoint>(); for (int j = 0; j < newTrucksNewFirePoint.gunsPoints.Count; j++) { newTrucksNewFirePoint.gunsPoints[j].allowableAnglesOnPoint = OldTrucksToReBuild[i].GetComponent <FirePoint>().gunsPoints[j].allowableAnglesOnPoint; } for (int j = 0; j < OldTrucksToReBuild[i].transform.childCount; j++) { if (OldTrucksToReBuild[i].transform.GetChild(j).name.Contains("Wheel")) { GameObject newTrucksNewWheel = Instantiate(NewTruckWheel) as GameObject; newTrucksNewWheel.transform.parent = newTruck.transform; newTrucksNewWheel.name = newTrucksNewWheel.name.Replace("(Clone)", ""); newTrucksNewWheel.transform.position = OldTrucksToReBuild[i].transform.GetChild(j).position; } if (OldTrucksToReBuild[i].transform.GetChild(j).name.Contains("Doors")) { GameObject newTrucksNewDoors = Instantiate(Doors) as GameObject; newTrucksNewDoors.name = newTrucksNewDoors.name.Replace("(Clone)", ""); newTrucksNewDoors.transform.parent = newTruck.transform; for (int x = 0; x < newTrucksNewDoors.transform.childCount; x++) { newTrucksNewDoors.transform.GetChild(x).transform.position = OldTrucksToReBuild[i].transform.GetChild(j).transform.GetChild(x).position; newTrucksNewDoors.transform.GetChild(x).transform.rotation = OldTrucksToReBuild[i].transform.GetChild(j).transform.GetChild(x).rotation; newTrucksNewFirePoint.gunsPoints[x].gunsLocation = newTrucksNewDoors.transform.GetChild(x).transform; } } if (OldTrucksToReBuild[i].transform.GetChild(j).name.Contains("Collider")) { GameObject newTrucksNewColliders = Instantiate(TruckColliders) as GameObject; newTrucksNewColliders.name = newTrucksNewColliders.name.Replace("(Clone)", ""); newTrucksNewColliders.transform.parent = newTruck.transform; SphereCollider oldCollider = OldTrucksToReBuild[i].transform.GetChild(j).transform.GetComponent <SphereCollider>(); SphereCollider newCollider = newTrucksNewColliders.GetComponent <SphereCollider>(); newCollider.radius = oldCollider.radius; newCollider.center = oldCollider.center; CapsuleCollider[] newColliders = newTrucksNewColliders.GetComponents <CapsuleCollider>(); CapsuleCollider[] oldColliders = OldTrucksToReBuild[i].transform.GetChild(j).GetComponents <CapsuleCollider>(); for (int x = 0; x < newColliders.Length; x++) { newColliders[x].radius = oldColliders[x].radius; newColliders[x].height = oldColliders[x].height; newColliders[x].center = oldColliders[x].center; } } } } }
// Start is called before the first frame update void Start() { _firePoint = GetComponent <FirePoint>(); if (_firePoint == null) { Debug.LogError("FirePointコンポーネントが無ぇ!"); } }
void shoot(Vector2 rotation) { GameObject proj = (GameObject)Instantiate(objectToShoot, firePoint.position, firePoint.rotation); FirePoint projectile = proj.GetComponent <FirePoint>(); if (projectile != null) { projectile.chase(target); } }
void shoot(GameObject target) { FirePoint point = Instantiate(objectToShoot, firePoint.position, Quaternion.Euler((rotate) ? turrentRotation : new Vector3(0f, 0f, Mathf.Atan2(direction.x, -direction.y) * Mathf.Rad2Deg))).GetComponent <FirePoint>(); if (point != null) { point.damage = stats.damage; point.dot.SetDoT(stats.overTime); point.Fire(target); } }
public void ReturnObjectsToPool(FirePoint owner) { for (int i = 0; i < owner.gunsPoints.Count; i++) { if (owner.gunsPoints[i].gunsLocation.childCount > 0) { foreach (Transform gun in owner.gunsPoints[i].gunsLocation) { ObjectPoolersHolder.GunsPooler.ReturnToPool(gun.gameObject, gun.name); } } } }
internal void GetBurnt(FirePoint firePoint) { if (_destructible != null) { // Register split event // _destructible.OnEndSplit.AddListener(OnEndSplit); // Split via fracture D2dQuadFracturer.Fracture(_destructible, FractureCount, 0.5f); // Unregister split event //_destructible.OnEndSplit.RemoveListener(OnEndSplit); } AddExpNum(); }
public bool Burn() { bool result = false; if (this.CurrentLodTransform) { FirePoint[] componentsInChildren = this.CurrentLodTransform.GetComponentsInChildren<FirePoint>(); FirePoint[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { FirePoint firePoint = array[i]; firePoint.startFire(); result = true; } } return result; }
void OnTriggerEnter2D(Collider2D col) { // Gets the FirePoint FirePoint firePoint = col.gameObject.GetComponent <FirePoint>(); // Checks if has fire point if (firePoint != null) { // Lowers health by the projectile's damage reduceHealth(firePoint.damage); DoT.SetDoT(firePoint.dot); // Destroys projectile Destroy(col.gameObject); } }
int AddCountFireAction() { if (IsDoHuanDanAction) { // Debug.LogWarning("IsDoHuanDanAction is true"); return(-1); } if (IsDoRunFireAction) { // Debug.LogWarning("IsDoRunFireAction is true"); return(-1); } CountFireAction++; FirePoint firePointScript = NpcScript.GetFirePointScript(); if (firePointScript != null) { CountFireRun = firePointScript.CountFire; CountFireRunVal++; // Debug.Log("CountFireAction "+CountFireAction+", CountFireRunVal "+CountFireRunVal); if (CountFireRun <= CountFireRunVal) { //Play Run_Fire Action CountFireRunVal = 0; MakeNpcDoActionRun3(); NpcScript.MakeNpcMoveFirePoint(); return(0); } } if (CountHuanDan <= 0) { return(0); } if (CountHuanDan <= CountFireAction) { //Play huanDan action CountFireAction = 0; PlayNPCHuanDanAction(); } return(0); }
/// <summary> /// Uses the weapon. /// </summary> public override void UseWeapon(int damage) { base.UseWeapon(damage); firePoint = FirePoint.instance; if (weaponSlot == WeaponSlot.Melee) { RaycastHit hit; if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out hit, GetAttackRange(), enemyLayers)) { hit.transform.GetComponent <Health>().TakeDamage(damage + GetDamageModifier()); } } if (weaponSlot == WeaponSlot.BasicRanged) { Debug.Log("Fired " + name); SpawnProjectile(ammo); } }
IEnumerator ShootSpeed(float seconds) //IEnumerator = bekleme zamanları, saniye vs . ile çalışmakta kullanılan bir değişken çeşidi. "Sayı üretme" anlamında "(numerator)" { yield return(new WaitForSecondsRealtime(seconds)); //seconds = kaç saniyede bir ateş edeceği if (gameObject.name == "Old Turret") { FirePoint.Rotate(fp_pos); //orijinal transformu, verilen vektördeki değerler kadar döndürür. örn. verilen(0,10,-50) ise x, 0 derece ; y, 10 derece; z, -50 derece döner. Shoot(); FirePoint.Rotate(Fp_pos_Reversed); //rotasyon durumunu resetlemek için (0,0,0) a geri dödürmek için. } else { Shoot(); } audio.Play(); StartCoroutine(ShootSpeed(seconds)); //Kendini tekrarlaması için yeniden aynı metotu çağırdık. DİKKAT : STARTCOROUTİNE KULLANILMALI!!! (ienumaretor'lerde) }
private void NullCheck() { if (playerMovement == null) { playerMovement = GameObject.Find("Player").GetComponent <PlayerMovementControl>(); } if (playerInput == null) { playerInput = GameObject.Find("Player").GetComponent <PlayerInput>(); } if (anim == null) { anim = GameObject.Find("Player").GetComponent <Animator>(); } if (firePoint == null) { firePoint = GameObject.Find("Player").GetComponent <FirePoint>(); } }
protected virtual void OnValidate() { Assert.IsTrue(shotCount > 0); m_Points = new FirePoint[shotCount]; if (shotCount > 1) { // The formula is: // angle for i-th shot = i*theta/(n-1) // Where n is the number of shots being fired, // theta is the angle of the entire arc, // and i is the current shot we're considering. float angleBetweenShots = fullAngle / (shotCount - 1); m_Points = new FirePoint[shotCount]; for (int i = 0; i < m_Points.Length; i++) { float currentAngle = i * angleBetweenShots; m_Points[i] = new FirePoint( transform.position, Quaternion.AngleAxis(currentAngle - halfAngle, axis) * transform.rotation ); } } else { // If we are only shooting one shot, then we will want to // just fire it from the center. m_Points = new FirePoint[1]; m_Points[0] = new FirePoint( transform.position, transform.rotation ); } } // End OnValidate()
private void Awake() { instance = this; }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => (Counter > 0 && !FireUntilFinished) || (Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted), new Sequence( new Action(ret => TreeRoot.StatusText = "Finished!"), new WaitContinue(120, new Action(delegate { _isBehaviorDone = true; return RunStatus.Success; })) )), new Decorator(ret => !_isInitialized && VehicleType == 2, new Action(ret => ParsePaths())), new Decorator(c => !InVehicle && NpcVehicleList.Count == 0, new Action(c => { Navigator.MoveTo(StartPoint); TreeRoot.StatusText = "Moving To Vehicle Location - " + " Yards Away: " + StartPoint.Distance(Me.Location); return RunStatus.Success; }) ), new Decorator(c => !InVehicle && NpcVehicleList.Count > 0, new Action(c => { if (!NpcVehicleList[0].WithinInteractRange) { Navigator.MoveTo(NpcVehicleList[0].Location); TreeRoot.StatusText = "Moving To Vehicle - " + NpcVehicleList[0].Name + " Yards Away: " + NpcVehicleList[0].Location.Distance(Me.Location); } else { Flightor.MountHelper.Dismount(); NpcVehicleList[0].Interact(); PreviousLocation = Me.Location; } return RunStatus.Success; }) ), new Decorator(c => InVehicle && VehicleType == 0, new Action(c => { if (_vehicle == null) { _vehicle = VehicleList[0]; } if (_vehicle.Location.Distance(FirePoint) <= 5) { TreeRoot.StatusText = "Firing Vehicle - " + _vehicle.Name + " Using Spell Index: " + AttackButton + " Height: " + FireHeight; WoWMovement.ClickToMove(TargetPoint); Thread.Sleep(500); WoWMovement.MoveStop(); using (new FrameLock()) { Lua.DoString("VehicleAimRequestNormAngle(0.{0})", FireHeight); Lua.DoString("CastPetAction({0})", AttackButton); Counter++; return RunStatus.Success; } } if (_vehicle.Location.Distance(FirePoint) > 5) { TreeRoot.StatusText = "Moving To FireLocation - Yards Away: " + FirePoint.Distance(_vehicle.Location); WoWMovement.ClickToMove(MoveToLocation); _vehicle.Target(); } return RunStatus.Success; })), new Decorator(c => InVehicle && VehicleType == 1, new Action(c => { if (_vehicle == null) { _vehicle = VehicleList[0]; } if (NpcAttackList.Count > 1) { TreeRoot.StatusText = "Moving to Assult - " + NpcAttackList[0].Name + " Using Spell Index: " + AttackButton; if (_vehicle.Location.Distance(NpcAttackList[0].Location) > 20) { WoWMovement.ClickToMove(NpcAttackList[0].Location); if (Me.CurrentTarget != NpcAttackList[0]) { NpcAttackList[0].Target(); } return RunStatus.Success; } Lua.DoString("VehicleAimRequestNormAngle(0.{0})", FireHeight); Lua.DoString("CastPetAction({0})", AttackButton); Counter++; Thread.Sleep(1000); return RunStatus.Success; } if (_vehicle.Location.Distance(StartObjectivePoint) > 5) { TreeRoot.StatusText = "Moving To Start Location - Yards Away: " + StartObjectivePoint.Distance(Me.Location); bool testfly = StyxWoW.Me.MovementInfo.CanFly; Logging.Write("" + testfly); Flightor.MoveTo(StartObjectivePoint); // WoWMovement.ClickToMove(StartObjectivePoint); _vehicle.Target(); } return RunStatus.Success; })), new Decorator(c => InVehicle && VehicleType == 2, new Action(c => { if (_vehicle == null && VehicleList[0] != null) { _vehicle = VehicleList[0]; } if ((Counter > 0 && !FireUntilFinished) || (Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted)) { if (EndPoint.Distance(Me.Location) > 20) { Flightor.MoveTo(EndPoint); //return RunStatus.Running; } return RunStatus.Success; } if (PathCircle.Count == 0) { //Counter++; ParsePaths(); // return RunStatus.Running; } if (PathCircle.Peek().Distance(Me.Location) > 5) { Flightor.MoveTo(PathCircle.Peek()); // return RunStatus.Running; } WoWMovement.MoveStop(); Thread.Sleep(400); if (NpcAttackList[0] != null) { WoWMovement.ClickToMove(NpcAttackList[0].Location); } WoWMovement.MoveStop(); Thread.Sleep(400); Lua.DoString("CastPetAction({0})", AttackButton); WoWMovement.MoveStop(); PathCircle.Dequeue(); return RunStatus.Success; })) ))); }
int AddCountFireAction() { if (IsDoHuanDanAction) { // Debug.LogWarning("Unity:"+"IsDoHuanDanAction is true"); return(-1); } if (IsDoRunFireAction) { // Debug.LogWarning("Unity:"+"IsDoRunFireAction is true"); return(-1); } CountFireAction++; FirePoint firePointScript = NpcScript.GetFirePointScript(); if (firePointScript != null) { CountFireRun = firePointScript.CountFire; CountFireRunVal++; // Debug.Log("Unity:"+"CountFireAction "+CountFireAction+", CountFireRunVal "+CountFireRunVal); if (CountFireRun <= CountFireRunVal) { //Play Run_Fire Action CountFireRunVal = 0; MakeNpcDoActionRun3(); NpcScript.MakeNpcMoveFirePoint(); return(0); } } NpcMark markScript = NpcScript.GetMarkScriptVal(); if (NpcScript != null && markScript != null && markScript.IsDoFireAction) { CountFireRun = markScript.FireCount; CountFireRunVal++; if (CountFireRun <= CountFireRunVal) { CountFireRunVal = 0; MakeNpcDoActionRun3(); NpcScript.MoveNpcByItween(); return(0); } } if (CountHuanDan <= 0) { return(0); } if (CountHuanDan <= CountFireAction) { //Stop Play Fire Action. CountFireAction = 0; DelayPlayFireAction(); SetCountHuanDan(CountFirePL, TimeRootAni); // PlayNPCHuanDanAction(); } return(0); }
internal void SetFirePoint(FirePoint firePoint) { _firePoint = firePoint; }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(ret => (Counter > 0 && !FireUntilFinished) || (Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted), new Sequence( new Action(ret => TreeRoot.StatusText = "Finished!"), new WaitContinue(120, new Action(delegate { _isBehaviorDone = true; return RunStatus.Success; })) )), new Decorator(c => !InVehicle, new Action(c => { if (!NpcVehicleList[0].WithinInteractRange) { Navigator.MoveTo(NpcVehicleList[0].Location); TreeRoot.StatusText = "Moving To Vehicle - " + NpcVehicleList[0].Name + " Yards Away: " + NpcVehicleList[0].Location.Distance(Me.Location); } else { NpcVehicleList[0].Interact(); PreviousLocation = Me.Location; } }) ), new Decorator(c => InVehicle, new Action(c => { if (Vehicle == null) { Vehicle = VehicleList[0]; } if (Vehicle.Location.Distance(FirePoint) <= 5) { TreeRoot.StatusText = "Firing Vehicle - " + Vehicle.Name + " Using Spell Index: " + AttackButton + " Height: " + FireHeight; WoWMovement.ClickToMove(TargetPoint); Thread.Sleep(500); WoWMovement.MoveStop(); using (new FrameLock()) { Lua.DoString("VehicleAimRequestNormAngle(0.{0})", FireHeight); Lua.DoString("CastPetAction({0})", AttackButton); Counter++; return RunStatus.Success; } } else if (Vehicle.Location.Distance(FirePoint) > 5) { TreeRoot.StatusText = "Moving To FireLocation - Yards Away: " + FirePoint.Distance(Vehicle.Location); WoWMovement.ClickToMove(moveToLocation); Vehicle.Target(); } return RunStatus.Running; })) ))); }