/*Initiliaze bility icon linked to ship ability*/ public void initialize(Ability selectedAbility) { ability = selectedAbility; abilityImage = GetComponent <Image> (); darkMask = gameObject.transform.GetChild(1).gameObject.GetComponent <Image> (); cdTextDisplay = gameObject.transform.GetChild(0).gameObject.GetComponent <Text> (); abilityImage.sprite = ability.aSprite; darkMask.sprite = ability.aSprite; displayCD = ability.coolDown; abilityReady(); }
/*Init destroy display*/ public void init(string a, string l, string r, Vector3 iO) { offset = iO; attacker = gameObject.transform.GetChild(0).GetComponent <Text> (); link = gameObject.transform.GetChild(1).GetComponent <Text> (); reciever = gameObject.transform.GetChild(2).GetComponent <Text> (); dispTime = new cooldownTimer(10f); attacker.text = a; link.text = l; reciever.text = r; }
/*Initilize Projectile ability*/ public ProjectileAbility(GameObject sh, GameObject proj, Transform tm, Quaternion off, float proSp, string path, float cd) { aSprite = Resources.Load <Sprite> (path) as Sprite; coolDown = new cooldownTimer(cd); ship = sh; projectile = proj; transform = tm; offset = off; projectileSpeed = proSp; if (transform.gameObject.GetComponent <ParticleSystem> () != null) { partSys = transform.gameObject.GetComponent <ParticleSystem> (); } }
/*Initialize a turret ability*/ public TurretAbility(GameObject sh, GameObject proj, List <Transform> tm, Quaternion off, float proSp, string path, float cd) { coolDown = new cooldownTimer(cd); aSprite = Resources.Load <Sprite> (path); ship = sh; projectile = proj; turrets = tm; offset = off; projectileSpeed = proSp; turretFire = new List <ProjectileAbility> (); foreach (Transform turret in turrets) { turretFire.Add(new ProjectileAbility(ship, projectile, turret, offset, projectileSpeed, path, cd)); } turretFire.RemoveAt(turretFire.Count - 1); }