コード例 #1
0
        public virtual void Initialize(PetHomePoint homePoint)
        {
            this.Clear();
            PetHomePoint petHomePoint = homePoint;

            this.HomePoint = petHomePoint;
            if (Object.op_Equality((Object)petHomePoint, (Object)null) || this.AnimalData == null)
            {
                return;
            }
            if (0 <= this.AnimalData.ModelID && Singleton <Manager.Resources> .IsInstance() && Singleton <Manager.Resources> .Instance.AnimalTable != null)
            {
                Dictionary <int, Dictionary <int, AnimalModelInfo> > modelInfoTable = Singleton <Manager.Resources> .Instance.AnimalTable.ModelInfoTable;
                Dictionary <int, AnimalModelInfo> dictionary;
                if (!((IReadOnlyDictionary <int, Dictionary <int, AnimalModelInfo> >)modelInfoTable).IsNullOrEmpty <int, Dictionary <int, AnimalModelInfo> >() && modelInfoTable.TryGetValue(this.AnimalData.AnimalTypeID, out dictionary) && !((IReadOnlyDictionary <int, AnimalModelInfo>)dictionary).IsNullOrEmpty <int, AnimalModelInfo>())
                {
                    AnimalModelInfo _modelInfo;
                    if (!dictionary.TryGetValue(this.AnimalData.ModelID, out _modelInfo))
                    {
                        this.AnimalData.ModelID = dictionary.Keys.ToList <int>().Rand <int>();
                        _modelInfo = dictionary[this.AnimalData.ModelID];
                    }
                    this.SetModelInfo(_modelInfo);
                    this.LoadBody();
                    if (Object.op_Inequality((Object)this.bodyObject, (Object)null) && Object.op_Equality((Object)this._nicknameRoot, (Object)null))
                    {
                        this._nicknameRoot = new GameObject("Nickname Root").get_transform();
                        this._nicknameRoot.SetParent(this.bodyObject.get_transform(), false);
                        this._nicknameRoot.set_localPosition(new Vector3(0.0f, this._nicknameHeightOffset, 0.0f));
                    }
                }
            }
            if (Object.op_Equality((Object)this._nicknameRoot, (Object)null))
            {
                this._nicknameRoot = new GameObject("Nickname Root").get_transform();
                this._nicknameRoot.SetParent(((Component)this).get_transform(), false);
                this._nicknameRoot.set_localPosition(new Vector3(0.0f, this._nicknameHeightOffset, 0.0f));
            }
            this.SetStateData();
            this.InitializeCommandLabels();
            this._originPriority = Singleton <Manager.Resources> .Instance.AnimalDefinePack.AgentInfo.GroundAnimalStartPriority;
            MovingPetAnimal.PriorityList.Sort();
            while (MovingPetAnimal.PriorityList.Contains(this._originPriority))
            {
                ++this._originPriority;
                if (99 <= this._originPriority)
                {
                    this._originPriority = 99;
                    break;
                }
            }
            MovingPetAnimal.PriorityList.Add(this._originPriority);
            this.Agent.set_avoidancePriority(this._originPriority);
            this.Agent.set_stoppingDistance(0.5f);
            this.Initialize();
            this.BodyEnabled      = false;
            this.AnimalData.First = false;
            this.SetState(AnimalState.Start, (System.Action)null);
        }
コード例 #2
0
ファイル: PetFish.cs プロジェクト: request-time-out/A-Scripts
        public void Initialize(PetHomePoint _homePoint)
        {
            this.Clear();
            PetHomePoint petHomePoint = _homePoint;

            this.HomePoint = petHomePoint;
            if (Object.op_Equality((Object)petHomePoint, (Object)null) || this.AnimalData == null)
            {
                return;
            }
            Resources.FishingTable fishingTable = !Singleton <Resources> .IsInstance() ? (Resources.FishingTable)null : Singleton <Resources> .Instance.Fishing;

            if (fishingTable == null)
            {
                return;
            }
            Dictionary <int, Dictionary <int, FishInfo> > fishInfoTable = fishingTable.FishInfoTable;
            Dictionary <int, Tuple <GameObject, RuntimeAnimatorController> > fishModelTable = fishingTable.FishModelTable;
            Dictionary <int, FishInfo> dictionary;
            FishInfo fishInfo;
            Tuple <GameObject, RuntimeAnimatorController> tuple;

            if (!((IReadOnlyDictionary <int, Dictionary <int, FishInfo> >)fishInfoTable).IsNullOrEmpty <int, Dictionary <int, FishInfo> >() && !((IReadOnlyDictionary <int, Tuple <GameObject, RuntimeAnimatorController> >)fishModelTable).IsNullOrEmpty <int, Tuple <GameObject, RuntimeAnimatorController> >() && (fishInfoTable.TryGetValue(this.AnimalData.ItemCategoryID, out dictionary) && !((IReadOnlyDictionary <int, FishInfo>)dictionary).IsNullOrEmpty <int, FishInfo>()) && (dictionary.TryGetValue(this.AnimalData.ItemID, out fishInfo) && fishModelTable.TryGetValue(fishInfo.ModelID, out tuple)))
            {
                this.LoadBody(tuple.Item1);
                if (Object.op_Inequality((Object)this.animator, (Object)null))
                {
                    this.animator.set_runtimeAnimatorController(tuple.Item2);
                }
                _homePoint.SetRootPoint(fishInfo.TankPointID, (IPetAnimal)this);
                this.FollowTarget = _homePoint.GetRootPoint(fishInfo.TankPointID);
                if (Object.op_Inequality((Object)this.bodyObject, (Object)null))
                {
                    this._nicknameRoot = new GameObject("Nickname Root").get_transform();
                    this._nicknameRoot.SetParent(this.bodyObject.get_transform(), false);
                    Renderer componentInChildren = (Renderer)this.bodyObject.GetComponentInChildren <Renderer>(true);
                    if (Object.op_Inequality((Object)componentInChildren, (Object)null))
                    {
                        Vector3    position = this.Position;
                        Quaternion rotation = this.Rotation;
                        this.Position = Vector3.get_zero();
                        this.Rotation = Quaternion.get_identity();
                        Bounds  bounds1 = componentInChildren.get_bounds();
                        Vector3 center  = ((Bounds) ref bounds1).get_center();
                        Bounds  bounds2 = componentInChildren.get_bounds();
                        this._nicknameRoot.set_localPosition(new Vector3(0.0f, (float)(((Bounds) ref bounds2).get_extents().y / 2.0 + center.y) + this._nicknameHeightOffset, (float)center.z));
                        this.Position = position;
                        this.Rotation = rotation;
                    }
                    else
                    {
                        this._nicknameRoot.set_localPosition(new Vector3(0.0f, this._nicknameHeightOffset, 0.0f));
                    }
                }
            }
            if (Object.op_Equality((Object)this._nicknameRoot, (Object)null))
            {
                this._nicknameRoot = new GameObject("Nickname Root").get_transform();
                this._nicknameRoot.SetParent(((Component)this).get_transform(), false);
                this._nicknameRoot.set_localPosition(new Vector3(0.0f, this._nicknameHeightOffset, 0.0f));
            }
            if (Object.op_Equality((Object)this.FollowTarget, (Object)null))
            {
                this.FollowTarget = ((Component)this.HomePoint).get_transform();
            }
            this.SetStateData();
            bool flag = false;

            this.MarkerEnabled = flag;
            this.BodyEnabled   = flag;
            this.SetState(AnimalState.Start, (Action)null);
        }
コード例 #3
0
 public override void Initialize(PetHomePoint _homePoint)
 {
 }