Esempio n. 1
0
    // Controller depends on interfaces for the model and view
    public void Initialize(ITileMapObject view)
    {
        entities  = new List <IEntity>();
        mapModels = new List <ITileMapData>();
        // Listen to input from the view

        mapView         = view;
        currentMapIndex = 0;
    }
    void Start()
    {
        //Set the game managers instance to this so that we can access it statically
        GameManager.instance = this;

        //Initialise the item database
        ItemDatabase.LoadDatabase();

        //Load the map prefab and initialize it
        var prefab   = Resources.Load <GameObject>("Prefabs/TileMap");
        var instance = Instantiate(prefab);

        MapView = instance.GetComponent <ITileMapObject>();

        //create the map manager and pass it the map object
        MapManager = gameObject.AddComponent <TileMapManager>();
        MapManager.Initialize(MapView);

        selectionPrefab = Resources.Load <GameObject>("Prefabs/SelectedObject");
        //Initialize the starting state of the game
        StartGame();
    }
Esempio n. 3
0
        void EnterPortal(Portal portal)
        {
            if (portal == null)
            {
                return;
            }

            Portal linkedPortal = portal.LinkedPortal;

            if (linkedPortal == null)
            {
                return;
            }

            ITileMapObject tileMapObj = linkedPortal.GetComponent <ITileMapObject>();

            if (tileMapObj == null)
            {
                return;
            }

            StopMove();
            SetPos(tileMapObj.TilePos);
            SetDir(Direction.Bottom);

            if (this.warpSound)
            {
                AudioSource.PlayClipAtPoint(warpSound, Camera.main.transform.position);
            }

            this.warpping = true;

            StartCoroutine(CoroutineUtil.DelayRoutine(1.0f,
                                                      delegate() {
                this.warpping = false;
            }
                                                      ));
        }
Esempio n. 4
0
 public void AddOnObject(ITileMapObject obj)
 {
     objectsOnNodeSet.Add(obj);
 }
Esempio n. 5
0
 public void SubOnObject(ITileMapObject obj)
 {
     objectsOnNodeSet.Remove(obj);
 }