Example #1
0
    void FixedUpdate()
    {
        anim += navdi3.Util.remap(0, speed, animSpeed, movingAnimSpeed, body.velocity.magnitude);
        anim %= 4;
        switch ((int)anim)
        {
        case 0: spriter.sprite = sprs[0]; break;

        case 1: spriter.sprite = sprs[1]; spriter.flipX = true; break;

        case 2: spriter.sprite = sprs[0]; break;

        case 3: spriter.sprite = sprs[1]; spriter.flipX = false; break;
        }

        var pinMove = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")).normalized;

        pinMove.x    += navdi3.nin.JoyAxis(1, 4);
        pinMove.y    -= navdi3.nin.JoyAxis(1, 5);
        body.velocity = pinMove * speed;

        if (pinMove != Vector2.zero)
        {
            facing = new navdi3.twin(pinMove);
        }
        if (facing.x != 0 && facing.y != 0)
        {
            facing.y = 0;
        }
    }
 public void ShotSetup(navdi3.twin dir)
 {
     if (dir.x < 0)
     {
         transform.localScale = new Vector3(-1, 1, 1);
     }
     body.velocity = (Vector2)dir * speed;
 }
Example #3
0
 public static void StraightenCompass()
 {
     if (compassStraight)
     {
         return;
     }
     compass         = new twin[] { right, up, left, down };
     compassStraight = true;
 }
Example #4
0
 public void DoEach(System.Action <twin> func)
 {
     for (twin point = min; point.y <= max.y; point.x = min.x, point.y++)
     {
         for (; point.x <= max.x; point.x++)
         {
             func(point);
         }
     }
 }
Example #5
0
    public override void SpawnTileId(int TileId, navdi3.twin cell)
    {
        switch (TileId)
        {
        case 10: banks["player"].Spawn <CursedLinkPlayer>(GetEntLot("player")).Setup(master, cell); break;

        case 11: banks["wizard"].Spawn <navdi3.maze.MazeBody>(GetEntLot("wizard")).Setup(master, cell); break;

        case 12: banks["hole"].Spawn <HoleForBarrel>(GetEntLot("holes")).Setup(master, cell); break;

        case 13: banks["barrel"].Spawn <PushaBarrel>(GetEntLot("barrels")).Setup(master, cell); break;
        }
    }
Example #6
0
        public int GetArea()
        {
            twin size = max - min + twin.one;

            if (size.x < 0)
            {
                size.x = -size.x;
            }
            if (size.y < 0)
            {
                size.y = -size.y;
            }
            return(size.x * size.y);
        }
Example #7
0
    public override void SpawnTileId(int TileId, navdi3.twin cell)
    {
        switch (TileId)
        {
        case 50:
            banks["player"].Spawn <MazeBody>(GetEntLot("player")).Setup(master, cell);
            //Sett(cell, 0);
            break;

        case 52:
            foodSpawnPoints.Add(cell);
            //Sett(cell, 0);
            break;

        case 56:
            banks["eater"].Spawn <MazeBody>(GetEntLot("guts")).Setup(master, cell);
            //Sett(cell, 0);
            break;
        }
    }
Example #8
0
    override public void FixedUpdate()
    {
        base.FixedUpdate();

        ani.speed = navdi3.Util.remap(0, speed, stillAnispd, movingAnispd, body.velocity.magnitude);

        var pinMove = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        pinMove.x += navdi3.nin.JoyAxis(1, 4);
        pinMove.y -= navdi3.nin.JoyAxis(1, 5);
        pinMove.Normalize();
        body.velocity = body.velocity * 0.5f + 0.5f * pinMove * speed;

        if (pinMove != Vector2.zero)
        {
            facing = new navdi3.twin(pinMove);
        }
        if (facing.x != 0 && facing.y != 0)
        {
            facing.y = 0;
        }
    }
Example #9
0
 public override void SpawnTileId(int TileId, navdi3.twin TilePos)
 {
     throw new System.NotImplementedException();
 }
Example #10
0
 public bool Contains(twin point)
 {
     return(point >= min && point <= max);
 }
Example #11
0
 public twinrect(twin min, twin max)
 {
     this.min = min; this.max = max;
 }
Example #12
0
 public twinrect(int x1, int y1, int x2, int y2)
 {
     this.min = new twin(x1, y1); this.max = new twin(x2, y2);
 }