예제 #1
0
    //private Tile.TileType[] inventoryItemsList;

    private void Awake()
    {
        mapHandlerExp      = FindObjectOfType <MapHandlerExp>();
        _UIInventoryItems  = GetComponentsInChildren <UIOnSelection>();
        inventoryItemNames = System.Enum.GetNames(typeof(InventoryItems));
        //inventoryItemsList = GetInventoryItems();
    }
예제 #2
0
    private void Start()
    {
        mapHandlerExp = FindObjectOfType <MapHandlerExp>();
        GameMaster.instance.OnInventoryItemSelected   += HighlightSelectedTile;
        GameMaster.instance.OnInventoryItemDeselected += DeleteHighlightPrefab;

        tileHighlightImageClone             = Instantiate(tileHighlightImage, Vector2.zero, Quaternion.identity, transform);
        tileHighlightSpriteRenderer         = tileHighlightImageClone.GetComponent <SpriteRenderer>();
        tileHighlightSpriteRenderer.enabled = false;
    }
예제 #3
0
    public override void Init(MapHandlerExp mapHandler, Vector2 initSpace)
    {
        this.mapHandler = mapHandler;
        GetComponent <SpriteRenderer>().sprite = entryArrow;

        curSpace = initSpace;

        //Top player spawn
        if (curSpace.y == (mapHandler.tileGrid.GetLength(1) - 1))
        {
            heroDir = HeroDirections.Down;
            transform.localEulerAngles = new Vector3(0, 0, 180);
            curSpace  = new Vector2(curSpace.x, curSpace.y + 3);
            nextSpace = new Vector2(curSpace.x, curSpace.y - 1);
        }

        //Bottom player spawn
        else if (curSpace.y == 0)
        {
            heroDir = HeroDirections.Up;
            transform.localEulerAngles = new Vector3(0, 0, 0);
            curSpace  = new Vector2(curSpace.x, curSpace.y - 3);
            nextSpace = new Vector2(curSpace.x, curSpace.y + 1);
        }

        //Left player spawn
        else if (curSpace.x == 0)
        {
            heroDir = HeroDirections.Right;
            transform.localEulerAngles = new Vector3(0, 0, 270);
            curSpace  = new Vector2(curSpace.x - 3, curSpace.y);
            nextSpace = new Vector2(curSpace.x + 1, curSpace.y);
        }

        //Right player spawn
        else if (curSpace.x == (mapHandler.tileGrid.GetLength(0) - 1))
        {
            heroDir = HeroDirections.Left;
            transform.localEulerAngles = new Vector3(0, 0, 90);
            curSpace  = new Vector2(curSpace.x + 3, curSpace.y);
            nextSpace = new Vector2(curSpace.x - 1, curSpace.y);
        }

        //Else illegal spawn
        else
        {
            print("Tried to spawn the hero at x=" + curSpace.x + ", y=" + curSpace.y + " which is ILLEGAL (so we're just gonna default to some arbitrary values, please fix)");
            heroDir   = HeroDirections.Up;
            nextSpace = new Vector2(curSpace.x, curSpace.y + 1);
        }
    }
예제 #4
0
 public abstract void Init(MapHandlerExp mapHandler, Vector2 initSpace);
예제 #5
0
 void Start()
 {
     mapHandlerExp  = FindObjectOfType <MapHandlerExp>();
     levelName.text = GameMaster.instance.GetCurrentSceneName();
 }
예제 #6
0
 private void Awake()
 {
     mapHandlerExp = FindObjectOfType <MapHandlerExp>();
     numOfInventoryItemsController = GetComponent <NumberOfInventoryItemsController>();
     button = GetComponent <Button>();
 }
예제 #7
0
 public override void Init(MapHandlerExp mapHandler, Vector2 initSpace)
 {
     this.mapHandler = mapHandler;
     curSpace        = initSpace;
     mainDeg         = Random.Range(0f, 360f);
 }