コード例 #1
0
        public Camera(BinaryReader br)
        {
            long end = br.BaseStream.Position + (TotalSize = br.ReadUInt32());

            Name           = br.ReadCString(Constants.SizeName);
            Pivot          = new CVector3(br);
            FieldOfView    = br.ReadSingle();
            FarClip        = br.ReadSingle();
            NearClip       = br.ReadSingle();
            TargetPosition = new CVector3(br);

            while (br.BaseStream.Position < end && !br.AtEnd())
            {
                string tagname = br.ReadString(4);
                switch (tagname)
                {
                case "KCTR": TranslationKeys = new Track <CVector3>(br); break;

                case "KCRL": RotationKeys = new Track <float>(br); break;

                case "KTTR": TargetTranslationKeys = new Track <CVector3>(br); break;

                default:
                    br.BaseStream.Position -= 4;
                    return;
                }
            }
        }
コード例 #2
0
    public override bool OnSelectPos(CVector3 pos)
    {
        Beast beast = Singleton <BeastManager> .singleton.GetBeastById(Singleton <BeastRole> .singleton.Id);

        if (beast.UsedAttackToBaseBuildingCount >= 1)
        {
            //弹出攻击过的提示消息
            DlgBase <DlgFlyText, DlgFlyTextBehaviour> .singleton.AddSystemInfo(StringConfigMgr.GetString("DlgMain.AttactOncePreRound"));

            return(false);
        }
        else
        {
            if (this.m_listValidTargetPos.Exists((CVector3 p) => p.Equals(pos)))
            {
                Beast beastByPos = Singleton <BeastManager> .singleton.GetBeastByPos(pos);

                if (beastByPos != null)
                {
                    this.m_unTargetBeastId = beastByPos.Id;
                }
                else
                {
                    this.m_unTargetBeastId = 0;
                }
                this.m_vec3TargetPos = pos;
                this.OnButtonOkClick();
            }
            return(true);
        }
    }
コード例 #3
0
    public void GetAdjacentNodes(CVector3 oSrc, ref List <CVector3> oFindedNodes)
    {
        if (!this.m_oTablePathNodes.ContainsKey(oSrc.m_nX) || !this.m_oTablePathNodes[oSrc.m_nX].ContainsKey(oSrc.m_nY))
        {
            this.logger.Fatal(string.Format("GetAdjacentNodes:oSrc({0}) is not exist:", oSrc.ToString()));
            return;
        }
        PathNode mapNode = this.m_oTablePathNodes[oSrc.m_nX][oSrc.m_nY];

        for (int i = 0; i < 6; i++)
        {
            PathNode nearNode = mapNode.m_listNextNode[i];
            if (nearNode != null && nearNode.m_bCanWalk)
            {
                CVector3 cVector = new CVector3();
                cVector.m_nX = nearNode.nIndexX;
                cVector.m_nY = nearNode.nIndexY;
                cVector.m_nU = nearNode.nIndexU;
                if (!oFindedNodes.Contains(cVector))
                {
                    oFindedNodes.Add(cVector);
                }
            }
        }
    }
コード例 #4
0
 /// <summary>
 /// 神兽设置到该格子坐标上
 /// </summary>
 /// <param name="unBeastId"></param>
 /// <param name="oPos"></param>
 /// <returns></returns>
 public bool RoleSetToInitialPos(long unBeastId, CVector3 oPos)
 {
     if (!this.m_oMapData.HasMapNode(oPos.m_nX, oPos.m_nY))
     {
         this.logger.Error(string.Format("HasMapNode(oPos) == false:{0}", oPos.ToString()));
     }
     if (this.m_oMapData.GetMapNode(oPos.m_nX, oPos.m_nY) == null)
     {
         return(false);
     }
     //判断这个格子上是否已经有神兽了
     if (this.IsPosStandByAnyRole(oPos))
     {
         this.logger.Error(string.Format("IsPosStandByAnyRole(oPos):{0}", oPos.ToString()));
         return(false);
     }
     //如果神兽格子上不存在改神兽,就吧该神兽加到该字典
     if (!this.m_oDicRolesPos.ContainsKey(unBeastId))
     {
         this.m_oDicRolesPos.Add(unBeastId, new CVector3(oPos));
         this.m_oTablePathNodes[oPos.m_nX][oPos.m_nY].m_bCanWalk = false;
         this.m_oTablePathNodes[oPos.m_nX][oPos.m_nY].m_BeastID  = unBeastId;
         return(true);
     }
     this.logger.Error(string.Format("m_oDicRolesPos.ContainsnIndexX(unHeroId) == false:{0}", unBeastId));
     return(false);
 }
コード例 #5
0
 public static CVector3 subtract(CVector3 vector, CVector3 vector2)
 {
     vector.x = vector.x - vector2.x;
     vector.y = vector.y - vector2.y;
     vector.z = vector.z - vector2.z;
     return(vector);
 }
コード例 #6
0
ファイル: MainStage.cs プロジェクト: githuanl/NewBeastGame
    /// <summary>
    /// 取得攻击者和被攻击者之间的距离
    /// </summary>
    /// <param name="beAttackerId"></param>
    /// <returns></returns>
    private uint GetDistanceByTargetBeastId(long beAttackerId)
    {
        Beast attacker = Singleton <BeastManager> .singleton.GetBeastById(this.AttackerId);

        Beast beAttacker = Singleton <BeastManager> .singleton.GetBeastById(beAttackerId);

        if (attacker != null && beAttacker != null)
        {
            int nRow = 0;
            int nCol = 0;
            Hexagon.GetHexIndexByPos(attacker.MovingPos, out nRow, out nCol);
            CVector3 pos = new CVector3();
            pos.nRow = nRow;
            pos.nCol = nCol;
            Hexagon.GetHexIndexByPos(beAttacker.MovingPos, out nRow, out nCol);
            CVector3 pos2 = new CVector3();
            pos2.nRow = nRow;
            pos2.nCol = nCol;
            return(Singleton <ClientMain> .singleton.scene.CalDistance(pos, pos2));
        }
        else
        {
            return(0u);
        }
    }
コード例 #7
0
 public static CVector3 multiply(CVector3 vector, double multiplier)
 {
     vector.x = vector.x * multiplier;
     vector.y = vector.y * multiplier;
     vector.z = vector.z * multiplier;
     return(vector);
 }
コード例 #8
0
 public static CVector3 add(CVector3 vector, CVector3 vector2)
 {
     vector.x = vector.x + vector2.x;
     vector.y = vector.y + vector2.y;
     vector.z = vector.z + vector2.z;
     return(vector);
 }
コード例 #9
0
ファイル: GEOA.cs プロジェクト: The-Alpha-Project/MDX-Parser
        public GeosetAnimation(BinaryReader br)
        {
            TotalSize = br.ReadInt32();
            long end = br.BaseStream.Position + TotalSize;

            GeosetId = br.ReadInt32();
            Alpha    = br.ReadSingle();
            Color    = new CVector3(br);

            HasColorKeys = br.ReadInt32() == 1;

            Color.Reverse();

            while (br.BaseStream.Position < end && !br.AtEnd())
            {
                string tagname = br.ReadString(4);
                switch (tagname)
                {
                case "KGAO": AlphaKeys = new Track <float>(br); break;

                case "KGAC": ColorKeys = new Track <CVector3>(br, true); break;

                default:
                    br.BaseStream.Position -= 4;
                    return;
                }
            }
        }
コード例 #10
0
    /// <summary>
    /// 初始化神兽出生坐标,设置到这个格子坐标上然后初始化正方向
    /// </summary>
    /// <param name="unBeastId"></param>
    /// <param name="vec3Hex"></param>
    public void InitBeastPos(long unBeastId, CVector3 vec3Hex)
    {
        Beast beast = this.GetBeastById(unBeastId);

        if (beast != null)
        {
            beast.Move(vec3Hex);
            beast.SetVisible(true);
            Singleton <ClientMain> .singleton.scene.RoleSetToInitialPos(beast.Id, vec3Hex);

            ECampType eCampType = ECampType.CAMP_EMPIRE;
            if (eCampType == beast.eCampType)
            {
                eCampType = ECampType.CAMP_LEAGUE;
            }
            //取得和该神兽对立阵营的基地坐标
            CVector3 baseHexPos = Singleton <ClientMain> .singleton.scene.GetBasePos(eCampType);

            Vector3 baseHex3DPos = Hexagon.GetHex3DPos(baseHexPos, Space.World);
            Vector3 hex3DPos     = Hexagon.GetHex3DPos(vec3Hex, Space.World);
            Vector3 vector       = baseHex3DPos - hex3DPos;
            //然后得到神兽的正方向
            beast.Forward = new Vector2(vector.x, vector.z);
            //SkillManager.NotifyHeroPosChange(unHeroId);
        }
    }
コード例 #11
0
        /// <summary>
        /// 选择地图格子点
        /// </summary>
        /// <param name="vecHexPos"></param>
        /// <returns></returns>
        public bool OnSelectPos(CVector3 vecHexPos)
        {
            bool result;

            if (this.m_dicOpState[this.m_eOpStateCurrent].OnSelectPos(vecHexPos))
            {
                this.m_oPos.nCol = vecHexPos.nCol;
                this.m_oPos.nRow = vecHexPos.nRow;
                result           = true;
            }
            else
            {
                Beast beast = Singleton <BeastManager> .singleton.GetBeastByPos(vecHexPos);

                if (beast != null && !beast.IsError)
                {
                    if (this.m_dicOpState[this.m_eOpStateCurrent].OnClickBeast(beast.Id))
                    {
                        result = true;
                    }
                }
                result = false;
            }
            return(result);
        }
コード例 #12
0
    public bool GetNearNodes(int nMaxDistance, CVector3 oSrc, ref List <CVector3> oFindedNodes, bool bIgnore)
    {
        if (nMaxDistance < 0)
        {
            nMaxDistance = 2147483647;
        }
        if (nMaxDistance == 0)
        {
            return(false);
        }
        if (!this.m_oMapData.HasMapNode(oSrc.m_nX, oSrc.m_nY))
        {
            return(false);
        }
        foreach (var current in this.m_oTablePathNodes)
        {
            foreach (var current2 in current.Value)
            {
                current2.Value.distance = 1000;
            }
        }
        this.m_oTablePathNodes[oSrc.m_nX][oSrc.m_nY].distance = 0;
        oFindedNodes.Clear();
        PathNode         srcMapNode = this.m_oTablePathNodes[oSrc.m_nX][oSrc.m_nY];
        Queue <PathNode> queue      = new Queue <PathNode>();

        queue.Enqueue(srcMapNode);
        while (queue.Count != 0)
        {
            PathNode node = queue.Dequeue();
            for (int i = 0; i < 6; i++)
            {
                PathNode nearNode = node.m_listNextNode[i];
                if (nearNode != null)
                {
                    CVector3 cVector = new CVector3();
                    cVector.m_nX = nearNode.nIndexX;
                    cVector.m_nY = nearNode.nIndexY;
                    cVector.m_nU = nearNode.nIndexU;
                    if ((nearNode.m_bCanWalk || (bIgnore && this.IsPosStandByAnyRole(cVector)) || (nearNode.m_bCanWalk && CanOverlapTrap(cVector))) && oSrc != cVector)
                    {
                        int distance = node.distance + 1;
                        if (distance <= nMaxDistance && distance < nearNode.distance)
                        {
                            if (!this.CanOverlapTrap(cVector))
                            {
                                nearNode.distance = distance;
                                queue.Enqueue(nearNode);
                            }
                            if (!oFindedNodes.Contains(cVector))
                            {
                                oFindedNodes.Add(cVector);
                            }
                        }
                    }
                }
            }
        }
        return(true);
    }
コード例 #13
0
    public bool CancelAEnergyTrap(CVector3 oPos)
    {
        PathNode expr = this.m_oTablePathNodes[oPos.m_nX][oPos.m_nY];

        expr.sum -= 1;
        return(true);
    }
コード例 #14
0
 private void Update()
 {
     if (this.m_fIdle01Moment > 0f && Time.time > this.m_fIdle01Moment)
     {
         this.PlayAnim("Idle2");
     }
     //如果没有在移动的话
     if (!this.m_bMoving)
     {
         if (this.PopTargetPosition(ref this.m_posNext))
         {
             this.m_bMoving = true;
             this.PlayAnim("Run");
         }
     }
     if (this.m_bMoving)
     {
         this.m_vec3DistanceDelta   = this.m_posNext - this.m_cachedTransform.position;
         this.m_vec3DistanceDelta.y = 0f;
         while (this.m_vec3DistanceDelta.magnitude < 0.01f)
         {
             this.SetPos(this.m_posNext);
             if (!this.PopTargetPosition(ref this.m_posNext))
             {
                 this.m_bMoving = false;
                 this.StopAnim("Run");//转成idle
                 int nRow = 0;
                 int nCol = 0;
                 Hexagon.GetHexIndexByPos(this.Beast.MovingPos, out nRow, out nCol);
                 CVector3 cVector = new CVector3();
                 cVector.nRow = nRow;
                 cVector.nCol = nCol;
                 this.m_vec3HexActionPos.CopyFrom(cVector);
                 break;
             }
             Vector3 delta = this.m_posNext - this.m_cachedTransform.position;
             this.Forward             = new Vector2(delta.x, delta.z);
             this.m_vec3DistanceDelta = this.m_posNext - this.m_cachedTransform.position;
         }
         if (this.m_bMoving)
         {
             Vector3 b = this.m_vec3DistanceDelta.normalized * this.m_fMoveSpeed * Time.deltaTime;
             if (b.magnitude >= this.m_vec3DistanceDelta.magnitude)
             {
                 b = this.m_vec3DistanceDelta;
             }
             this.SetPos(this.m_cachedTransform.position + b);
         }
     }
     if (this.m_bAffect || this.IsMouseIn)
     {
         //就高亮显示
         this.Highlight(true);
     }
     else
     {
         this.Highlight(false);
     }
 }
コード例 #15
0
 public void CFixedUpdate()
 {
     if (active)
     {
         float opt = 0;
         transform.position = CVector3.toV3(position, Masses.scale, TrailPool.cameraScale, TrailPool.cameraX, TrailPool.cameraY, opt, out opt);
     }
 }
コード例 #16
0
 /// <summary>
 /// 计算两个node的最小距离
 /// </summary>
 /// <param name="oSrcPos"></param>
 /// <param name="oDstPos"></param>
 /// <returns></returns>
 public uint CalDistance(CVector3 oSrcPos, CVector3 oDstPos)
 {
     if (this.m_map == null)
     {
         return(0u);
     }
     return(this.m_map.CalDistance(oSrcPos, oDstPos));
 }
コード例 #17
0
 /// <summary>
 /// 根据坐标取得node类型
 /// </summary>
 /// <param name="oPos"></param>
 /// <returns></returns>
 public EMapNodeType GetMapNodeType(CVector3 oPos)
 {
     if (this.m_map == null)
     {
         return(EMapNodeType.MAP_NODE_INVALID);
     }
     return(this.m_map.GetMapNodeType(oPos));
 }
コード例 #18
0
 /// <summary>
 /// 获得目标bode相邻的所有node
 /// </summary>
 /// <param name="oSrc"></param>
 /// <param name="oFindedNodes"></param>
 public void GetAdjacentNodes(CVector3 oSrc, ref List <CVector3> oFindedNodes)
 {
     if (this.m_map == null)
     {
         return;
     }
     this.m_map.GetAdjacentNodes(oSrc, ref oFindedNodes);
 }
コード例 #19
0
 public bool GetNearNodesInLine(int a, int nMaxDistance, CVector3 oSrc, ref List <CVector3> oFindedNodes, bool bReturnObstruct, bool bIgnore)
 {
     if (bReturnObstruct)
     {
         return(this.GetNearNodesReturnObstruct(a, nMaxDistance, oSrc, ref oFindedNodes, 4294967295u, bIgnore));
     }
     return(this.GetNearNodesReturnObstruct(a, nMaxDistance, oSrc, ref oFindedNodes, 2u, bIgnore));
 }
コード例 #20
0
ファイル: GEOS.cs プロジェクト: The-Alpha-Project/MDX-Parser
 public MDLVERTEX(BinaryReader br)
 {
     Position    = new CVector3(br);
     BoneWeights = br.ReadBytes(4);
     BoneIndices = br.ReadBytes(4);
     Normal      = new CVector3(br);
     TexCoords   = Enumerable.Range(0, 2).Select(x => new CVector2(br)).ToArray();
 }
コード例 #21
0
ファイル: Scene.cs プロジェクト: bianchengxiaobei/BeastGame
 public CMapData()
 {
     this.m_MapID              = 0u;
     this.m_dicMapData         = new Dictionary <int, Dictionary <int, MapNode> >();
     this.m_dicMapNodeTypeInfo = new Dictionary <EMapNodeType, MapNodeTypeInfo>();
     this.m_mapCfg             = new MapCfg();
     this.empireMapNode        = new CVector3();
     this.leagueMapNode        = new CVector3();
 }
コード例 #22
0
        /// <summary>
        /// 发送移动请求
        /// </summary>
        /// <returns></returns>
        public override bool OnButtonOkClick()
        {
            CVector3 pos = new CVector3(this.m_vecTargetPos);

            Singleton <NetworkManager> .singleton.SendBeastMoveReq(pos);

            this.OnLeave();
            return(true);
        }
コード例 #23
0
    /// <summary>
    /// 发送神兽请求移动到某个位置
    /// </summary>
    /// <param name="vecTargetPos"></param>
    public void SendBeastMoveReq(CVector3 vecTargetPos)
    {
        CPtcC2MReq_Move msg = new CPtcC2MReq_Move();

        msg.beastId = Singleton <BeastRole> .singleton.Id;
        msg.desPos  = vecTargetPos;
        this.SendMsg(msg);
        this.m_log.Debug("SendMoveReq:" + vecTargetPos.ToString());
    }
コード例 #24
0
    /// <summary>
    /// 发送选择神兽出生点的请求消息
    /// </summary>
    /// <param name="vec3HexPos">选择的出生点格子坐标</param>
    public void SendInitPos(CVector3 vec3HexPos)
    {
        CPtcCReq_AddRoleToScene sendInstance = CPtcCReq_AddRoleToScene.GetSendInstance();

        sendInstance.m_unRoleId = Singleton <BeastRole> .singleton.Id;
        sendInstance.m_oInitPos = vec3HexPos;
        this.SendMsg(sendInstance);
        this.m_log.Debug(string.Format("SendInitPos: unBeastId={0}", sendInstance.m_unRoleId));
    }
コード例 #25
0
    /// <summary>
    /// 神兽跳跃动作表现
    /// </summary>
    /// <param name="unBeastId"></param>
    /// <param name="vec3DestPos"></param>
    /// <param name="delayTime"></param>
    /// <param name="time"></param>
    /// <param name="height"></param>
    /// <param name="AttackerId"></param>
    /// <param name="effectid"></param>
    /// <param name="animName"></param>
    /// <param name="strDuraAnim"></param>
    /// <param name="bForward"></param>
    public void JumpBeastAction(long unBeastId, CVector3 vec3DestPos, float delayTime, float time, float height, long AttackerId, int effectid, string animName, string strDuraAnim, bool bForward)
    {
        Beast beast = Singleton <BeastManager> .singleton.GetBeastById(unBeastId);

        if (beast != null)
        {
            beast.JumpAction(vec3DestPos, delayTime, time, height, AttackerId, effectid, animName, strDuraAnim, bForward);
        }
    }
コード例 #26
0
    public EMapNodeType GetMapNodeType(CVector3 oPos)
    {
        MapNode mapNode = this.m_oMapData.GetMapNode(oPos.m_nX, oPos.m_nY);

        if (mapNode == null)
        {
            return(EMapNodeType.MAP_NODE_INVALID);
        }
        return(mapNode.m_eMapNodeType);
    }
コード例 #27
0
        public virtual List <long> GetAffectBeastsByTargetPos(long unMasterBeastId, CVector3 vecTargetHexPos)
        {
            List <long> list  = new List <long>();
            Beast       beast = Singleton <BeastManager> .singleton.GetBeastByPos(vecTargetHexPos);

            if (beast != null || !beast.IsError)
            {
                list.Add(beast.Id);
            }
            return(list);
        }
コード例 #28
0
ファイル: Beast.cs プロジェクト: githuanl/NewBeastGame
 public void OnMoveTo(CVector3 hexPos)
 {
     //、this.m_terrainCardManager.OnHeroMoveTo(hexPos);
     //this.SkillManager.OnHeroPosChange(this.Id);
     //如果是自身的神兽
     if (this.Role)
     {
         this.IsMoved = true;
         Singleton <BeastRole> .singleton.OnMove(hexPos);
     }
 }
コード例 #29
0
    public bool PlaceAEnergyTrap(CVector3 oPos)
    {
        if (this.isCanPlaceATrap(oPos))
        {
            return(false);
        }
        PathNode mapNode = this.m_oTablePathNodes[oPos.m_nX][oPos.m_nY];

        mapNode.sum += 1;
        return(true);
    }
コード例 #30
0
 /// <summary>
 /// 是否这个格子上有神兽站立
 /// </summary>
 /// <param name="oPos"></param>
 /// <returns></returns>
 public bool IsPosStandByAnyRole(CVector3 oPos)
 {
     foreach (CVector3 current in this.m_oDicRolesPos.Values)
     {
         if (current.Equals(oPos))
         {
             return(true);
         }
     }
     return(false);
 }