protected virtual void Start() { snm = GetComponent <SocketNetworkManager>(); canvas = GameObject.Find("Canvas").GetComponent <Canvas>(); rb = GetComponent <Rigidbody2D>(); render = GetComponent <SpriteRenderer>(); health = GetComponent <Health>(); rb.collisionDetectionMode = CollisionDetectionMode2D.Continuous; direction = new Vector2(0, 0); angle = 0.0f; forces = new List <Vector2>(); healthbar = GameObject.FindWithTag("Health-bar"); healthbarback = GameObject.FindWithTag("Health-bar-background"); interfaceplayertext = GameObject.FindWithTag("Player-text").GetComponent <Text>(); interfaceplayertext.text = "You: base"; icon = GameObject.FindWithTag("icon"); Debug.Log(dict[plclass]); icon.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(dict[plclass]); healthbarsize = healthbar.transform.localScale; hbarupdatetime = 0; knocked = 0; realvelocity = new Vector2(0, 0); clicked = false; hit = 0; /* ABILITIES */ GameObject[] icons = GameObject.FindGameObjectsWithTag("ability-icons"); Array.Sort(icons, CompareIcons); lmbAbilityInit(); shiftAbilityInit(); rmbAbilityInit(); eAbilityInit(); qAbilityInit(); List <cooldown> cds = new List <cooldown>(); glcd = new cooldown(LMB_NAME, GLOBAL_CD, "LMB", icons[0]); rmbcd = new cooldown(RMB_NAME, RMB_CD, "RMB", icons[1]); lshiftcd = new cooldown(SHIFT_NAME, SHIFT_CD, "LShift", icons[2]); ecd = new cooldown(E_NAME, E_CD, "e", icons[3]); qcd = new cooldown(Q_NAME, Q_CD, "q", icons[4]); cds.Add(glcd); cds.Add(lshiftcd); cds.Add(rmbcd); cds.Add(ecd); cds.Add(qcd); /* SET CD TEXT */ cds.ForEach(delegate(cooldown c){ Text t = c.go.GetComponentInChildren(typeof(Text)) as Text; t.text = c.key; }); /* GLOBAL CD */ globalcd = new cooldown(GLOBAL_CD, icons); cds.Add(globalcd); StartCoroutine(cdUpdater(cds)); }
public override void initiate(Player p) { base.initiate(p); player = p; ai_cooldown_ability_1 = new cooldown(Mage_statics.ability_1_cooldown); ai_cooldown_ability_2 = new cooldown(Mage_statics.ability_2_cooldown); ai_cooldown_ability_3 = new cooldown(Mage_statics.ability_3_cooldown); ai_cooldown_ability_4 = new cooldown(Mage_statics.ability_4_cooldown); ai_cooldown_potion = new cooldown(Statics.potion_cooldown); }
IEnumerator cdFinished(cooldown c, SpriteRenderer cr) { cr.transform.localScale = new Vector3(HOTBARITEM_SIZE, HOTBARITEM_SIZE, HOTBARITEM_SIZE); for (float i = 0; i < 5; i++) { Color a = new Color(255, 255, 255, 1); Color b = new Color(255, 255, 255, 0); float e = i / 5; Color lc = Color.Lerp(a, b, e); cr.color = lc; yield return(null); } Destroy(cr.gameObject); }
IEnumerator cdFinished(cooldown c, List <SpriteRenderer> cr) { // for(int o = 0;o<c.goc.Length;o++){ // for(float i = 0;i<5;i++){ // Color a = new Color(255,255,255,1); // Color b = new Color(255,255,255,0); // float e = i/5; // Color lc = Color.Lerp(a,b,e); // cr[o].color = lc; yield return(null); // } // Destroy(cr[o].gameObject); // } }