コード例 #1
0
 public static bool AskForMapGridDeep(int SceneID,
                                      MapStations m,
                                      int StaionsDeep,
                                      LifeMCamp Camp,
                                      DIR dir,
                                      SEARCHAGT ST,
                                      ref Int2 Pos,
                                      ref int Deep)
 {
     if (ST == SEARCHAGT.SAGTY_HD)
     {
         return(AskForMapGridDeepHD(SceneID, m, StaionsDeep, Camp, dir, ref Pos, ref Deep));
     }
     else if (ST == SEARCHAGT.SAGTY_THDA)
     {
         return(AskForMapGridDeepAttack(SceneID, m, StaionsDeep, Camp, dir, ref Pos, ref Deep));
     }
     else if (ST == SEARCHAGT.SAGTY_POLL)
     {
         return(AskForMapGridDeepPoll(SceneID, m, StaionsDeep, Camp, dir, ref Pos, ref Deep));
     }
     else
     {
         return(false);
     }
 }
コード例 #2
0
    //申请格子,防止表现途中跟墙穿帮。
    //如诺都不满足,则使用2墙中间的格子。
    public static bool AskForMapGrid(ref MapStations m, DIR dir)
    {
        if (m == null || m is MapStair)
        {
            Debug.Log("MapStations is 非法");
            return(false);
        }

        MapGrid n = m as MapGrid;

        if (n.PropStations == StationsProp.ATTACK)
        {
            return(true);
        }
        else
        {
            m = n.GetNextAttackStation(dir);
            if (m != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
    }
コード例 #3
0
 /// <summary>
 /// 轮询获取下一个给子
 /// </summary>
 private static void GetNASPoll(ref MapGrid l, ref MapGrid r, ref DIR dir, ref MapGrid m)
 {
     if (dir == DIR.LEFT)
     {
         if (l != null)
         {
             l = l.GetNextAttackStation(dir);
         }
         m   = l;
         dir = DIR.RIGHT;
     }
     else if (dir == DIR.RIGHT)
     {
         if (r != null)
         {
             r = r.GetNextAttackStation(dir);
         }
         m   = r;
         dir = DIR.LEFT;
     }
     else
     {
         m = null;
     }
 }
コード例 #4
0
ファイル: MonobotController.cs プロジェクト: vanGeck/democode
        public void Turn(bool right, Action onComplete)
        {
            var turn = right ? _turnRight : _turnLeft;

            transform.DOBlendableRotateBy(turn, .3f)
            .SetEase(Ease.InOutCirc)
            .OnComplete(() => onComplete?.Invoke());

            switch (_heading)
            {
            case DIR.North:
                _heading = right ? DIR.East : DIR.West;
                break;

            case DIR.East:
                _heading = right ? DIR.South : DIR.North;
                break;

            case DIR.South:
                _heading = right ? DIR.West : DIR.East;
                break;

            case DIR.West:
                _heading = right ? DIR.North : DIR.South;
                break;

            default:
                return;
            }
        }
コード例 #5
0
    private void ItlUpdateDirection()
    {
        DIR eCurrDir = ItlGetDirFromInput();

        if (m_eDir == DIR.IDLE &&                               // currently idle
            eCurrDir != DIR.IDLE &&                             // want to jump
            !m_bPrevKeyPressed &&                               // jump only allowed if previously no key was pressed
            m_pBeatMaster.NearestBeat > m_iLastJumpedBeat)      // jump only allowed once per beat
        {
            if (m_pBeatMaster.allowsJump())                     // Check if the beatmaster allows us to jump
            {
                if (m_iLockedBeat != m_pBeatMaster.NearestBeat) // check if movement is not locked
                {
                    //Debug.Log("--- JUMP BEGIN");
                    m_pAnimator.SetTrigger(JUMP);
                    m_eDir            = eCurrDir;                  // change direction
                    m_iLastJumpedBeat = m_pBeatMaster.NearestBeat; // set last beat where pete jumped
                    ItlSetRotationFromDir();                       // apply the rotation corresponding to the current direction
                }
            }
            else
            {
                m_iLockedBeat = m_pBeatMaster.NextBeat;
            }

            if (m_eDir != DIR.IDLE)
            {
                m_pGridMaster.OnDiscoPeteLeavesTile(this, Mathf.FloorToInt(transform.position.x + 0.5f), Mathf.FloorToInt(transform.position.z + 0.5f));
            }
        }

        m_bPrevKeyPressed = (eCurrDir != DIR.IDLE);
    }
コード例 #6
0
 public void LoadConfig(string filename)
 {
     if (File.Exists(filename))
     {
         Clear();
         StreamReader sr     = new StreamReader(filename);
         string       result = sr.ReadToEnd();
         sr.Close();
         string       kq           = RC2.DecryptString(result, Form_QD._key, Form_QD._iv, Form_QD._padMode, Form_QD._opMode);
         StringReader stringReader = new StringReader(kq);
         ReadXml(stringReader);
         stringReader.Close();
     }
     if (DTB.Rows.Count == 0)
     {
         DTB.AddDTBRow("", "");
     }
     if (DIR.Rows.Count == 0)
     {
         DIR.AddDIRRow("", "");
     }
     if (SYS.Rows.Count == 0)
     {
         SYS.AddSYSRow("", "", "", false);
     }
 }
コード例 #7
0
    /// <summary>
    /// Drops in the portal if there is a surface around the chunk World Coordinate.
    /// </summary>
    /// <param name="normalDir">Normal direction.</param>
    /// <param name="chunkCoord">Chunk coordinate.</param>
    /// <param name="threshold">Threshold.</param>
    void spawnPortal(Vector3 chunkCoord, float threshold = 0.6f, float floorHieght = 0f)
    {
        DIR normalDir = DIR.DIR_UP;
        //Chunks chunkCenter = vxe.getChunkFromPt (chunkCoord);
        //Vec3Int chunkVxCoord = vxe.getChunkCoords (chunkCoord);

        int surfaceCount = 0;

        bool[] isChunkSurface = new bool[directions.Length];
        Chunks chunk;

        for (int i = 0; i < isChunkSurface.Length; i++)
        {
            //chunksAround [i] = vxe.getChunkFromPt (chunkVxCoord + );
            chunk = vxe.getChunkFromPt(chunkCoord + directions [i] * 0.1f);
            isChunkSurface [i] = vxe.isChunkASurface(normalDir, chunk, threshold);
            if (isChunkSurface [i])
            {
                surfaceCount++;
            }
        }


        if (surfaceCount > 5)
        {
            Vector3 pos = new Vector3(chunkCoord.x, floorHieght, chunkCoord.z);
            portal.transform.position = chunkCoord;
            portal.SetActive(true);
        }
        //vxe.isChunkASurface (normalDir, chunkCenter, threshold);
    }
コード例 #8
0
    private DIR ItlGetDirFromInput()
    {
        DIR eDir = DIR.IDLE;

        float fHorizontal = Input.GetAxisRaw("Horizontal");
        float fVertical   = Input.GetAxisRaw("Vertical");

        if (fHorizontal > Mathf.Epsilon)
        {
            //Debug.Log("DIR.RIGHT");
            eDir = DIR.RIGHT;
        }
        else if (fHorizontal < -Mathf.Epsilon)
        {
            //Debug.Log("DIR.LEFT");
            eDir = DIR.LEFT;
        }
        else if (fVertical > Mathf.Epsilon)
        {
            //Debug.Log("DIR.UP");
            eDir = DIR.UP;
        }
        else if (fVertical < -Mathf.Epsilon)
        {
            //Debug.Log("DIR.DOWN");
            eDir = DIR.DOWN;
        }

        return(eDir);
    }
コード例 #9
0
    public GameObject GetConnectedMasuObject(DIR _dir)
    {
        GameObject ret = null;

        switch (_dir)
        {
        case DIR.UP:
            ret = up;
            break;

        case DIR.DOWN:
            ret = down;
            break;

        case DIR.LEFT:
            ret = left;
            break;

        case DIR.RIGHT:
            ret = right;
            break;

        default:
            break;
        }
        return(ret);
    }
コード例 #10
0
ファイル: Player.cs プロジェクト: gaoluehan/GladiatorArena
 private Vector2 Move(DIR direction, Vector2 position)
 {
     if (direction == DIR.Down)
     {
         if (position.Y < 10)
         {
             position.Y += 1;
         }
     }
     if (direction == DIR.Up)
     {
         if (position.Y > 0)
         {
             position.Y -= 1;
         }
     }
     if (direction == DIR.Left)
     {
         if (position.X > 0)
         {
             position.X -= 1;
         }
     }
     if (direction == DIR.Right)
     {
         if (position.X < 16)
         {
             position.X += 1;
         }
     }
     return(position);
 }
コード例 #11
0
    /// <summary>
    /// 获取邻居位
    /// </summary>
    public static bool Getbrothers(Int2 p, DIR dir, ref Int2 pos)
    {
        if (dir == DIR.UP)
        {
            pos.Layer = p.Layer + 1;
            pos.Unit  = p.Unit;
        }
        else if (dir == DIR.DOWN)
        {
            pos.Layer = p.Layer - 1;
            pos.Unit  = p.Unit;
        }
        else if (dir == DIR.LEFT)
        {
            pos.Layer = p.Layer;
            pos.Unit  = p.Unit - 1;
        }
        else if (dir == DIR.RIGHT)
        {
            pos.Layer = p.Layer;
            pos.Unit  = p.Unit + 1;
        }
        else
        {
            return(false);
        }

        if (IsInMap(pos))
        {
            return(true);
        }
        return(false);
    }
コード例 #12
0
    //判断反方向
    bool rightabout(DIR dirlater)
    {
        switch (dirlater)
        {
        case DIR.UP:
            if (MoveFront == DIR.DOWN)
            {
                return(false);
            }
            break;

        case DIR.DOWN:
            if (MoveFront == DIR.UP)
            {
                return(false);
            }
            break;

        case DIR.RIGHT:
            if (MoveFront == DIR.LEFT)
            {
                return(false);
            }
            break;

        case DIR.LEFT:
            if (MoveFront == DIR.RIGHT)
            {
                return(false);
            }
            break;
        }
        return(true);
    }
コード例 #13
0
ファイル: Form1.cs プロジェクト: KimGiMyoung/WF_Railway_Panic
        private void Init()
        {
            _image = null;

            for (int i = 0; i < (int)MAP_SIZE.MAP_SIZE_Y; i++)
            {
                for (int j = 0; j < (int)MAP_SIZE.MAP_SIZE_X; j++)
                {
                    _arrPicBox[i, j].Image = null;
                    _arrWayType[i, j]      = WAY_TYPE.NONE;
                }
            }

            _arrPicBox[0, 0].Image = global::WF.Properties.Resources._001;
            _arrPicBox[(int)MAP_SIZE.MAP_SIZE_Y - 1, (int)MAP_SIZE.MAP_SIZE_X - 1].Image = global::WF.Properties.Resources._001;
            _arrWayType[0, 0] = WAY_TYPE.WAY_1;
            _arrWayType[(int)MAP_SIZE.MAP_SIZE_Y - 1, (int)MAP_SIZE.MAP_SIZE_X - 1] = WAY_TYPE.WAY_1;

            _isTrainHorizon   = true;
            _isSafe           = true;
            _train.Image      = Properties.Resources.train2;
            _traingMidPoint.X = _arrPicBox[0, 0].Location.X + 25;
            _traingMidPoint.Y = _arrPicBox[0, 0].Location.Y + 25;
            _train.Size       = _trainSize2;
            SetTrainPos();
            _trainDir = DIR.RIGHT;

            SetBlock();

            _isStageClear = false;
            _timer.Stop();
            _startTimer.Start();
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: KimGiMyoung/WF_Railway_Panic
        private void Move(DIR dir)
        {
            switch (dir)
            {
            case DIR.NONE:
                _isSafe = false;
                break;

            case DIR.LEFT:
                _traingMidPoint.X -= 1;
                break;

            case DIR.RIGHT:
                _traingMidPoint.X += 1;
                break;

            case DIR.UP:
                _traingMidPoint.Y -= 1;
                break;

            case DIR.DOWN:
                _traingMidPoint.Y += 1;
                break;

            default:
                break;
            }

            SetTrainPos();
        }
コード例 #15
0
    /// <summary>
    /// Drops in the portal if there is a surface around the chunk World Coordinate.
    /// </summary>
    /// <param name="normalDir">Normal direction.</param>
    /// <param name="chunkCoord">Chunk coordinate.</param>
    /// <param name="threshold">Threshold.</param>
    IEnumerator spawnPortalThread(Vector3 chunkCoord, float threshold = 0.6f, bool forceSpawn = false)
    {
        DIR normalDir = DIR.DIR_UP;
        //Chunks chunkCenter = vxe.getChunkFromPt (chunkCoord);
        //Vec3Int chunkVxCoord = vxe.getChunkCoords (chunkCoord);

        int surfaceCount = 0;

        bool[] isChunkSurface = new bool[directions.Length];
        Chunks chunk;

        for (int i = 0; i < isChunkSurface.Length; i++)
        {
            //chunksAround [i] = vxe.getChunkFromPt (chunkVxCoord + );
            chunk = vxe.getChunkFromPt(chunkCoord + directions [i] * 0.1f);
            isChunkSurface [i] = vxe.isChunkASurface(normalDir, chunk, threshold);
            if (isChunkSurface [i])
            {
                surfaceCount++;
            }
            yield return(new WaitForSeconds(0.5f));
        }

        if (surfaceCount > 5 || forceSpawn)
        {
            portal.transform.position = chunkCoord;
            portal.SetActive(true);
        }
        //vxe.isChunkASurface (normalDir, chunkCenter, threshold);
    }
コード例 #16
0
 public void startGame()
 {
     direction = DIR.RIGHT;
     createSnake();
     createBerry();
     score = 0;
 }
コード例 #17
0
ファイル: Program.cs プロジェクト: ParkSeJun/ACMICPC
        static int Solve(int[][] arr, DIR dir = DIR.NONE, int moveCount = 0)
        {
            if (dir != DIR.NONE)
            {
                var newArr = Move(arr, dir);
                if (SameArr(arr, newArr))
                {
                    return(GetMax(newArr));
                }
                arr = newArr;
            }

            if (moveCount == 5)
            {
                return(GetMax(arr));
            }


            int up    = Solve(arr, DIR.UP, moveCount + 1);
            int left  = Solve(arr, DIR.LEFT, moveCount + 1);
            int down  = Solve(arr, DIR.DOWN, moveCount + 1);
            int right = Solve(arr, DIR.RIGHT, moveCount + 1);

            return(Math.Max(up, Math.Max(left, Math.Max(down, right))));
        }
コード例 #18
0
    private IEnumerator MoveCoroutine()
    {
        moveDir = DIR.Right;

        while (true)
        {
            switch (moveDir)
            {
            case DIR.Right:
            {
                float newX = transform.position.x + Time.deltaTime * moveSpeed;
                if (newX >= originalPos.x + moveX)
                {
                    newX    = originalPos.x + moveX;
                    moveDir = DIR.Down;
                }
                transform.position = new Vector3(newX, transform.position.y);
            }
            break;

            case DIR.Down:
            {
                float newY = transform.position.y - Time.deltaTime * moveSpeed;
                if (newY <= originalPos.y - moveY)
                {
                    newY    = originalPos.y - moveY;
                    moveDir = DIR.Left;
                }
                transform.position = new Vector3(transform.position.x, newY);
            }
            break;

            case DIR.Left:
            {
                float newX = transform.position.x - Time.deltaTime * moveSpeed;
                if (newX <= originalPos.x - moveX)
                {
                    newX    = originalPos.x - moveX;
                    moveDir = DIR.Up;
                }
                transform.position = new Vector3(newX, transform.position.y);
            }
            break;

            case DIR.Up:
            {
                float newY = transform.position.y + Time.deltaTime * moveSpeed;
                if (newY >= originalPos.y + moveY)
                {
                    newY    = originalPos.y + moveY;
                    moveDir = DIR.Right;
                }
                transform.position = new Vector3(transform.position.x, newY);
            }
            break;
            }
            yield return(null);
        }
    }
コード例 #19
0
        /// <summary>
        /// Creates a file stream at the given path. If directory does not exist, creates it.
        /// </summary>
        /// <param name="dir"></param>
        /// <param name="subDir"></param>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static FileStream Create(DIR dir, SUB_DIR subDir, string fileName)
        {
            string filePath = Combine(dir, subDir, fileName);

            Directory.CreateDirectory(Path.GetDirectoryName(filePath));

            return(File.Create(filePath));
        }
コード例 #20
0
    // TODO 換頁動畫
    private void pageEffect(DIR dir, int curren, int target)
    {
        UIMgr.Instance.setHomeBtnVisible(false);

        pageList [curren].SetActive(false);
        pageList [target].SetActive(true);
        pageList [target].GetComponent <pageBase> ().onPageEnable();
    }
コード例 #21
0
ファイル: Mage_Base.cs プロジェクト: tartuke/LivingDungeon
 // Start is called before the first frame update
 void Start()
 {
     heldItem      = Instantiate(heldItem);
     curDirection  = DIR.IDLE;
     player        = GameObject.Find("Player").transform;
     statControler = GetComponent <StatControler>();
     rb            = GetComponent <Rigidbody2D>();
 }
コード例 #22
0
    //蛇移动
    void Move()
    {
        //蛇身移动
        for (var Temp = Snake.Last; Temp != Snake.First; Temp = Temp.Previous)
        {
            var pre = Temp.Previous;
            Temp.Value = pre.Value;
            pre        = pre.Previous;
        }

        if (rightabout(MoveBack))
        {
            switch (MoveBack)
            {
            case DIR.UP:
                OffsetX = 0;
                OffsetZ = 1;
                break;

            case DIR.DOWN:
                OffsetX = 0;
                OffsetZ = -1;
                break;

            case DIR.LEFT:
                OffsetX = -1;
                OffsetZ = 0;
                break;

            case DIR.RIGHT:
                OffsetX = 1;
                OffsetZ = 0;
                break;
            }
            MoveFront = MoveBack;
        }

        //蛇头移动
        Vector3 headpos = new Vector3(Snake.First.Value.x + OffsetX, 0, Snake.First.Value.z + OffsetZ);

        if (headpos.x > a)
        {
            headpos.x = -a;
        }
        else if (headpos.x < -a)
        {
            headpos.x = a;
        }
        else if (headpos.z > a)
        {
            headpos.z = -a;
        }
        else if (headpos.z < -a)
        {
            headpos.z = a;
        }
        Snake.First.Value = headpos;
    }
コード例 #23
0
ファイル: InstructionSSE2.cs プロジェクト: kohoutech/Dynamo
 public SSE2ConvertPrecision(Operand _op1, Operand _op2, DIR _dir, bool _packed)
     : base()
 {
     opcount   = 2;
     op1       = _op1;
     op2       = _op2;
     direction = _dir;
     packed    = _packed;
 }
コード例 #24
0
ファイル: InstructionSSE2.cs プロジェクト: kohoutech/Dynamo
 public SSE2ConvertSingle(Operand _op1, Operand _op2, DIR _dir, bool _trunc)
     : base()
 {
     opcount   = 2;
     op1       = _op1;
     op2       = _op2;
     direction = _dir;
     truncate  = _trunc;
 }
コード例 #25
0
ファイル: Movable.cs プロジェクト: DanielParra159/GGJ2016
 public void onEnter(DIR dir, Vector3 forceDir, Hero hero)
 {
     if (!this.enabled) return;
     this.forceDir = forceDir;
     hero.blockHero(heroTimeBlocked);
     moving = true;
     rigidbody.velocity = forceDir * pushForce;
     destinationPosition = transform.position + forceDir * moveDistance;
 }
コード例 #26
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.I)
            {
                if (btnplay.Text[0] == 'I' || btnplay.Text[0] == 'C')
                {
                    btnplay.Text = "Pausar (i)";
                    t.Start();
                }
                else
                {
                    btnplay.Text = "Continuar (i)";
                    t.Stop();
                }
            }
            // Jugador LILA
            else if (keyData == Keys.R)
            {
                Close();
            }
            else if (keyData == Keys.Up && d2 != DIR.ABAIX)
            {
                d2 = DIR.ADALT;
            }
            else if (keyData == Keys.Down && d2 != DIR.ADALT)
            {
                d2 = DIR.ABAIX;
            }
            else if (keyData == Keys.Left && d2 != DIR.DRETA)
            {
                d2 = DIR.ESQUERRA;
            }
            else if (keyData == Keys.Right && d2 != DIR.ESQUERRA)
            {
                d2 = DIR.DRETA;
            }

            // Jugador GROC
            else if (keyData == Keys.W && d1 != DIR.ABAIX)
            {
                d1 = DIR.ADALT;
            }
            else if (keyData == Keys.S && d1 != DIR.ADALT)
            {
                d1 = DIR.ABAIX;
            }
            else if (keyData == Keys.A && d1 != DIR.DRETA)
            {
                d1 = DIR.ESQUERRA;
            }
            else if (keyData == Keys.D && d1 != DIR.ESQUERRA)
            {
                d1 = DIR.DRETA;
            }

            return(base.ProcessCmdKey(ref msg, keyData));
        }
コード例 #27
0
ファイル: Tim.cs プロジェクト: Tukeque/TimWorld
 public Tim(int X, int Y, int Z, DIR Dir, SUBDIR Subdir, NN Nn, float Hp, float Mp, Items.Item Left, Items.Item Right)
 {
     x   = X; y = Y; z = Z;
     dir = Dir; subdir = Subdir;
     nn  = Nn;
     hp  = Hp; mp = Mp;
     reproductiveUrge = 64.0f; reproductiveCounter = 0.0f;
     left             = Left; right = Right;
     fall             = 0; falling = false;
 }
コード例 #28
0
ファイル: Day12.cs プロジェクト: antoinecoulombe/projects
            private DIR GetInverseDirection(DIR d)
            {
                int move = (int)d + 2;

                if (move > 4)
                {
                    move %= 4;
                }
                return((DIR)move);
            }
コード例 #29
0
ファイル: InstructionMMX.cs プロジェクト: kohoutech/Dynamo
 public MMXShift(Operand _op1, Operand _op2, SIZE _size, DIR _dir, bool _arith)
     : base()
 {
     opcount    = 2;
     op1        = _op1;
     op2        = _op2;
     size       = _size;
     direction  = _dir;
     arithmetic = _arith;
 }
コード例 #30
0
ファイル: MapGrid.cs プロジェクト: 741645596/batgame
    public static MapGrid Getbrothers(Int2 p, DIR dir)
    {
        Int2 pos = Int2.zero;

        if (MapSize.Getbrothers(p, dir, ref pos) == false)
        {
            return(null);
        }
        return(GetMG(pos));
    }
コード例 #31
0
        public override void ActionCollision(MyObject Obj)
        {
            DIR dir = DirectionCollision(Obj);

            switch (Obj.ID)
            {
            case MyID.MARIO_SMALL:
                if (Obj.STATUS == MyStatus.ACTIVE || Obj.STATUS == MyStatus.DOWN || Obj.STATUS == MyStatus.UP || Obj.STATUS == MyStatus.INVI || Obj.STATUS == MyStatus.CHANGE || Obj.STATUS == MyStatus.SHOT)
                {
                    if (STATUS == MyStatus.ACTIVE && dir == DIR.BOTTOM)
                    {
                        STATUS = MyStatus.RUN;
                        ACCEL  = new Vector3(0, 0.001f, 0);
                        VELOC  = new Vector3(0, -0.17f, 0);
                    }
                }
                break;

            case MyID.MARIO_BIG:
            case MyID.MARIO_SUPER:
                if (Obj.STATUS == MyStatus.ACTIVE)
                {
                    if (STATUS == MyStatus.ACTIVE && dir == DIR.BOTTOM)
                    {
                        STATUS = MyStatus.BEFORE_DEATH3;
                        for (int i = 0; i < 4; i++)
                        {
                            ListBreak.Add(new Break(game, (int)POSITION.X + 25 * (i % 2), (int)POSITION.Y + 25 * (i / 2), 25, 25, 4));
                        }
                        for (int i = 0; i < ListBreak.Count; i++)
                        {
                            if (i == 0)
                            {
                                ListBreak[i].VELOC = new Vector3(-0.5f, -0.6f, 0);
                            }
                            else if (i == 2)
                            {
                                ListBreak[i].VELOC = new Vector3(-0.7f, -0.8f, 0);
                            }
                            else if (i == 1)
                            {
                                ListBreak[i].VELOC = new Vector3(0.5f, -0.6f, 0);
                            }
                            else
                            {
                                ListBreak[i].VELOC = new Vector3(0.7f, -0.8f, 0);
                            }
                        }
                        //ACCEL = new Vector3(0, 0.001f, 0);
                        VELOC = new Vector3(0, -1.0f, 0);
                    }
                }
                break;
            }
        }
コード例 #32
0
ファイル: Cubemapper.cs プロジェクト: fengqk/Art
	IEnumerator ScreenCapture()
	{
		Transform cam = camera.transform;
		
		while(isTakingScreenshots)
		{
			// Loop through each node
			for(int a=0; a<nodes.Length; a++)
			{
				// Make sure this Node is set to allow generation of either cubemaps or PNGs
				// Ignore the Allow parameter if we have no cubemap assigned yet at all
				if(nodes[a].allowCubemapGeneration || nodes[a].allowGeneratePNG || (!nodes[a].allowCubemapGeneration && nodes[a].cubemap == null) )
				{					
					// Set Camera
					cam.position = nodes[a].transform.position;				
					cam.rotation = Quaternion.identity;
					
					// Set resolution because Node may override
					SetNodeResolution(nodes[a]);
					
					// Make cubemap
					Cubemap cubemap = new Cubemap(nodeResolution, textureFormat, useMipMaps);
                    cubemap.mipMapBias = mipMapBias;

					// Loop through all Directions to take screenshots for this node
					for(int b=0; b<6; b++)
					{
						//Debug.Log("Processing Node " + nodes[a].name + " in Direction " + currentDir);
						
						switch(currentDir)
						{
							case DIR.Right:
								cam.rotation = Quaternion.Euler(0, 90, 0);						
								yield return StartCoroutine(MakeSnapshot(cubemap, CubemapFace.PositiveX, nodes[a]));
								currentDir = DIR.Left;
								break;
							
							case DIR.Left:
								cam.rotation = Quaternion.Euler(0, -90, 0);
								yield return StartCoroutine(MakeSnapshot(cubemap, CubemapFace.NegativeX, nodes[a]));
								currentDir = DIR.Top;
								break;
							
							case DIR.Top:
								cam.rotation = Quaternion.Euler(-90, 0, 0);
								yield return StartCoroutine(MakeSnapshot(cubemap, CubemapFace.PositiveY, nodes[a]));
								currentDir = DIR.Bottom;
								break;
							
							case DIR.Bottom:
								cam.rotation = Quaternion.Euler(90, 0, 0);
								yield return StartCoroutine(MakeSnapshot(cubemap, CubemapFace.NegativeY, nodes[a]));
								currentDir = DIR.Front;
								break;
							
							case DIR.Front:
								cam.rotation = Quaternion.Euler(0, 0, 0);
								yield return StartCoroutine(MakeSnapshot(cubemap, CubemapFace.PositiveZ, nodes[a]));
								currentDir = DIR.Back;
								break;
							
							case DIR.Back:
								cam.rotation = Quaternion.Euler(0, 180, 0);
								yield return StartCoroutine(MakeSnapshot(cubemap, CubemapFace.NegativeZ, nodes[a]));
								currentDir = DIR.Right; // back to the beginning (or else it gets stuck)
								break;
						}
                    }

#if !UNITY_2_6 && !UNITY_2_6_1 && !UNITY_3_0 && !UNITY_3_0_0 && !UNITY_3_1 && !UNITY_3_2 && !UNITY_3_3 && !UNITY_3_4 && !UNITY_3_5
                    // Smooth Edges on Unity 4+
                    if (smoothEdges)
                    {
                        cubemap.SmoothEdges(smoothEdgesWidth);
                        cubemap.Apply();
                    }
#endif											
			
					// Create Cubemap, but only if we are allowed to (unless there is no cubemap on the node yet)
                    if (nodes[a].allowCubemapGeneration || (!nodes[a].allowCubemapGeneration && nodes[a].cubemap == null))
                    {
                        string finalCubemapPath = pathCubemaps + "/" + sceneName + "_" + nodes[a].name + ".cubemap";
                        if (finalCubemapPath.Contains("//"))
                            finalCubemapPath = finalCubemapPath.Replace("//", "/");

                        AssetDatabase.CreateAsset(cubemap, finalCubemapPath);
                    }

                    // Set Linear Space if wanted
                    SerializedObject serializedCubemap = new SerializedObject(cubemap);
                    SetLinearSpace(ref serializedCubemap, useLinearSpace);
	
					// Free up memory to prevent memory leak
					Resources.UnloadUnusedAssets();
				}
			}
				
			AssetDatabase.Refresh();
			
			isTakingScreenshots = false;
			completedTakingScreenshots = true;
		}
		
		Debug.Log("CUBEMAPS GENERATED!");
	}
コード例 #33
0
ファイル: KeyPadControl.cs プロジェクト: spiritpig/3DGame
 /// <summary>
 /// Sets the sprite by axis.
 /// </summary>
 void SetSpriteAndDirByAxis()
 {
     // 初始状态
     if( m_CurAxis == Vector2.zero )
     {
         m_Image.sprite = m_Normal;
         m_CurDir = DIR.D_NONE;
     }
     // 上下
     else
     if(m_CurAxis.x <= 0.25f && m_CurAxis.x >= -0.25f)
     {
         if( m_CurAxis.y > 0)
         {
             m_Image.sprite = m_Up;
             m_CurDir = DIR.D_UP;
         }
         else
         {
             m_Image.sprite = m_Down;
             m_CurDir = DIR.D_DOWN;
         }
     }
     // 左右
     else
     if(m_CurAxis.y <= 0.25 && m_CurAxis.y >= -0.25f)
     {
         if( m_CurAxis.x > 0 )
         {
             m_Image.sprite = m_Right;
             m_CurDir = DIR.D_RIGHT;
         }
         else
         {
             m_Image.sprite = m_Left;
             m_CurDir = DIR.D_LEFT;
         }
     }
     // 上左右
     else
     if(m_CurAxis.y > 0.25f && m_CurAxis.y <= 0.5f)
     {
         if(m_CurAxis.x>= -0.5f && m_CurAxis.x < -0.25f)
         {
             m_Image.sprite = m_LeftUp;
             m_CurDir = DIR.D_LEFTUP;
         }
         // 上下左右的情况已经被判断完了,此处无需再判断
         else
         {
             m_Image.sprite = m_RightUp;
             m_CurDir = DIR.D_RIGHTUP;
         }
     }
     else
     {
         if(m_CurAxis.x>= -0.5f && m_CurAxis.x < -0.25f)
         {
             m_Image.sprite = m_LeftDown;
             m_CurDir = DIR.D_LEFTDOWN;
         }
         // 上下左右的情况已经被判断完了,此处无需再判断
         else
         {
             m_Image.sprite = m_RightDown;
             m_CurDir = DIR.D_RIGHTDOWN;
         }
     }
 }
コード例 #34
0
ファイル: KeyPadControl.cs プロジェクト: spiritpig/3DGame
 public void OnPointerExit(PointerEventData eventData)
 {
     m_Image.sprite = m_Normal;
     m_IsTouch = false;
     m_CurDir = DIR.D_NONE;
 }
コード例 #35
0
ファイル: Movable.cs プロジェクト: DanielParra159/GGJ2016
 public void onExit(DIR dir)
 {
     
 }