コード例 #1
0
 public void FixCurrentPosition()
 {
     if (NavMesh.SamplePosition(base.get_transform().get_position(), ref this.fixHit, 50f, -1))
     {
         base.get_transform().set_position(MySceneManager.GetTerrainPoint(this.fixHit.get_position().x, this.fixHit.get_position().z, base.get_transform().get_position().y));
     }
 }
コード例 #2
0
 protected void SetDefaultFixStand()
 {
     this.transform.set_position(MySceneManager.GetTerrainPoint(this.npcPosition.x, this.npcPosition.z, this.npcPosition.y));
     this.navMeshAgent.Warp(this.transform.get_position());
     this.transform.set_forward(this.npcDirection);
     base.CastAction(base.DefaultIdleActionStatus);
 }
コード例 #3
0
    protected void CheckFixStand()
    {
        float num = XUtility.DistanceNoY(this.transform.get_position(), this.npcPosition);

        if (num > TaskNPCBehavior.NavToPointStopDistance)
        {
            this.transform.set_position(MySceneManager.GetTerrainPoint(this.npcPosition.x, this.npcPosition.z, this.npcPosition.y));
            this.navMeshAgent.Warp(this.transform.get_position());
        }
        if (this.transform.get_forward() != this.npcDirection)
        {
            this.transform.set_forward(this.npcDirection);
        }
        if (this.IsFollowingSelf)
        {
            this.IsFollowingSelf = false;
        }
        if (this.IsNavToPoint)
        {
            this.IsNavToPoint = false;
        }
        this.StopNavAgent();
        base.CastAction(base.DefaultIdleActionStatus);
        this.UpdateState(new TaskNPCBehavior.TaskNPCState
        {
            state     = TaskNPCBehavior.TaskNPCState.TaskNPCStateType.None,
            Position  = this.transform.get_position(),
            Direction = this.transform.get_forward()
        });
    }
コード例 #4
0
    public override void ApplyDefaultState()
    {
        Vector3 spawnPosition = this.GetSpawnPosition();

        this.transform.set_position(MySceneManager.GetTerrainPoint(spawnPosition.x, spawnPosition.z, 0f));
        this.transform.set_eulerAngles(new Vector3(0f, (float)Random.Range(0, 360), 0f));
    }
コード例 #5
0
 public static Vector3 GetTerrainBornPoint(float curHeight)
 {
     if (DataReader <Scene> .Contains(MySceneManager.Instance.CurSceneID))
     {
         Vector2 point = MapDataManager.Instance.GetPoint(MySceneManager.Instance.CurSceneID, DataReader <Scene> .Get(MySceneManager.Instance.CurSceneID).pointId);
         return(MySceneManager.GetTerrainPoint(point.x * 0.01f, point.y * 0.01f, curHeight));
     }
     return(Vector3.get_zero());
 }
コード例 #6
0
    public static bool GetTerrainBornPoint(float curHeight, out Vector3 result)
    {
        if (!DataReader <Scene> .Contains(MySceneManager.Instance.CurSceneID))
        {
            result = Vector3.get_zero();
            return(false);
        }
        Vector2 point = MapDataManager.Instance.GetPoint(MySceneManager.Instance.CurSceneID, DataReader <Scene> .Get(MySceneManager.Instance.CurSceneID).pointId);

        return(MySceneManager.GetTerrainPoint(point.x * 0.01f, point.y * 0.01f, curHeight, out result));
    }
コード例 #7
0
        public bool MoveToPoint(float x, float z, float range)
        {
            if (this.owner.IsWeak)
            {
                return(false);
            }
            if (!this.ownerActor)
            {
                return(false);
            }
            Vector3 terrainPoint = MySceneManager.GetTerrainPoint(x, z, this.ownerActor.FixTransform.get_position().y);

            if (XUtility.DistanceNoY(terrainPoint, this.ownerActor.FixTransform.get_position()) > range)
            {
                this.ownerActor.MoveToPoint(terrainPoint, 0f, null);
            }
            return(true);
        }
コード例 #8
0
 public bool MoveByPointGroup(int groupID)
 {
     if (this.owner.IsWeak)
     {
         return(false);
     }
     if (!this.ownerActor)
     {
         return(false);
     }
     if (!this.pointGroupCache.ContainsKey(groupID))
     {
         ArrayList pointDataByGroupKey = MapDataManager.Instance.GetPointDataByGroupKey(MySceneManager.Instance.CurSceneID, groupID);
         if (pointDataByGroupKey == null)
         {
             return(false);
         }
         this.pointGroupCache.Add(groupID, new List <Vector3>());
         for (int i = 0; i < pointDataByGroupKey.get_Count(); i++)
         {
             Hashtable hashtable = (Hashtable)pointDataByGroupKey.get_Item(i);
             float     x         = (float)((double)hashtable.get_Item("x") * 0.0099999997764825821);
             float     z         = (float)((double)hashtable.get_Item("y") * 0.0099999997764825821);
             this.pointGroupCache[groupID].Add(MySceneManager.GetTerrainPoint(x, z, this.owner.CurFloorStandardHeight));
         }
     }
     if (this.pointGroupCache[groupID].get_Count() == 0)
     {
         return(false);
     }
     if (!this.pointGroupIndex.ContainsKey(groupID))
     {
         this.pointGroupIndex.Add(groupID, 0);
     }
     this.ownerActor.MoveToPoint(this.pointGroupCache[groupID].get_Item(this.pointGroupIndex[groupID]), 0f, delegate
     {
         this.pointGroupIndex[groupID] = ((this.pointGroupIndex[groupID] + 1 >= this.pointGroupCache[groupID].get_Count()) ? 0 : (this.pointGroupIndex[groupID] + 1));
         this.Think();
     });
     return(true);
 }
コード例 #9
0
ファイル: RealDrop.cs プロジェクト: unseen-code/tianqi_src
    public static RealDrop CreateRealDrop(int theIndex, int theModelID, string theItemName, Vector3 originPoint, Vector3 waitPoint, int waitFxID, int collectTextID)
    {
        if (!DataReader <DiaoLuoMoXingBiao> .Contains(theModelID))
        {
            return(null);
        }
        DiaoLuoMoXingBiao diaoLuoMoXingBiao = DataReader <DiaoLuoMoXingBiao> .Get(theModelID);

        GameObject gameObject = GameObjectLoader.Instance.Get(diaoLuoMoXingBiao.path);

        if (gameObject == null)
        {
            return(null);
        }
        RealDrop realDrop = gameObject.AddUniqueComponent <RealDrop>();

        realDrop.Index    = theIndex;
        realDrop.ModelID  = theModelID;
        realDrop.ItemName = theItemName;
        realDrop.animator = realDrop.GetComponentInChildren <Animator>();
        realDrop.get_gameObject().set_layer(LayerSystem.NameToLayer("Gear"));
        realDrop.get_transform().set_parent(RealDrop.DropPool.get_transform());
        realDrop.get_transform().set_position(originPoint);
        if (originPoint.x == waitPoint.x && originPoint.z == waitPoint.z)
        {
            realDrop.currentState           = RealDrop.RealDropState.Wait;
            realDrop.waitPosition           = originPoint;
            realDrop.flyToWaitPositionSpeed = Vector3.get_zero();
        }
        else
        {
            realDrop.currentState           = RealDrop.RealDropState.FlyToWait;
            realDrop.waitPosition           = MySceneManager.GetTerrainPoint(waitPoint.x, waitPoint.z, waitPoint.y);
            realDrop.flyToWaitPositionSpeed = (realDrop.waitPosition - originPoint) / RealDrop.FlyToWaitPositionDefaultTime;
        }
        realDrop.waitFxModelID = waitFxID;
        realDrop.waitCollider  = realDrop.GetComponent <BoxCollider>();
        realDrop.waitCollider.set_enabled(false);
        RealDrop.allRealDrop.Add(realDrop);
        return(realDrop);
    }
コード例 #10
0
    public static FakeDrop CreateFakeDrop(int modelID, Vector3 originPoint, Vector3 waitPoint, int waitFxID, int flyToEntityFxID)
    {
        DiaoLuoMoXingBiao diaoLuoMoXingBiao = DataReader <DiaoLuoMoXingBiao> .Get(modelID);

        if (diaoLuoMoXingBiao == null)
        {
            return(null);
        }
        GameObject gameObject = GameObjectLoader.Instance.Get(diaoLuoMoXingBiao.path);

        if (gameObject == null)
        {
            return(null);
        }
        FakeDrop fakeDrop = gameObject.AddUniqueComponent <FakeDrop>();

        fakeDrop.animator = fakeDrop.GetComponentInChildren <Animator>();
        fakeDrop.get_gameObject().set_layer(LayerSystem.NameToLayer("Gear"));
        fakeDrop.get_transform().set_parent(FakeDrop.DropPool.get_transform());
        fakeDrop.get_transform().set_position(originPoint);
        if (originPoint.x == waitPoint.x && originPoint.z == waitPoint.z)
        {
            fakeDrop.currentState           = FakeDrop.FakeDropState.Wait;
            fakeDrop.waitPosition           = originPoint;
            fakeDrop.flyToWaitPositionSpeed = Vector3.get_zero();
        }
        else
        {
            fakeDrop.currentState           = FakeDrop.FakeDropState.FlyToWait;
            fakeDrop.waitPosition           = MySceneManager.GetTerrainPoint(waitPoint.x, waitPoint.z, waitPoint.y);
            fakeDrop.flyToWaitPositionSpeed = (fakeDrop.waitPosition - originPoint) / FakeDrop.FlyToWaitPositionDefaultTime;
        }
        fakeDrop.waitFxModelID = waitFxID;
        fakeDrop.waitCollider  = fakeDrop.GetComponent <BoxCollider>();
        fakeDrop.waitCollider.set_enabled(false);
        fakeDrop.flyToEntityFxModelID = flyToEntityFxID;
        FakeDrop.allFakeDrop.Add(fakeDrop);
        return(fakeDrop);
    }
コード例 #11
0
        protected XPoint GetEffectBasePoint(EffectBasePointType basePointType, float shakeRange, long targetID, int spawnPointID, List <int> prescribedPositionList, List <int> prescribedToPositionList)
        {
            Vector3 zero = Vector3.get_zero();

            if (shakeRange != 0f)
            {
                Vector2 vector = Random.get_insideUnitCircle() * shakeRange * 0.01f;
                zero = new Vector3(vector.x, 0f, vector.y);
            }
            switch (basePointType)
            {
            case EffectBasePointType.Self:
                return(new XPoint
                {
                    position = this.ownerActor.FixTransform.get_position() + zero,
                    rotation = this.ownerActor.FixTransform.get_rotation()
                });

            case EffectBasePointType.Target:
                return((!EntityWorld.Instance.AllEntities.ContainsKey(targetID) || !EntityWorld.Instance.AllEntities[targetID].Actor) ? null : new XPoint
                {
                    position = EntityWorld.Instance.AllEntities[targetID].Actor.FixTransform.get_position() + zero,
                    rotation = this.ownerActor.FixTransform.get_rotation()
                });

            case EffectBasePointType.SpawnPoint:
            {
                if (spawnPointID == 0)
                {
                    return(null);
                }
                Vector2 point        = MapDataManager.Instance.GetPoint(MySceneManager.Instance.CurSceneID, spawnPointID);
                Vector3 terrainPoint = MySceneManager.GetTerrainPoint(point.x, point.y, this.ownerActor.FixTransform.get_position().y);
                Vector3 vector2      = Vector3.get_forward();
                if (prescribedToPositionList != null && prescribedToPositionList.get_Count() >= 3)
                {
                    vector2 = new Vector3((float)prescribedToPositionList.get_Item(0) * 0.01f, (float)prescribedToPositionList.get_Item(1) * 0.01f, (float)prescribedToPositionList.get_Item(2) * 0.01f) - terrainPoint;
                }
                return(new XPoint
                    {
                        position = terrainPoint + zero,
                        rotation = Quaternion.LookRotation(vector2)
                    });
            }

            case EffectBasePointType.TriggerPoint:
                return(null);

            case EffectBasePointType.PrescribedPoint:
            {
                if (prescribedPositionList == null)
                {
                    return(null);
                }
                if (prescribedPositionList.get_Count() < 3)
                {
                    return(null);
                }
                Vector3 vector3 = new Vector3((float)prescribedPositionList.get_Item(0) * 0.01f, (float)prescribedPositionList.get_Item(1) * 0.01f, (float)prescribedPositionList.get_Item(2) * 0.01f);
                Vector3 vector4 = Vector3.get_forward();
                if (prescribedToPositionList != null && prescribedToPositionList.get_Count() >= 3)
                {
                    vector4 = new Vector3((float)prescribedToPositionList.get_Item(0) * 0.01f, (float)prescribedToPositionList.get_Item(1) * 0.01f, (float)prescribedToPositionList.get_Item(2) * 0.01f) - vector3;
                }
                return(new XPoint
                    {
                        position = vector3 + zero,
                        rotation = Quaternion.LookRotation(vector4)
                    });
            }

            default:
                return(null);
            }
        }
コード例 #12
0
 public static Vector3 ToTerrainPoint(List <int> posData)
 {
     return(MySceneManager.GetTerrainPoint((float)posData.get_Item(0) * 0.01f, (float)posData.get_Item(2) * 0.01f, (float)posData.get_Item(1) * 0.01f));
 }
コード例 #13
0
 public static Vector3 ToTerrainPoint(Pos serverPos, float height)
 {
     return(MySceneManager.GetTerrainPoint(serverPos.x * 0.01f, serverPos.y * 0.01f, height));
 }
コード例 #14
0
 public static Vector3 ToTerrainPoint(Vector2 pos, float height)
 {
     return(MySceneManager.GetTerrainPoint(pos.x, pos.y, height));
 }
コード例 #15
0
 public static Vector3 ToTerrainPoint(Vector3 pos)
 {
     return(MySceneManager.GetTerrainPoint(pos.x, pos.z, pos.y));
 }