public void SpawnME(FMail myMailData) { myData = myMailData; //spawning from line SpawnText(new Vector3(-1.1f, 2.7f, -0.01f), myData.from); //spawning subject line SpawnText(new Vector3(-1.1f, 1.8f, -0.01f), myData.subject); //spawnign my buttons if (myData.hasFile) { GameObject myViewButton = Instantiate(viewButtonPF); myViewButton.transform.parent = transform; myViewButton.transform.localPosition = new Vector3(-1.9f, -2.7f, -0.01f); myViewButton.GetComponent <scrViewButton> ().virus = myData.virus; myViewButton.GetComponent <scrViewButton> ().file = myData.myFile; } GameObject myStartButton = Instantiate(sendButtonPF); myStartButton.transform.parent = transform; myStartButton.transform.localPosition = new Vector3(1.8f, -2.7f, -0.01f); myStartButton.GetComponent <scrSendButton> ().needsFile = myMailData.needsFile; //spawning content of the mail transform.GetComponent <scrTextFile> ().SpawnTextWindow(new Vector3(-2.9f, 0.9f, -0.01f), myData.content); }
public void ClearBigMail(FMail mailTest) { if (myBigMail != null) { if (myBigMail.GetComponent <scrBigMail>().myData == mailTest) { Destroy(myBigMail); } } }
public void OpenBigMail(FMail mailData) { if (myBigMail != null) { ClearBigMail(myBigMail.GetComponent <scrBigMail>().myData); } myBigMail = Instantiate(bigMailPF); myBigMail.transform.parent = transform; myBigMail.transform.localPosition = new Vector3(2f, -0.45f, -0.01f); myBigMail.GetComponent <scrBigMail> ().SpawnME(mailData); }
public IEnumerator SpawnMail(FMail myMail) { //wait for the time the ad is meant to show up yield return(new WaitForSeconds(myMail.spawnDelay)); //calculate the boundaries //geting mail dimensions Vector2 mailDimension = new Vector2(); mailDimension.x = smallMail.transform.localScale.x * smallMail.GetComponent <SpriteRenderer> ().sprite.bounds.size.x; mailDimension.y = smallMail.transform.localScale.y * smallMail.GetComponent <SpriteRenderer> ().sprite.bounds.size.y; GameObject obj = Instantiate(smallMail); obj.transform.parent = GameObject.Find("In Look").transform; GameObject.Find("In Look").transform.GetComponent <scrInLook> ().myMails.Add(myMail); obj.transform.localPosition = new Vector3(-3f, 2.25f - 0.9f * GameObject.Find("In Look").transform.GetComponent <scrInLook> ().myMails.Count, -0.01f); obj.GetComponent <scrSmallMail> ().myData = myMail; //add it to the mail list //add the memory value of the ad to the RAM //GetComponent<scrSpaceValues> ().currentRAM += 1f; }
//workaround public void MailToSpawn(FMail myMail) { StartCoroutine(SpawnMail(myMail)); }
public void RemoveMail(FMail mail) { myMails.Remove(mail); StartCoroutine(delayedRearange()); //RearangeMails (); }