Пример #1
0
    // OnEnable(): is called when the gameObject becomes active
    public void BecomesEnable()
    {
        if (m_WallRendererType == WallRendererType.SideWall)
        {
            if (Wall.Instance != null)
                fMovementSpeed = Wall.Instance.WallSidesSpeed;
            // if: Spawns the new instance based on the position of the last instance
            if (s_lastWallSideInstance == null)
            {
                transform.position = Vector3.zero;
            }
            else
                transform.position = s_lastWallSideInstance.transform.position + new Vector3(0f, fSpriteLength, 0f);

            // Sets this to the most recent instance
            s_lastWallSideInstance = this;
        }
        else
        {
            if (Wall.Instance != null)
                fMovementSpeed = Wall.Instance.WallBackgroundSpeed;

            // if: Spawns the new instance based on the position of the last instance
            if (s_lastWallBackgroundInstance == null)
                transform.position = Vector3.zero;
            else
                transform.position = s_lastWallBackgroundInstance.transform.position + new Vector3(0f, fSpriteLength, 0f);

            // Sets this to the most recent instance
            s_lastWallBackgroundInstance = this;
        }
    }
Пример #2
0
    // OnEnable(): is called when the gameObject becomes active
    public void BecomesEnable()
    {
        if (m_WallRendererType == WallRendererType.SideWall)
        {
            if (Wall.Instance != null)
                fMovementSpeed = Wall.Instance.WallSidesSpeed;
            // if: Spawns the new instance based on the position of the last instance
            if (s_lastWallSideInstance == null)
            {
                transform.position = Vector3.zero;
            }
            else
                transform.position = s_lastWallSideInstance.transform.position + new Vector3(0f, fSpriteLength, 0f);

            // Sets this to the most recent instance
            s_lastWallSideInstance = this;
        }
        else
        {
            if (Wall.Instance != null)
                fMovementSpeed = Wall.Instance.WallBackgroundSpeed;

            // if: Spawns the new instance based on the position of the last instance
            if (s_lastWallBackgroundInstance == null)
                transform.position = Vector3.zero;
            else
                transform.position = s_lastWallBackgroundInstance.transform.position + new Vector3(0f, fSpriteLength, 0f);

            // Sets this to the most recent instance
            s_lastWallBackgroundInstance = this;
        }
    }
Пример #3
0
    public static void LoadScene(int _sceneId)
    {
        Application.LoadLevel(2);

        // Call All Reset Statics
        PlayerChildFSM.ResetStatics();
        PlayerMain.ResetStatics();
        player_control.ResetStatics();
        GameManager.ResetStatics();
        EndGamePanel.ResetStatics();

        PlayerSquadFSM.ResetStatics();
        SquadChildFSM.ResetStatics();

        Wall.ResetStatics();
        WallRenderer.ResetStatics();
        Nutrients.ResetStatics();

        ECPoolManager.ResetStatics();
        ECIdleState.ResetStatics();
        DirectionDatabase.ResetStatics();
        FormationDatabase.ResetStatics();
        PathQuery.ResetStatics();
        PointDatabase.ResetStatics();
        PositionQuery.ResetStatics();
        ECTracker.ResetStatics();

        EnemyMainFSM.ResetStatics();

        Application.LoadLevel(_sceneId);
    }
Пример #4
0
    public void GenerateRoom()
    {
        grid = new string[, ] {
            { "#", "#", "#", "#", "#" },
            { "#", ".", ".", ".", "#" },
            { "#", ".", ".", ".", "#" },
            { "#", ".", ".", ".", "#" },
            { "#", "#", "#", "#", "#" }
        };
        wall_chain = new Dictionary <Vector2, Vector2>();

        WallRenderer wr = GetComponent <WallRenderer>();

        wr.RenderWalls(GenerateWalls());
    }
Пример #5
0
        private void CreateBuffer(IRenderizable game, IntPtr boardTexture)
        {
            FOVComp = game.Entities.GetSingleComponent <FOVComp>();

            var boardComp = game.Entities.GetSingleComponent <BoardComp>();

            BoardSize = boardComp.BoardSize.Multiply(BoardComp.TILE_SIZE);

            BoardBufferTexture = SDL_CreateTexture(
                UxContext.WRenderer,
                SDL_PIXELFORMAT_RGBA8888,
                (int)SDL_TextureAccess.SDL_TEXTUREACCESS_TARGET,
                BoardSize.Width,
                BoardSize.Height
                );
            SDL_SetTextureBlendMode(BoardBufferTexture, SDL_BlendMode.SDL_BLENDMODE_BLEND);
            SDL_SetRenderTarget(UxContext.WRenderer, BoardBufferTexture);

            using var tileRenderer = new TileRenderer(UxContext, game);
            var tileEntities = game.Entities.GetWithComponent <TileComp>();

            tileRenderer.Render(tileEntities, 0);

            using var wallRenderer = new WallRenderer(UxContext, game, boardTexture);
            var wallEntities = game.Entities.GetWithComponent <IWallComp>();

            wallRenderer.Render(wallEntities, 0);

            using var downStairsRenderer = new DownStairsRenderer(UxContext, game, boardTexture);
            var downStairEntities = game.Entities.GetWithComponent <DownStairsComp>();

            downStairsRenderer.Render(downStairEntities, 0);

            using var upStairsRenderer = new UpStairsRenderer(UxContext, game, boardTexture);
            var upStairsEntities = game.Entities.GetWithComponent <UpStairsComp>();

            upStairsRenderer.Render(upStairsEntities, 0);

            SDL_SetRenderTarget(UxContext.WRenderer, IntPtr.Zero);
        }
Пример #6
0
    private WallRendererType m_WallRendererType; // m_WallRendererType: Is the wall a side-wall or a background

    #endregion Fields

    #region Methods

    public static void ResetStatics()
    {
        s_lastWallBackgroundInstance = null;
        s_lastWallSideInstance = null;
    }
Пример #7
0
	public static void ResetStatics()
	{
		s_lastWallBackgroundInstance = null;
		s_lastWallSideInstance = null;
	}
Пример #8
0
 private void Awake()
 {
     hexRenderer  = GetComponentInChildren <HexRenderer>();
     wallRenderer = GetComponentInChildren <WallRenderer>();
     Grid         = new HexGrid(Width, Height, CellRadius);
 }