示例#1
0
 public static string GetStrPXZ(this Pathea.PeTrans trans)
 {
     s_strBuff.Length = 0;
     s_strBuff.Append('P');
     s_strBuff.Append(':');
     s_strBuff.Append((int)trans.position.x);
     s_strBuff.Append(',');
     s_strBuff.Append((int)trans.position.z);
     return(s_strBuff.ToString());
 }
示例#2
0
        const int radius = 2;   //若点不是合法的站立点,将在一定区域内搜索合法站立点,这是此区域的半径
        private Vector3 LocalToWorld(Pathea.PeTrans trans, Vector3 local, EFunc func)
        {
            Vector3 world = Vector3.Cross(Vector3.up, trans.forward) * pos.x + Vector3.up * pos.y + trans.forward * pos.z;

            if (func == EFunc.Plus)
            {
                world = PETools.PEUtil.GetRandomPositionOnGround(trans.position + world, 0, radius);
            }
            else if (func == EFunc.Minus)
            {
                world = PETools.PEUtil.GetRandomPositionOnGround(trans.position - world, 0, radius);
            }
            else if (func == EFunc.SetTo)
            {
                world = local;
            }
            return(world);
        }
        protected override bool Exec()
        {
            VarRef playerId = PeType.GetPlayerId(mInfo, mTrigger);
            VarRef varRef   = PatheaScript.Util.GetVarRefOrValue(mInfo, "pos", VarValue.EType.Vector3, mTrigger);

            //TODO:need parse func

            List <Pathea.PeEntity> playerList = PeType.GetPlayer((int)playerId.Value);

            foreach (Pathea.PeEntity player in playerList)
            {
                Pathea.PeTrans v = player.GetCmpt <Pathea.PeTrans>();

                v.position = (Vector3)varRef.Value;
            }

            return(true);
        }
示例#4
0
        bool GetPlayerPos(out Vector3 pos)
        {
            if (mTrans == null)
            {
                Pathea.PeEntity entity = Pathea.PeCreature.Instance.mainPlayer;
                if (null != entity)
                {
                    mTrans = entity.GetCmpt <Pathea.PeTrans>();
                }
            }

            if (null == mTrans)
            {
                pos = Vector3.zero;
                return(false);
            }

            pos = mTrans.position;
            return(true);
        }