void Start() { healthBar = transform.Find("Health").gameObject; EventManager.Instance().RegisterForEventType("enemy_arrived", this); EventManager.Instance().RegisterForEventType("dial_damaged", this); EventManager.Instance().RegisterForEventType("health_leeched", this); LoadDialConfigFromJSON(WorldData.dialSelected); bonusWaveDictionary = new Dictionary <string, System.Object>(); bonusWaveDictionary.Add("levelID", 0L); bonusWaveDictionary.Add("waveID", 404L); bonusWaveDictionary.Add("maxMilliseconds", (long)(bonusCapacity * 1000)); bonusWaveDictionary.Add("minimumInterval", 1000L); bonusWaveDictionary.Add("enemies", new List <System.Object>()); zoneLines = GameObject.Find("ZoneLines").gameObject; superBars[0] = zoneLines.transform.Find("Super1").gameObject; superBars[1] = zoneLines.transform.Find("Super2").gameObject; superBars[2] = zoneLines.transform.Find("Super3").gameObject; for (int i = 0; i < 3; i++) { Transform bar = superBars[i].transform; bar.localScale = new Vector3(0.0f, bar.localScale.y, bar.localScale.z); } guns = GetAllGuns(); if (PlayerPrefsInfo.Int2Bool(PlayerPrefs.GetInt(PlayerPrefsInfo.s_vampire))) { vampireIsOn = true; } }
// Use this for initialization void Start() { transform.SetParent(Dial.spawnLayer, false); RectTransform shieldRT = (RectTransform)parentShield.transform; RectTransform rt = (RectTransform)transform; //find your angle float parentAngle = parentShield.gameObject.transform.eulerAngles.z; float angle = (parentAngle + 90) % 360; angle *= (float)Math.PI / 180; //Debug.Log ("original angle: " + angle); angle = (angle - (float)Math.PI / 6f) + ((((float)Math.PI / 3f) / (2))); //handles spread effect //find where to spawn the wave gunDistFromCenter = (float)Math.Sqrt(shieldRT.anchoredPosition.x * shieldRT.anchoredPosition.x + shieldRT.anchoredPosition.y * shieldRT.anchoredPosition.y); gunDistFromCenter += 0.47f; spawnx = gunDistFromCenter * (float)Math.Cos(angle); spawny = gunDistFromCenter * (float)Math.Sin(angle); //Debug.Log (bc.speed); rt.anchoredPosition = new Vector2(spawnx, spawny); transform.rotation = parentShield.gameObject.transform.rotation; vx = speed * (float)Math.Cos(angle); vy = speed * (float)Math.Sin(angle); originalScale = rt.localScale; dial = GameObject.Find("Dial").GetComponent <Dial>(); if (PlayerPrefsInfo.Int2Bool(PlayerPrefs.GetInt(PlayerPrefsInfo.s_vampire))) { vampIsOn = true; } }
//apply damage and effects to all enemies in This zone void Blast() { dial = GameObject.Find("Dial").GetComponent <Dial>(); List <Enemy> enemyList = Dial.GetAllEnemiesInZone(zoneID); for (int i = 0; i < enemyList.Count; i++) { if (PlayerPrefsInfo.Int2Bool(PlayerPrefs.GetInt(PlayerPrefsInfo.s_vampire))) { float ehp = enemyList[i].GetHP(); if (ehp < damage * vampDrain) { dial.ChangeHealth(ehp); } else { dial.ChangeHealth(damage * vampDrain); } } enemyList[i].TakeDamage(damage); if (parentShield != null && enemyList[i] != null) { enemyList[i].ShieldInflictedStatus(parentShield); } } }
// Use this for initialization void Start() { dialObj = GameObject.Find("Dial"); dial = dialObj.GetComponent <Dial>(); canvas = GameObject.Find("Canvas").GetComponent <Canvas>(); EventManager.Instance().RegisterForEventType("shot_fired", this); GameObject overlayObject = transform.Find("CooldownLayer").gameObject; cooldownImg = overlayObject.GetComponent <Image>(); cooldownImg.type = Image.Type.Filled; cooldownImg.fillMethod = Image.FillMethod.Radial360; cooldownImg.fillClockwise = false; cooldownImg.fillAmount = 0f; cooltimer = new Timer(); GameObject chargeObject = transform.Find("ChargeLayer").gameObject; chargeImg = chargeObject.GetComponent <Image>(); chargeImg.type = Image.Type.Filled; chargeImg.fillMethod = Image.FillMethod.Vertical; chargeImg.fillAmount = 0f; laneList = new LinkedLaneList(); laneList.SetUpList(); //defaults /*towerType = "Shield"; * shieldRange = 1f; * dmg = 10; * speed = defaultBulletSpeed; * range = defaultBulletRange; * shieldHP = 100;*/ //split bullet limits if (split > 4) { split = 4; } if (split < 1) { split = 1; } //if useLock risk is on if (PlayerPrefsInfo.Int2Bool(PlayerPrefs.GetInt(PlayerPrefsInfo.s_useLock))) { useLockIsOn = true; } //if vampire risk is on if (PlayerPrefsInfo.Int2Bool(PlayerPrefs.GetInt(PlayerPrefsInfo.s_vampire))) { vampDrain = defaultVampDrain; } }
// Use this for initialization protected virtual void Start() { collide = GetComponent <CircleCollider2D>(); rt = GetComponent <RectTransform>(); rt.sizeDelta = new Vector2(0.0001f, 0.0001f); time = new Timer(); filter = new ContactFilter2D(); filter.NoFilter(); dial = GameObject.Find("Dial").GetComponent <Dial>(); if (PlayerPrefsInfo.Int2Bool(PlayerPrefs.GetInt(PlayerPrefsInfo.s_vampire))) { vampIsOn = true; } }
// Use this for initialization protected override void Start() { polyCollide = GetComponent <PolygonCollider2D>(); rt = GetComponent <RectTransform>(); time = new Timer(); filter = new ContactFilter2D(); filter.NoFilter(); dial = GameObject.Find("Dial").GetComponent <Dial>(); grown = true; //for now, doesn't grow if (PlayerPrefsInfo.Int2Bool(PlayerPrefs.GetInt(PlayerPrefsInfo.s_vampire))) { vampIsOn = true; } }
// Use this for initialization void Start() { rt = GetComponent <RectTransform>(); rt.sizeDelta = new Vector2(0.0001f, 0.0001f); collide = GetComponent <CircleCollider2D>(); time = new Timer(); if (PlayerPrefsInfo.Int2Bool(PlayerPrefs.GetInt(PlayerPrefsInfo.s_vampire))) { vampIsOn = true; } Debug.Log("created AoE, canDamageDial = " + canDamageDial); filter = new ContactFilter2D(); filter.NoFilter(); }
// Use this for initialization void Start() { //Debug.Log("Drop.cs called Start()"); rt = GetComponent <RectTransform>(); if (PlayerPrefsInfo.Int2Bool(PlayerPrefs.GetInt(PlayerPrefsInfo.s_sabotage))) { sabotageIsOn = true; } if (PlayerPrefsInfo.Int2Bool(PlayerPrefs.GetInt(PlayerPrefsInfo.s_tougherEnemies))) { tougherEnemiesIsOn = true; omniBoost = PlayerPrefsInfo.GetOmnitechDropRateBoost(); //value between 0 and 1 } omnitechTypes = new List <string> { "cooldown", "energyGain", "comboKey", "selfRepair" }; }
//apply risk bonuses to drop/rarity rates //called in ConfigureEnemy void ApplyRiskBonuses() { float boost; //drop rates boost = (PlayerPrefsInfo.GetDropRateBoost() * 100f); lowDropRate += boost; if (lowDropRate > 100f) { lowDropRate = 100f; } medDropRate += boost; if (medDropRate > 100f) { medDropRate = 100f; } highDropRate += boost; if (highDropRate > 100f) { highDropRate = 100f; } //rarity rates boost = (PlayerPrefsInfo.GetRarityRateBoost() * 100f); normalChance += boost; if (normalChance > 100f) { normalChance = 100f; } rareChance += boost; if (rareChance > 100f) { rareChance = 100f; } //omnitech drop rates boost = (PlayerPrefsInfo.GetOmnitechDropRateBoost() * 100f); omnitechChance += boost; if (omnitechChance > 100f) { omnitechChance = 100f; } }
public void StartMoving() { //Tougher Enemies risk if (PlayerPrefsInfo.Int2Bool(PlayerPrefs.GetInt(PlayerPrefsInfo.s_tougherEnemies))) { Debug.Log("calling applyriskstatchanges"); ApplyRiskStatChanges(); } //Debug.Log ("start moving called on " + this.ToString()); ConfigureEnemy(); steering = gameObject.AddComponent <Steering>() as Steering; steering.enemy = this; float speedMult = 1f / (impactTime / NORMAL_IMPACT_TIME); steering.maxSpeed = speedMult * NORMAL_SPEED; steering.referenceMaxSpeed = steering.maxSpeed; steering.maxAccel = steering.maxSpeed / FRAMES_FROM_ZERO_TO_MAX; steering.referenceMaxAccel = steering.maxAccel; path = AIPath.CreatePathFromJSONFilename(moverType); path.SetDialDimensions(Dial.spawnLayer.anchoredPosition, Dial.FULL_LENGTH); path.SetAngle(GetStartingTrackAngle() + (-trackLane * 15f) + moverLaneOverride); steering.StartFollowingPath(path); steering.SpeedBoost((1f + riskSpeedBoost), 99999999f); //apply Tougher Enemies risk speed bonus /*List<Vector2> pathlist = path.GetPathAsListOfVectors(); * foreach(Vector2 node in pathlist){ //path visualization * GameObject dot = new GameObject(); * Image dimg = dot.AddComponent<Image>() as Image; * dot.transform.SetParent(Dial.unmaskedLayer,false); * dot.GetComponent<RectTransform>().sizeDelta = new Vector2(5f,5f); * dot.GetComponent<RectTransform>().anchoredPosition = node; * }*/ //some scaling- could maybe be done through transform.scale, but I don't trust Unity to handle the collider ScaleEnemy(); spawned = true; moving = true; //float angle = Mathf.Atan2(rt.anchoredPosition.y , rt.anchoredPosition.x); //ySpeed = Mathf.Sin (angle) * speed; //xSpeed = Mathf.Cos (angle) * speed; }
public void Start() { canvas = GameObject.Find("Canvas").GetComponent <Canvas>(); RectTransform rt = (RectTransform)transform; EventManager em = EventManager.Instance(); em.RegisterForEventType("mouse_release", this); em.RegisterForEventType("mouse_click", this); anchorX = rt.anchoredPosition.x; anchorY = rt.anchoredPosition.y; for (int i = 1; i < 7; i++) { gunButtons[i - 1] = GameObject.Find("Button" + i).GetComponent <GunButton>(); } SetDirectionMult(); //sets directionMult based on Risk "inverse dial" setting //Rotate-lock if (PlayerPrefsInfo.Int2Bool(PlayerPrefs.GetInt(PlayerPrefsInfo.s_rotLock))) { rotLockIsOn = true; } }
void SetInverseDial(bool b) { PlayerPrefs.SetInt(PlayerPrefsInfo.s_inverseDialSpin, Bool2Int(b)); PlayerPrefsInfo.CalculateDropRateBoost(); }
void SetSkinnyNearSection(bool b) { PlayerPrefs.SetInt(PlayerPrefsInfo.s_skinnyNearLane, Bool2Int(b)); PlayerPrefsInfo.CalculateDropRateBoost(); }
void SetTougherEnemies(bool b) { PlayerPrefs.SetInt(PlayerPrefsInfo.s_tougherEnemies, Bool2Int(b)); PlayerPrefsInfo.CalculateOmnitechRateBoost(); }
void SetSabotage(bool b) { PlayerPrefs.SetInt(PlayerPrefsInfo.s_sabotage, Bool2Int(b)); PlayerPrefsInfo.CalculateDropRateBoost(); }
void SetAmbush(bool b) { PlayerPrefs.SetInt(PlayerPrefsInfo.s_ambush, Bool2Int(b)); PlayerPrefsInfo.CalculateDropRateBoost(); }
void SetVampire(bool b) { PlayerPrefs.SetInt(PlayerPrefsInfo.s_vampire, Bool2Int(b)); PlayerPrefsInfo.CalculateRarityRateBoost(); }
void SetRotLock(bool b) { PlayerPrefs.SetInt(PlayerPrefsInfo.s_rotLock, Bool2Int(b)); PlayerPrefsInfo.CalculateRarityRateBoost(); }