Closed rifaterdemsahin closed 6 years ago
think on outsourcing the parts....not only you working. you and them working at the same time. Part of the work! not coding it can be also music,design it has to be related.
it can be level design. The first one failed.1
place holders needed
Prefabs starting in the same folder
Game controller will manuplate them
// Use this for initialization void Start() {
letterOne.GetComponentInChildren<SpriteRenderer>().sprite.name = Word[0].ToString();
letterTwo.GetComponentInChildren<SpriteRenderer>().sprite.name = Word[1].ToString();
if (Word.Length > 2)
letterThree.GetComponentInChildren<SpriteRenderer>().sprite.name = Word[2].ToString();
if (Word.Length > 3)
letterFour.GetComponentInChildren<SpriteRenderer>().sprite.name = Word[3].ToString();
if (Word.Length > 4)
letterFive.GetComponentInChildren<SpriteRenderer>().sprite.name = Word[4].ToString();
if (Word.Length > 5)
letterSix.GetComponentInChildren<SpriteRenderer>().sprite.name = Word[5].ToString();
}
did not change them
resource load ? ( ask some game developer questions )
Games are all about loadiung them
can not load so going this way
Even this is ok in mvp ( iterations will come )
active to off
iterations and mapping
Technical debt hacking
using System; using System.Collections; using System.Collections.Generic; using UnityEngine;
public class setLettersInTheBowl : MonoBehaviour {
public GameObject letterOne;
public GameObject letterTwo;
public GameObject letterThree;
public GameObject letterA;
public GameObject letterB;
public GameObject letterC;
public GameObject letterD;
public GameObject letterE;
public GameObject letterF;
public GameObject letterG;
public GameObject letterH;
public GameObject letterJ;
public GameObject letterK;
public GameObject letterL;
public GameObject letterM;
public GameObject letterN;
public GameObject letterO;
public GameObject letterP;
public GameObject letterR;
public GameObject letterS;
public GameObject letterT;
public GameObject letterU;
public GameObject letterY;
public GameObject letterV;
public GameObject letterX;
public GameObject letter1position;
public GameObject letter2position;
public GameObject letter3position;
public string Word;
// Use this for initialization
void Start()
{
letterOne = getGameObjectLetter(Word[0]);
letterOne.transform.position = letter1position.transform.position;
letterTwo = getGameObjectLetter(Word[1]);
letterTwo.transform.position = letter2position.transform.position;
letterThree = getGameObjectLetter(Word[2]);
letterThree.transform.position = letter3position.transform.position;
//Copy path
Sprite a = Resources.Load("Assets/A10poc_lettersdynamic/alphabet/A.png", typeof(Sprite)) as Sprite;
letterTwo.GetComponentInChildren<SpriteRenderer>().sprite.name = Word[1].ToString();
// Sprite a = Resources.Load("/alphabet/A.png", typeof(Sprite)) as Sprite;
// Sprite a = Resources.Load("alphabet/A.png", typeof(Sprite)) as Sprite;
// Sprite a = Resources.Load("A.png", typeof(Sprite)) as Sprite;
//foreach (var item in GetComponentsInChildren<Sprite>())
//{
// letterOne.GetComponentInChildren<SpriteRenderer>().sprite = item;
//}
//letterTwo.GetComponentInChildren<SpriteRenderer>().sprite.name = Word[1].ToString();
//if (Word.Length > 2)
// letterThree.GetComponentInChildren<SpriteRenderer>().sprite.name = Word[2].ToString();
//if (Word.Length > 3)
// letterFour.GetComponentInChildren<SpriteRenderer>().sprite.name = Word[3].ToString();
//if (Word.Length > 4)
// letterFive.GetComponentInChildren<SpriteRenderer>().sprite.name = Word[4].ToString();
//if (Word.Length > 5)
//letterSix.GetComponentInChildren<SpriteRenderer>().sprite.name = Word[5].ToString();
}
private GameObject getGameObjectLetter(char v)
{
if (v == 'S')
return letterS;
if (v == 'B')
return letterB;
if (v == 'Y')
return letterY;
if (v == 'E')
return letterE;
return null;
}
// Update is called once per frame
void Update()
{
}
}
https://user-images.githubusercontent.com/5270036/44134938-d2d844d6-a05e-11e8-8b56-44fe99056cac.png
pick them from the folder and place them Doing a prefab can be smart.