Beispiel #1
0
    public void MapNeighors()
    {
        foreach (CubeLogic cube in m_cubeLogics)
        {
            List <Vector3> possibleNeighborPosition = new List <Vector3> {
                new Vector3(cube.M_InitialPosition.x + 7, cube.M_InitialPosition.y, cube.M_InitialPosition.z),
                new Vector3(cube.M_InitialPosition.x - 7, cube.M_InitialPosition.y, cube.M_InitialPosition.z),
                new Vector3(cube.M_InitialPosition.x, cube.M_InitialPosition.y, cube.M_InitialPosition.z + 7),
                new Vector3(cube.M_InitialPosition.x, cube.M_InitialPosition.y, cube.M_InitialPosition.z - 7),
                new Vector3(cube.M_InitialPosition.x + 7, cube.M_InitialPosition.y + 7, cube.M_InitialPosition.z),
                new Vector3(cube.M_InitialPosition.x - 7, cube.M_InitialPosition.y + 7, cube.M_InitialPosition.z),
                new Vector3(cube.M_InitialPosition.x, cube.M_InitialPosition.y + 7, cube.M_InitialPosition.z + 7),
                new Vector3(cube.M_InitialPosition.x, cube.M_InitialPosition.y + 7, cube.M_InitialPosition.z - 7),
                new Vector3(cube.M_InitialPosition.x + 7, cube.M_InitialPosition.y - 7, cube.M_InitialPosition.z),
                new Vector3(cube.M_InitialPosition.x - 7, cube.M_InitialPosition.y - 7, cube.M_InitialPosition.z),
                new Vector3(cube.M_InitialPosition.x, cube.M_InitialPosition.y - 7, cube.M_InitialPosition.z + 7),
                new Vector3(cube.M_InitialPosition.x, cube.M_InitialPosition.y - 7, cube.M_InitialPosition.z - 7)
            };

            foreach (Vector3 v in possibleNeighborPosition)
            {
                CubeLogic neighbor = FindCubeByPosition(v);
                if (neighbor != null)
                {
                    cube.AddNeighbor(neighbor);
                }
            }
        }
    }
Beispiel #2
0
 public EnemyLogic(Vector3 position, CubeLogic cubeLogic) : base(position, cubeLogic)
 {
 }
Beispiel #3
0
 public virtual void Jump(CubeLogic cubeLogic)
 {
     m_cubeLogic = cubeLogic;
 }
Beispiel #4
0
 public CharacterLogic(Vector3 position, CubeLogic cubeLogic)
 {
     m_initialPosition = position;
     m_cubeLogic       = cubeLogic;
 }
Beispiel #5
0
 public void Initialize(CubeLogic cubeLogic)
 {
     this.m_cubeLogic = cubeLogic;
 }
Beispiel #6
0
 public void AddNeighbor(CubeLogic cubeLogic)
 {
     m_neighbors.Add(cubeLogic);
 }
Beispiel #7
0
 public override void Jump(CubeLogic cubeLogic)
 {
     base.Jump(cubeLogic);
     cubeLogic.IsReached();
 }
Beispiel #8
0
 public PlayerLogic(Vector3 position, CubeLogic cubeLogic) : base(position, cubeLogic)
 {
     m_isDead = false;
 }
    void Start()
    {
        if (cubewidth <= 0)
        {
            cubewidth = 1;
        }
        // variabelen
        moves = new Queue <Rotation>();
        T     = (cubewidth * tiledistance) / 2;
        t     = T - tiledistance / 2;
        Quaternion front  = Quaternion.Euler(new Vector3(0f, 180f, 0f));
        Quaternion back   = Quaternion.Euler(new Vector3(0f, 0f, 0f));
        Quaternion left   = Quaternion.Euler(new Vector3(0f, 270f, 0f));
        Quaternion right  = Quaternion.Euler(new Vector3(0f, 90f, 0f));
        Quaternion top    = Quaternion.Euler(new Vector3(90f, 90f, 0f));
        Quaternion bottom = Quaternion.Euler(new Vector3(270f, 90f, 0f));

        Quaternion[] tilerotations = { front, back, left, right, top, bottom };
        this.tilerotations = tilerotations;
        Vector3 startposfront  = new Vector3(t, t, T);
        Vector3 startposback   = new Vector3(t, t, -T);
        Vector3 startposleft   = new Vector3(T, t, t);
        Vector3 startposright  = new Vector3(-T, t, t);
        Vector3 startpostop    = new Vector3(t, T, t);
        Vector3 startposbottom = new Vector3(t, -T, t);

        Vector3[] startingpoints = { startposfront, startposback, startposleft, startposright, startpostop, startposbottom };
        this.startingpoints = startingpoints;

        Vector3 firstaxisrow  = new Vector3(-tiledistance, 0f, 0f);
        Vector3 secondaxisrow = new Vector3(0f, -tiledistance, 0f);
        Vector3 thirdaxisrow  = new Vector3(0f, 0f, -tiledistance);

        Vector3[] rowsteps = { firstaxisrow, secondaxisrow, thirdaxisrow };
        this.rowsteps = rowsteps;
        Vector3 firstaxiscollumn  = new Vector3(0f, -tiledistance, 0f);
        Vector3 secondaxiscollumn = new Vector3(0f, 0f, -tiledistance);
        Vector3 thirdaxiscollumn  = new Vector3(-tiledistance, 0f, 0f);

        Vector3[] collumnsteps = { firstaxiscollumn, secondaxiscollumn, thirdaxiscollumn };
        this.collumnsteps = collumnsteps;
        // unity objecten
        cubeLogic  = GetComponent <CubeLogic>();
        colorTable = GetComponent <ColorTable>();
        cubeLogic.InitializeCube(this.cubewidth);
        rotator = new GameObject("rotator");
        rotator.transform.parent = transform;
        allTiles         = new Tile[cubeLogic.triplemove, cubewidth];
        cubeHolder       = new GameObject("CubeHolder");
        transform.parent = cubeHolder.transform;
        Camera.main.GetComponent <CameraScript>().SetParent(transform);
        if (afterImage)
        {
            afterImageObject = Instantiate(afterImageObject);
            afterImageObject.transform.parent = transform;
            afterImage_ms = afterImageObject.GetComponent <MeshRenderer>();
        }
        if (rotationCover)
        {
            coverTiles    = new Transform[4];
            coverTiles_ms = new MeshRenderer[4];
            for (int i = 0; i < 4; i++)
            {
                coverTiles[i]            = Instantiate(coverTile.transform, transform);
                coverTiles_ms[i]         = coverTiles[i].GetComponent <MeshRenderer>();
                coverTiles_ms[i].enabled = false;
            }
            for (int i = 0; i < 2; i++)
            {
                coverTiles[i].parent = rotator.transform;
            }
        }
        if (blocks)
        {
            blockarray = new GameObject[cubewidth, cubewidth, cubewidth];
            SpawnCubeBlocks();
        }
        // kubus
        SpawnTiles();
        Graphical_UpdateEverything();
    }