void OnTriggerEnter(Collider other) { if (other.tag.Contains(mtag) && !other.tag.Contains("Base")) { if (CardName.Contains("LightningBolt") || CardName.Contains("BBQfor1")) { if (UnitList.Count < 1) { UnitList.Add(other.gameObject); } } else { UnitList.Add(other.gameObject); if (CardName.Contains("Discharge")) { if (this.transform.parent.GetComponent <NetworkIdentity>().isServer) { randomDischarge = data.getRandom(0f, 1f); } if (randomDischarge < perctChance) { workDischarge(other.gameObject, damage); } } else if (CardName.Contains("ElectricArc")) { workElectric(other.gameObject, true); } } } }
// Use this for initialization void Start() { cardName = this.transform.parent.gameObject.name.Substring(0, this.transform.parent.gameObject.name.Length - 7); data = new CardsBase(cardName); type = data.Type; category = data.Category; attackSpeed = data.PerctAttackSpeed; timesDamage = data.TimesDamage; radius = data.Radius; time = data.Time; this.transform.parent.localScale = new Vector3(radius, radius, radius); startTime = Time.time; UnitList = new List <GameObject>(); if (this.transform.parent.GetComponent <NetPlayerCheck>().IsPlayer1) { mtag = "Enemy"; } else { mtag = "Player"; } if (cardName.Contains("AttackingGamble")) { timesDamage = data.getRandom(data.PerctDamage, data.PerctDamageMax); time = data.getRandom(2, data.Time); } }