Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        hairAnim    = transform.GetChild(6).gameObject.GetComponent <Animator>();
        bodyAnim    = transform.GetChild(7).gameObject.GetComponent <Animator>();
        clothesAnim = transform.GetChild(8).gameObject.GetComponent <Animator>();
        legsAnim    = transform.GetChild(9).gameObject.GetComponent <Animator>();

        lastPosition      = new Vector3(0, 0, 0);
        crateType         = "Empty";
        stamina           = 5;
        maxStamina        = 5;
        rbody             = GetComponent <Rigidbody2D>();
        anim              = GetComponent <Animator>();
        Buildings         = new Dictionary <string, Vector3>();
        food              = 0;
        walkSpeed         = 5;
        spriteMask        = GetComponent <SpriteMask>();
        spriteRenderer    = GetComponent <SpriteRenderer>();
        canMove           = true;
        townHallDoor      = new Vector3(-13, -3, 0);
        alreadyInPosition = new Dictionary <Vector3Int, bool>();
        gameManager       = GameObject.Find("GameManager").GetComponent <GameManager>();
        crateContent      = gameObject.transform.GetChild(4).gameObject.GetComponent <SpriteRenderer>();
        gameObject.transform.GetChild(4).gameObject.SetActive(false);
        crateInnerSprite      = gameObject.transform.GetChild(4).gameObject.GetComponent <SpriteRenderer>();
        timer                 = 0;
        inventory             = gameObject.transform.GetChild(10).gameObject;
        inventoryActive       = inventory.transform.GetChild(0).gameObject;
        inventorySceneManager = GameObject.Find("InventorySceneManager").GetComponent <InventorySceneManager>();
    }
Beispiel #2
0
 void Awake()
 {
     if (inventorySceneManager == null)
     {
         DontDestroyOnLoad(gameObject);
         inventorySceneManager = this;
     }
     else if (inventorySceneManager != this)
     {
         Destroy(gameObject);
     }
 }
Beispiel #3
0
 // Start is called before the first frame update
 void Start()
 {
     rbody                 = GetComponent <Rigidbody2D>();
     anim                  = GetComponent <Animator>();
     canMove               = false;
     inventorySlot         = 0;
     maxSlots              = 1;
     inventory             = gameObject.transform.GetChild(1).gameObject;
     inventorySceneManager = GameObject.Find("InventorySceneManager").GetComponent <InventorySceneManager>();
     inventoryActive       = gameObject.transform.GetChild(1).GetChild(inventorySceneManager.inventoryActive).gameObject;
     deactivateInventorySlots();
     setInventoryItem(inventorySceneManager.inventoryActive);
     sceneFader  = GameObject.Find("SceneFadeout").GetComponent <SceneFadeout>();
     hairAnim    = transform.GetChild(3).gameObject.GetComponent <Animator>();
     bodyAnim    = transform.GetChild(4).gameObject.GetComponent <Animator>();
     clothesAnim = transform.GetChild(5).gameObject.GetComponent <Animator>();
     legsAnim    = transform.GetChild(6).gameObject.GetComponent <Animator>();
 }
Beispiel #4
0
 // Start is called before the first frame update
 void Start()
 {
     sceneFader = GameObject.Find("SceneFadeout").GetComponent <SceneFadeout>();
     rbody      = GetComponent <Rigidbody2D>();
     anim       = GetComponent <Animator>();
     anim.SetFloat("runMultiplyer", 0.8f);
     hairAnim    = transform.GetChild(3).gameObject.GetComponent <Animator>();
     bodyAnim    = transform.GetChild(4).gameObject.GetComponent <Animator>();
     clothesAnim = transform.GetChild(5).gameObject.GetComponent <Animator>();
     legsAnim    = transform.GetChild(6).gameObject.GetComponent <Animator>();
     canMove     = true;
     exit        = new List <Vector3Int>(new Vector3Int[] {
         new Vector3Int(-27, -1, 0),
         new Vector3Int(-27, 0, 0),
         new Vector3Int(-27, 1, 0),
         new Vector3Int(-27, 2, 0),
         new Vector3Int(-27, 3, 0)
     });
     inventory             = gameObject.transform.GetChild(1).gameObject;
     inventoryActive       = inventory.transform.GetChild(0).gameObject;
     inventorySceneManager = GameObject.Find("InventorySceneManager").GetComponent <InventorySceneManager>();
 }