public void setTileMapSprite(Vector3 t_worldPos, TileMapObject.TileMapSprite tileMapSprite)
    {
        TileMapObject tilemapObject = m_gridMap.getGridObject(t_worldPos);

        if (tilemapObject != null)
        {
            tilemapObject.setTileMapSprite(tileMapSprite);
        }
    }
Exemple #2
0
        public TileMapCollisionObject(TileMapObject tileMapObj, Texture2D debugTexture)
        {
            Position = new Vector2(tileMapObj.X, tileMapObj.Y);

            if (tileMapObj.ObjectType == TileMapObjectType.Rectangle)
            {
                TileMapRectangleObject rectObj = (TileMapRectangleObject)tileMapObj;
                Position += rectObj.Size / 2f;
            }

            _debugTexture = debugTexture;
        }
        private void ProcessObjectProperties(TileMapObjectData objectData, TileMapObject tileMapObject)
        {
            if (objectData is null || tileMapObject is null)
            {
                return;
            }

            foreach (var prop in objectData.Properties)
            {
                tileMapObject.CustomProperties.Add(prop.Name, prop.Value);
            }
        }
Exemple #4
0
        public bool CanRemoveTree(TileMapObject tileMapObject)
        {
            if (tileMapObject is TreeTileMapObject mapObject)
            {
                if (!mapObject.EntityInActionRadius(Owner as Entity))
                {
                    return(true);
                }

                return(treeActionRadiusList.Count > 1); //one because if we delete one, we should still be in one radius. Otherwise we can't navigate anymore
            }

            return(false);
        }
        private void WriteSharedObjectData(ContentWriter output, TileMapObject obj)
        {
            output.Write(obj.Id);
            output.Write(obj.Name ?? string.Empty);
            output.Write(obj.Type ?? string.Empty);

            output.Write(obj.X);
            output.Write(obj.Y);

            output.Write(obj.CustomProperties.Count);

            foreach (var keyValuePair in obj.CustomProperties)
            {
                output.Write(keyValuePair.Key);
                output.Write(keyValuePair.Value);
            }
        }
Exemple #6
0
        void OnTriggerEnter2D(Collider2D other)
        {
            TileMapObject objUnit = other.GetComponent <TileMapObject>();

            if (objUnit)
            {
                IDamageAble damageAbleObj = objUnit.GetComponentInParent <IDamageAble>();
                if (damageAbleObj != null)
                {
                    IAttackAble attackAble = actor as IAttackAble;
                    if (damageAbleObj != null && attackAble != null)
                    {
                        damageAbleObj.OnDamage(attackAble.AttackPower, attackAble);
                    }

                    StopMove();
                }

                if (!this.warpping)
                {
                    Portal portal = objUnit.GetComponentInParent <Portal>();
                    if (portal)
                    {
                        EnterPortal(portal);
                    }
                }

                if (!this.warpping)
                {
                    EnterToOtherMap[] enterToOtherMapList = objUnit.GetComponentsInParent <EnterToOtherMap>();
                    if (enterToOtherMapList != null && enterToOtherMapList.Length > 0)
                    {
                        EnterToOtherMap enterToOtherMap = enterToOtherMapList[0];
                        enterToOtherMap.EnterBy(this.actor);
                    }
                }
            }
        }