コード例 #1
0
    // Use this for initialization
    void Start()
    {
        this.mapActor       = this.GetComponent <MapActor>();
        this.spriteRenderer = this.GetComponent <SpriteRenderer>();
        if (this.spriteRenderer == null)
        {
            this.spriteRenderer = this.GetComponentInChildren <SpriteRenderer>();
        }

        if (this.spriteRenderer == null)
        {
            Debug.LogError("No SpriteRenderer found on MapFloater gameObject: " + gameObject.name);
            this.enabled = false;
            return;
        }

        if (this.floatingSprite == null)
        {
            Debug.LogError("No Floating Sprite found on MapFloater gameObject: " + gameObject.name);
            this.enabled = false;
            return;
        }
        this.originalSprite        = this.spriteRenderer.sprite;
        this.originalLayeringOrder = this.spriteRenderer.sortingOrder;
        this.mapObjectCell         = this.GetComponentInChildren <MapObjectCell>();
        this.RectTransform         = this.GetComponent <RectTransform>();
        this.gameManager           = GameManager.GetGameManager();
        this.pushawayCoroutines    = new Queue <Coroutine>();
        this.blinkCoroutines       = new Queue <Coroutine>();
    }
コード例 #2
0
    private GameObject ReadObjectTile(string tileInfo)
    {
        GameObject    cell      = new GameObject("CellInfo");
        MapObjectCell mapObject = cell.AddComponent <MapObjectCell>();

        string[] data = tileInfo.Substring(1).Split(new char[] { '|' });
        if (data.Length != 2)
        {
            throw new System.Exception("Invalid object");
        }
        var position = ReadTilePosition(tileInfo);

        mapObject.Row    = (int)position.x;
        mapObject.Column = (int)position.y;
        mapObject.Prefab = definitions[data[1].Trim()];
        return(cell);
    }
コード例 #3
0
 public bool IsInSamePlace(MapObjectCell cell2)
 {
     return(this.Row == cell2.Row && this.Column == cell2.Column);
 }