示例#1
0
        public void Initialize(FishingManager _fishingManager, Transform _rootPos, LineRenderer _line)
        {
            ActionItemInfo actionItemInfo;
            GameObject     gameObject;

            if (Object.op_Equality((Object)this.bodyObject, (Object)null) && Singleton <Resources> .Instance.Map.EventItemList.TryGetValue(Singleton <Resources> .Instance.FishingDefinePack.IDInfo.LureEventItemID, out actionItemInfo) && Object.op_Inequality((Object)(gameObject = CommonLib.LoadAsset <GameObject>((string)actionItemInfo.assetbundleInfo.assetbundle, (string)actionItemInfo.assetbundleInfo.asset, false, (string)actionItemInfo.assetbundleInfo.manifest)), (Object)null))
            {
                MapScene.AddAssetBundlePath((string)actionItemInfo.assetbundleInfo.assetbundle, (string)actionItemInfo.assetbundleInfo.manifest);
                this.bodyObject = (GameObject)Object.Instantiate <GameObject>((M0)gameObject, Vector3.get_zero(), Quaternion.get_identity());
                this.bodyObject.get_transform().SetParent(((Component)this).get_transform(), false);
                this.floatingObject = this.bodyObject.GetOrAddComponent <FloatingObject>();
                this.floatingObject.fishingSystem     = _fishingManager;
                this.floatingObject.WaterEnterChecker = new Func <Collider, bool>(this.WaterInOutCheck);
                this.floatingObject.WaterStayChecker  = new Func <Collider, bool>(this.WaterInOutCheck);
                this.floatingObject.WaterExitChecker  = new Func <Collider, bool>(this.WaterInOutCheck);
            }
            this.fishingSystem = _fishingManager;
            this.RootPos       = _rootPos;
            ((Component)this).get_transform().set_parent(this.RootPos);
            Transform transform = ((Component)this).get_transform();
            Vector3   zero      = Vector3.get_zero();

            ((Component)this).get_transform().set_localEulerAngles(zero);
            Vector3 vector3 = zero;

            transform.set_localPosition(vector3);
            this.fishingLine = _line;
            this.state       = Lure.State.Have;
            if (!Object.op_Implicit((Object)this.floatingObject))
            {
                return;
            }
            this.floatingObject.UseWaterBuoyancy = false;
        }
示例#2
0
        public void Initialize(FishingManager _fishingSystem, FishInfo _fishInfo)
        {
            this.state              = Fish.State.None;
            this.fishInfo           = _fishInfo;
            this.fishingSystem      = _fishingSystem;
            this.activeNextPosition = false;
            if (Object.op_Inequality((Object)this.bodyObj, (Object)null))
            {
                Object.Destroy((Object)this.bodyObj);
            }
            ((Component)this).get_transform().set_localScale(this.originScale);
            Tuple <AssetBundleInfo, RuntimeAnimatorController, string> tuple;

            if (Singleton <Resources> .Instance.Fishing.FishBodyTable.TryGetValue(this.fishInfo.SizeID, out tuple))
            {
                // ISSUE: variable of the null type
                __Null assetbundle = tuple.Item1.assetbundle;
                // ISSUE: variable of the null type
                __Null asset = tuple.Item1.asset;
                // ISSUE: variable of the null type
                __Null     manifest = tuple.Item1.manifest;
                GameObject gameObject;
                if (Object.op_Inequality((Object)(gameObject = CommonLib.LoadAsset <GameObject>((string)assetbundle, (string)asset, false, (string)manifest)), (Object)null))
                {
                    AssetBundleInfo assetBundleInfo = tuple.Item1;
                    MapScene.AddAssetBundlePath((string)assetBundleInfo.assetbundle, (string)assetBundleInfo.manifest);
                    this.bodyObj  = (GameObject)Object.Instantiate <GameObject>((M0)gameObject, Vector3.get_zero(), Quaternion.get_identity());
                    this.fishAnim = (Animator)this.bodyObj.GetComponent <Animator>();
                    if (Object.op_Inequality((Object)this.fishAnim, (Object)null))
                    {
                        this.fishAnim.set_runtimeAnimatorController(tuple.Item2);
                    }
                    this.eyeT = this.bodyObj.get_transform().FindLoop(tuple.Item3)?.get_transform() ?? ((Component)this).get_transform();
                    Renderer componentInChildren = (Renderer)this.bodyObj.GetComponentInChildren <Renderer>(true);
                    float    createOffsetHeight  = Singleton <Resources> .Instance.FishingDefinePack.FishParam.CreateOffsetHeight;
                    if (Object.op_Inequality((Object)componentInChildren, (Object)null))
                    {
                        Bounds      bounds1  = componentInChildren.get_bounds();
                        Vector3     center   = ((Bounds) ref bounds1).get_center();
                        Bounds      bounds2  = componentInChildren.get_bounds();
                        Vector3     extents  = ((Bounds) ref bounds2).get_extents();
                        Vector3     position = this.bodyObj.get_transform().get_position();
                        ref Vector3 local1   = ref position;
                        local1.z = local1.z - (extents.z + center.z);
                        ref Vector3 local2 = ref position;
                        local2.y = (__Null)(local2.y - (extents.y + center.y + 0.25));
                        ref Vector3 local3 = ref position;
                        local3.y = (__Null)(local3.y + ((double)createOffsetHeight - extents.y));
                        this.bodyObj.get_transform().set_position(position);
                    }
示例#3
0
 private void InitFishingSystem()
 {
     if (Object.op_Equality((Object)this.fishingSystem, (Object)null))
     {
         GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)CommonLib.LoadAsset <GameObject>(Singleton <Resources> .Instance.DefinePack.ABPaths.MapScenePrefab, this.PlayerParam.FishingGamePrefabName, false, Singleton <Resources> .Instance.DefinePack.ABManifests.Default), ((Component)this.player).get_transform());
         ((Object)gameObject).set_name(this.PlayerParam.FishingGamePrefabName);
         AIProject.Player.Fishing.fishingSystemRoot = gameObject;
         this.fishingSystem = (FishingManager)gameObject.GetComponentInChildren <FishingManager>();
         this.fishingSystem.FishGetEvent = (Action)(() => this.AcquirementFish());
         MapScene.AddAssetBundlePath(Singleton <Resources> .Instance.DefinePack.ABPaths.MapScenePrefab, Singleton <Resources> .Instance.DefinePack.ABManifests.Default);
     }
     AIProject.Player.Fishing.fishingSystemRoot.get_transform().set_position(this.player.Position);
     AIProject.Player.Fishing.fishingSystemRoot.get_transform().set_rotation(this.player.Rotation);
     this.FitMoveAreaOnWater();
     this.SetActive(AIProject.Player.Fishing.fishingSystemRoot, true);
 }
            public void LoadBody(AssetBundleInfo _assetInfo, Transform _parent)
            {
                this.Destroy();
                GameObject gameObject = CommonLib.LoadAsset <GameObject>((string)_assetInfo.assetbundle, (string)_assetInfo.asset, false, (string)_assetInfo.manifest);

                if (Object.op_Equality((Object)gameObject, (Object)null))
                {
                    return;
                }
                MapScene.AddAssetBundlePath((string)_assetInfo.assetbundle, (string)_assetInfo.manifest);
                this.obj = (GameObject)Object.Instantiate <GameObject>((M0)gameObject);
                this.obj.get_transform().SetParent(_parent, false);
                this.animator      = (Animator)this.obj.GetComponentInChildren <Animator>(true);
                this.animation     = (Animation)this.obj.GetComponentInChildren <Animation>(true);
                this.bodyRenderers = (Renderer[])this.obj.GetComponentsInChildren <Renderer>(true);
            }
示例#5
0
        private void OnUpdate()
        {
            List <AIProject.SaveData.Environment.PlantInfo> source;

            if (!Singleton <Game> .Instance.Environment.FarmlandTable.TryGetValue(this.HarvestID, out source))
            {
                return;
            }
            AIProject.SaveData.Environment.PlantInfo element = source.GetElement <AIProject.SaveData.Environment.PlantInfo>(this.SectionID);
            if (element == null)
            {
                if (this._plantInfo == null)
                {
                    return;
                }
                this._plantInfo = (AIProject.SaveData.Environment.PlantInfo)null;
                if (!Object.op_Inequality((Object)this._plantItem, (Object)null))
                {
                    return;
                }
                Object.Destroy((Object)((Component)this._plantItem).get_gameObject());
                this._plantItem = (PlantItem)null;
            }
            else
            {
                if (this._plantInfo != element)
                {
                    this._plantInfo = element;
                    StuffItemInfo seedInfo = Singleton <Resources> .Instance.GameInfo.FindItemInfo(element.nameHash);

                    AssetBundleInfo assetBundleInfo;
                    if (Singleton <Resources> .Instance.Map.PlantItemList.TryGetValue(Singleton <Resources> .Instance.Map.PlantIvyFilterList.Find((Predicate <ItemInfo>)(x => x.CategoryID == seedInfo.CategoryID && x.ItemID == seedInfo.ID)).ObjID, out assetBundleInfo))
                    {
                        GameObject gameObject = CommonLib.LoadAsset <GameObject>((string)assetBundleInfo.assetbundle, (string)assetBundleInfo.asset, false, (string)assetBundleInfo.manifest);
                        MapScene.AddAssetBundlePath((string)assetBundleInfo.assetbundle, (string)assetBundleInfo.manifest);
                        if (Object.op_Inequality((Object)gameObject, (Object)null))
                        {
                            if (Object.op_Inequality((Object)this._plantItem, (Object)null))
                            {
                                Object.Destroy((Object)((Component)this._plantItem).get_gameObject());
                                this._plantItem = (PlantItem)null;
                            }
                            this._plantItem = (PlantItem)((GameObject)Object.Instantiate <GameObject>((M0)gameObject, ((Component)this).get_transform(), false)).GetComponent <PlantItem>();
                            this._plantItem.ChangeState(0);
                        }
                    }
                }
                if (!Object.op_Inequality((Object)this._plantItem, (Object)null))
                {
                    return;
                }
                float num = element.timer / (float)element.timeLimit;
                if ((double)num < 0.5)
                {
                    this._plantItem.ChangeState(0);
                }
                else if ((double)num < 1.0)
                {
                    this._plantItem.ChangeState(1);
                }
                else
                {
                    this._plantItem.ChangeState(2);
                }
            }
        }