Exemple #1
0
        public bool GetRevivePosDir(ref ActorMeta actorMeta, bool bGiveBirth, out VInt3 outPosWorld, out VInt3 outDirWorld)
        {
            outPosWorld = VInt3.zero;
            outDirWorld = VInt3.forward;
            if (Singleton <GamePlayerCenter> .get_instance().GetPlayer(actorMeta.PlayerId) == null)
            {
                return(false);
            }
            ListView <ReviveRegion> .Enumerator enumerator = this.reviveAreas.GetEnumerator();
            while (enumerator.MoveNext())
            {
                if (!(enumerator.get_Current() == null) && actorMeta.ActorCamp == enumerator.get_Current().CampType)
                {
                    IGameActorDataProvider actorDataProvider = Singleton <ActorDataCenter> .get_instance().GetActorDataProvider(GameActorDataProviderType.ServerDataProvider);

                    int       num       = actorDataProvider.Fast_GetActorServerDataBornIndex(ref actorMeta);
                    Transform transform = enumerator.get_Current().transform;
                    if (!bGiveBirth)
                    {
                        uint num2 = (uint)enumerator.get_Current().SubRevivePlaces.Length;
                        if (!enumerator.get_Current().OnlyBirth)
                        {
                            num2 += 1u;
                            int num3 = (int)FrameRandom.Random(num2);
                            if (0 < num3 && enumerator.get_Current().SubRevivePlaces[num3 - 1] != null)
                            {
                                transform = enumerator.get_Current().SubRevivePlaces[num3 - 1].transform;
                            }
                        }
                        else if (num2 >= 1u)
                        {
                            int num4 = (int)FrameRandom.Random(num2);
                            if (enumerator.get_Current().SubRevivePlaces[num4] != null)
                            {
                                transform = enumerator.get_Current().SubRevivePlaces[num4].transform;
                            }
                        }
                    }
                    Transform transform2 = null;
                    if (transform != null)
                    {
                        if (num < transform.childCount)
                        {
                            transform2 = transform.GetChild(num);
                        }
                        else
                        {
                            transform2 = transform;
                        }
                    }
                    if (transform2 != null)
                    {
                        outPosWorld = (VInt3)transform2.position;
                        outDirWorld = (VInt3)transform2.forward;
                        return(true);
                    }
                }
            }
            return(false);
        }