private void Between() { AutoWalker.SetMode(Orbwalker.ActiveModes.LaneClear); Vector3 p = AvgPos(_currentWave); if (p.Distance(AutoWalker.MyNexus) > MyTurret.Distance(AutoWalker.MyNexus)) { AIHeroClient ally = EntityManager.Heroes.Allies.Where( al => !al.IsMe && AutoWalker.P.Distance(al) < 1500 && al.Distance(EnemyTurret) < p.Distance(EnemyTurret) + 100 && _currentLogic.LocalAwareness.LocalDomination(al) < -10000) .OrderBy(l => l.Distance(AutoWalker.P)) .FirstOrDefault(); if (ally != null && Math.Abs(p.Distance(AutoWalker.EnemyNexus) - AutoWalker.P.Distance(AutoWalker.EnemyNexus)) < 200) { p = ally.Position.Extend(MyTurret, 160).To3DWorld() + _randomVector; } p = p.Extend(p.Extend( AutoWalker.P.Distance(MyTurret) < AutoWalker.P.Distance(EnemyTurret) ? MyTurret : EnemyTurret, 400).To3D().RotatedAround(p, 1.57f), _randomExtend).To3DWorld(); AutoWalker.WalkTo(p); } else { UnderMyTurret(); } }
private void OnMouseDown() { if (currentTurret != null) { BuildManager.instance.nodeUI.setNodeUI(this); } if (BuildManager.instance.getTurretToBuild() == null) { return; } MyTurret myTurret = BuildManager.instance.getTurretToBuild().GetComponent <MyTurret>(); if (PlayerStatus.instance.canWeBuyThisTurret(myTurret) == false) { return; } if (EventSystem.current.IsPointerOverGameObject()) { return; } buildTurret(); }
public void upgradeTurret() { MyTurret myTurret = currentTurret.GetComponent <MyTurret>(); if (myTurret.isUpgrade) { return; } else { if (myTurret.upgradedVersion == null) { return; } MyTurret upgradedTurret = myTurret.upgradedVersion.GetComponent <MyTurret>(); if (PlayerStatus.instance.canWeBuyThisTurret(upgradedTurret)) { PlayerStatus.instance.buyTurret(upgradedTurret); Destroy(this.currentTurret); this.currentTurret = Instantiate(myTurret.upgradedVersion, this.transform.position, this.transform.rotation); BuildManager.instance.showBuildEffect(this.transform.position); } } }
private void Start() { MyTurret myTurret = turretPrefab.GetComponent <MyTurret>(); Text myText = this.gameObject.GetComponent <Text>(); myText.text = "$" + myTurret.cost.ToString(); }
//True if we can. Vice versa public bool canWeBuyThisTurret(MyTurret turret) { if (turret == null) { return(false); } if (turret.cost > this.currentMoney) { return(false); } return(true); }
public void buyTurret(MyTurret turret) { this.currentMoney -= turret.cost; }