Exemple #1
0
    // overload the constructor to properly deal with lanes that can have props
    public LaneData(BasicLane lane, PropManager propManager)
    {
        // store the lane position
        Vector3 lanePositionVector = lane.getLanePosition();

        lanePosition[0] = lanePositionVector.x;
        lanePosition[1] = lanePositionVector.y;
        lanePosition[2] = lanePositionVector.z;
        // store the lane width and the max/min values
        laneWidth = lane.getLaneWidth();
        maxWidth  = lane.getMaxWidth();
        minWidth  = lane.getMinWidth();
        // store the lane type
        laneType = lane.getLaneType();
        // store the booleans
        vehicleLane       = lane.isVehicleLane();
        nonVehicleAsphalt = lane.isNonVehicleAsphaltLane();
        nonAsphalt        = lane.isNonAsphaltLane();
        // store the stripes' data
        GameObject leftStripe  = lane.getStripe("left");
        GameObject rightStripe = lane.getStripe("right");

        if (leftStripe != null)
        {
            Stripe leftStripeScriptRef = (Stripe)leftStripe.GetComponent("Stripe");
            leftStripeData = new StripeData(leftStripeScriptRef);
        }
        if (rightStripe != null)
        {
            Stripe rightStripeScriptRef = (Stripe)rightStripe.GetComponent("Stripe");
            rightStripeData = new StripeData(rightStripeScriptRef);
        }

        propManagerData = new PropManagerData(propManager);
    }
Exemple #2
0
        private static void DrawTextBri(ushort refID, int boardIdx, int secIdx, Matrix4x4 propMatrix, BoardTextDescriptorGeneralXml textDescriptor,
                                        MaterialPropertyBlock materialPropertyBlock, BasicRenderInformation renderInfo, Color colorToSet, Vector3 targetPos, Vector3 targetRotation,
                                        Vector3 baseScale, bool placeClone180Y, UIHorizontalAlignment targetTextAlignment, float maxWidth, int instanceFlags, Color parentColor,
                                        PrefabInfo srcInfo, ref int defaultCallsCounter, Camera targetCamera = null)
        {
            var textMatrixes = CalculateTextMatrix(targetPos, targetRotation, baseScale, targetTextAlignment, maxWidth, textDescriptor, renderInfo, placeClone180Y);

            foreach (var textMatrixTuple in textMatrixes)
            {
                Matrix4x4 matrix = propMatrix * textMatrixTuple.First;

                materialPropertyBlock.Clear();

                Material    targetMaterial = renderInfo.m_generatedMaterial;
                PropManager instance       = CalculateIllumination(refID, boardIdx, secIdx, textDescriptor, materialPropertyBlock, ref colorToSet, instanceFlags);


                defaultCallsCounter++;
                Graphics.DrawMesh(renderInfo.m_mesh, matrix, targetMaterial, 10, targetCamera, 0, materialPropertyBlock, false);

                if (((Vector2)textDescriptor.BackgroundMeshSettings.Size).sqrMagnitude != 0)
                {
                    BasicRenderInformation bgBri = WriteTheSignsMod.Controller.AtlasesLibrary.GetFromLocalAtlases(null, KlyteResourceLoader.GetDefaultSpriteNameFor(LineIconSpriteNames.K45_SquareIcon));
                    if (bgBri != null)
                    {
                        Matrix4x4 containerMatrix = DrawBgMesh(ref propMatrix, textDescriptor, materialPropertyBlock, ref targetPos, ref targetRotation, ref baseScale, targetTextAlignment, targetCamera, textMatrixTuple, instance, bgBri, ref defaultCallsCounter);
                        if (textDescriptor.BackgroundMeshSettings.UseFrame)
                        {
                            DrawTextFrame(textDescriptor, materialPropertyBlock, ref targetPos, ref targetRotation, ref baseScale, ref parentColor, srcInfo, targetCamera, ref containerMatrix, ref defaultCallsCounter);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Replaces a map prop.
        /// </summary>
        /// <param name="target">Prop to replace</param>
        /// <param name="replacement">Replacement prop</param>
        private void ReplaceProps(PropInfo target, PropInfo replacement)
        {
            // Check for valid parameters.
            if (target != null && replacement != null)
            {
                // Local references.
                PropManager    propManager = Singleton <PropManager> .instance;
                PropInstance[] props       = propManager.m_props.m_buffer;

                Logging.Message("replacing tree ", target.name, " with ", replacement.name);

                // Iterate through each tree in map.
                for (uint propIndex = 0; propIndex < props.Length; ++propIndex)
                {
                    // Local reference.
                    PropInstance prop = props[propIndex];

                    // Skip non-existent trees (those with no flags).
                    if (prop.m_flags == (ushort)PropInstance.Flags.None)
                    {
                        continue;
                    }

                    // If tree matches, replace!
                    if (prop.Info == target)
                    {
                        props[propIndex].Info = replacement;

                        // Refresh tree render (to update LOD).
                        propManager.UpdatePropRenderer((ushort)propIndex, true);
                    }
                }
            }
        }
Exemple #4
0
        private static Matrix4x4 DrawBgMesh(ref Matrix4x4 propMatrix, BoardTextDescriptorGeneralXml textDescriptor, MaterialPropertyBlock materialPropertyBlock, ref Vector3 targetPos,
                                            ref Vector3 targetRotation, ref Vector3 baseScale, UIHorizontalAlignment targetTextAlignment, Camera targetCamera, Tuple <Matrix4x4, Tuple <Matrix4x4, Matrix4x4, Matrix4x4, Matrix4x4> > textMatrixTuple,
                                            PropManager instance, BasicRenderInformation bgBri, ref int defaultCallsCounter)
        {
            materialPropertyBlock.SetColor(WTSDynamicTextRenderingRules.SHADER_PROP_COLOR, textDescriptor.BackgroundMeshSettings.BackgroundColor * new Color(1, 1, 1, 0));
            materialPropertyBlock.SetVector(instance.ID_ObjectIndex, new Vector4());
            var bgBriMatrix = ApplyTextAdjustments(targetPos, targetRotation, bgBri, baseScale, textDescriptor.BackgroundMeshSettings.Size.Y, targetTextAlignment, textDescriptor.BackgroundMeshSettings.Size.X, false, false, false);

            var lineAdjustmentVector = new Vector3(0, (-textDescriptor.BackgroundMeshSettings.Size.Y / 2) + (32 * SCALING_FACTOR * textDescriptor.m_textScale) - (bgBri.m_YAxisOverflows.min + bgBri.m_YAxisOverflows.max) * SCALING_FACTOR * textDescriptor.m_textScale / 2, -0.001f);
            var containerMatrix      = propMatrix
                                       * Matrix4x4.Translate(targetPos)
                                       * textMatrixTuple.Second.Second
                                       * Matrix4x4.Translate(lineAdjustmentVector)
                                       * textMatrixTuple.Second.Fourth
            ;
            var bgMatrix = propMatrix
                           * Matrix4x4.Translate(targetPos)
                           * textMatrixTuple.Second.Second
                           * Matrix4x4.Translate(lineAdjustmentVector)
                           * Matrix4x4.Scale(new Vector3(textDescriptor.BackgroundMeshSettings.Size.X / bgBri.m_mesh.bounds.size.x, textDescriptor.BackgroundMeshSettings.Size.Y / bgBri.m_mesh.bounds.size.y, 1))
                           * textMatrixTuple.Second.Fourth;

            defaultCallsCounter++;
            Graphics.DrawMesh(bgBri.m_mesh, bgMatrix, bgBri.m_generatedMaterial, 10, targetCamera, 0, materialPropertyBlock, false);
            return(containerMatrix);
        }
Exemple #5
0
        public override void OnCreated(IThreading threading)
        {
            buildingManager = BuildingManager.instance;
            propManager     = PropManager.instance;

            base.OnCreated(threading);
        }
Exemple #6
0
    void Start()
    {
        player = GetComponent <Transform>();
        // enemy = GameObject.FindGameObjectWithTag("Enemy").GetComponent<Transform>();
        anim = GetComponent <Animator>();
        navi = GetComponent <NavMeshAgent>();

        animator = GetComponent <CharacterAnimatior>();

        state = GetComponent <CharacterStates>();

        // miniState = GameObject.FindGameObjectWithTag("Enemy").GetComponent<MinionState>();

        prop = GetComponent <PropManager>();

        if (photonView.isMine)
        {
            Camera.main.GetComponent <FollowCamera>().player = camPivot;
        }

        skillManager = GameObject.Find("UI/CharacterStateInfo/Skll").GetComponent <SkillManager>();

        total = GetComponent <CharacterTotalState>();

        parent = transform.root.gameObject;

        genPoints = GameObject.Find("PlayerGenpoints").GetComponentsInChildren <Transform>();
    }
Exemple #7
0
    private PropManager propManager; //道具管理类的引用

    // Use this for initialization
    void Start()
    {
        anim        = transform.root.GetComponent <Animator>();
        audio       = transform.root.GetComponent <AudioSource>();
        bulletSpawn = transform.Find("bulletSpawn");
        propManager = transform.root.GetComponent <PropManager>();
    }
Exemple #8
0
        public bool ReleaseProp(bool dispatchPlacementEffect)
        {
            CheckPropStillExists();

            if (stillExists == false)
            {
                return(false);
            }
            else
            {
                if (Singleton <PropManager> .instance.m_props.m_buffer[(int)((UIntPtr)propPlacementInfo.propID)].m_flags != 0)
                {
                    PropManager instance = Singleton <PropManager> .instance;
                    instance.ReleaseProp(propPlacementInfo.propID);
                    if (dispatchPlacementEffect)
                    {
                        PropLineTool.DispatchPlacementEffect(propPlacementInfo.position, true);
                    }

                    return(true);
                }

                return(false);
            }
        }
Exemple #9
0
    // sets variables to correctly start moving a prop when Move is selected in the EditPropMenu
    public void startMovingProp(GameObject prop, PropManager propManagerScriptRef)
    {
        setPropBeingMoved(true);

        oldPropPosition   = prop.transform.position;
        oldPropManagerRef = propManagerScriptRef;
        oldPropRotation   = prop.GetComponent <Prop>().getRotation();
        setCurrentPropObj(prop);
        oldPropManagerRef.removeProp(prop);
    }
Exemple #10
0
    void Awake()
    {
        propManager     = GetComponent <PropManager>();
        player2Movement = FindObjectOfType <Player2Movement>();

        firstSlicePosition = Vector3.forward * ((numberOfSlices - bufferedSlices) * sliceLength);
        for (int i = 1; i <= numberOfSlices; ++i)
        {
            InstantiateSlice();
        }
        spawningObstacles = true;
    }
Exemple #11
0
    public PropManagerData(PropManager propMangagerRef)
    {
        List <GameObject> props = propMangagerRef.getProps();

        foreach (GameObject prop in props)
        {
            Prop propScriptRef = prop.GetComponent <Prop>();
            Debug.Log(propScriptRef.getPropType());
            PropData indPropData = new PropData(propScriptRef);
            propData.Add(indPropData);
        }
    }
Exemple #12
0
    public void init(params GameObject[] objRefs)
    {
        // catches the instance when we move a prop and then select another prop
        if (CurrentPropManager.Instance.getPropBeingMoved() == true)
        {
            CurrentPropManager.Instance.revertMovedProp();
        }

        propRef           = objRefs[0];
        propManagerScript = propRef.GetComponent <Prop>().getPropManager();
        CurrentPropManager.Instance.setRotation(propRef.GetComponent <Prop>().getRotation());
    }
Exemple #13
0
    private void InitManager()
    {
        requestMng = new RequestManager(this);
        clientMng  = new ClientManager(this);
        playerMng  = new PlayerManager(this);
        propMng    = new PropManager(this);
        uiMng      = new UIManager(this);
        cameraMng  = new CameraManager(this);



        requestMng.OnInit();
        clientMng.OnInit();
        playerMng.OnInit();
        uiMng.OnInit();
        cameraMng.OnInit();
    }
            public static void Load(Microsoft.Xna.Framework.Content.ContentManager p_loader)
            {
                JKContentManager.Props.SilverCoin           = JKContentManager.Props.LoadCustomWorldItem(p_loader, "silver_coin");
                JKContentManager.Props.GiantBootsWorldItem  = JKContentManager.Props.LoadCustomWorldItem(p_loader, "shoes_iron");
                JKContentManager.Props.GnomeHatWorldItem    = JKContentManager.Props.LoadCustomWorldItem(p_loader, "gnome_hat");
                JKContentManager.Props.TunicWorldItem       = JKContentManager.Props.LoadCustomWorldItem(p_loader, "tunic");
                JKContentManager.Props.YellowShoesWorldItem = JKContentManager.Props.LoadCustomWorldItem(p_loader, "yellow_shoes");
                JKContentManager.Props.CapWorldItem         = JKContentManager.Props.LoadCustomWorldItem(p_loader, "cap");
                JKContentManager.Props.ShroomWorldItem      = JKContentManager.Props.LoadCustomWorldItem(p_loader, "shroom");
                JKContentManager.Props.GhostFragmentItem    = JKContentManager.Props.LoadCustomWorldItem(p_loader, "ghost_fragment");
                JKContentManager.Props.BugNoteItem          = JKContentManager.Props.LoadCustomWorldItem(p_loader, "bug_note");
                string str = "mods/props/textures/";

                JKContentManager.Props.PropScreens        = UltraContent.LoadXmlFiles <PropCollection>(Game1.instance, "mods/props", ".xml");
                JKContentManager.Props.NBP_Only_Props     = UltraContent.LoadXmlFiles <PropCollection>(Game1.instance, "mods/props/new babe plus props", ".xml");
                JKContentManager.Props.OWL_Only_Props     = UltraContent.LoadXmlFiles <PropCollection>(Game1.instance, "mods/props/owl props", ".xml");
                JKContentManager.Props.RaymanOverlayProps = UltraContent.LoadXmlFiles <PropCollection>(Game1.instance, "mods/props/hidden wall props", ".xml");
                PropSettings propSettings = XmlSerializerHelper.Deserialize <PropSettings>(p_loader.RootDirectory + "/mods/props/textures/prop_settings.xml");

                PropManager.SetContentData(propSettings);
                foreach (PropSetting propSetting in propSettings.settings)
                {
                    Texture2D p_texture = p_loader.Load <Texture2D>(str + propSetting.name);
                    JKContentManager.Props.PropSprites.Add(propSetting.name, JKContentManager.Util.SpriteChopUtilGrid(p_texture, propSetting.sheet_cells));
                }
                JKContentManager.Props.RaymanScreens = UltraContent.LoadXmlFiles <RaymanCollection>(Game1.instance, "mods/props/hidden_walls", ".xml");
                Dictionary <string, Texture2D> dictionary = JKExtensions.UltraContent.LoadCunt <Texture2D>(Game1.instance.Content, "mods/props/hidden_walls/textures", ".*");

                JKContentManager.Props.RaymanSprites = new Dictionary <string, Sprite>();
                foreach (KeyValuePair <string, Texture2D> keyValuePair in dictionary)
                {
                    JKContentManager.Props.RaymanSprites.Add(keyValuePair.Key, Sprite.CreateSprite(keyValuePair.Value));
                }
                Dictionary <string, RattmanSettings> dictionary2 = UltraContent.LoadXmlFiles <RattmanSettings>(Game1.instance, "mods/props/messages", ".xml");

                JKContentManager.Props.RattmanSettings = new RattmanSettings[dictionary2.Keys.Count];
                int num = 0;

                foreach (string key in dictionary2.Keys)
                {
                    JKContentManager.Props.RattmanSettings[num++] = dictionary2[key];
                }
                JKContentManager.Props.AchievementHitboxes = UltraContent.LoadXmlFiles <AchievementHitbox>(Game1.instance, "props/achievements", ".xml");
                JKContentManager.Props.BabeGhostWorldItem  = JKContentManager.Props.PropSprites["babeghost"][3];
            }
        private static void SaveProps(BuildingInfo info, ushort buildingID, ref Building data)
        {
            FastList <BuildingInfo.Prop> fastList = new FastList <BuildingInfo.Prop>();
            Vector3    mPosition  = data.m_position;
            Quaternion quaternion = Quaternion.AngleAxis(data.m_angle * 57.29578f, Vector3.down);
            Matrix4x4  matrix4x4  = new Matrix4x4();

            matrix4x4.SetTRS(mPosition, quaternion, Vector3.one);
            matrix4x4 = matrix4x4.inverse;
            PropManager propManager = Singleton <PropManager> .instance;

            for (int i = 0; i < 65536; i++)
            {
                if ((propManager.m_props.m_buffer[i].m_flags & 67) == 1)
                {
                    BuildingInfo.Prop prop = new BuildingInfo.Prop();
                    prop.m_prop        = propManager.m_props.m_buffer[i].Info;
                    prop.m_finalProp   = prop.m_prop;
                    prop.m_position    = matrix4x4.MultiplyPoint(propManager.m_props.m_buffer[i].Position);
                    prop.m_radAngle    = propManager.m_props.m_buffer[i].Angle - data.m_angle;
                    prop.m_angle       = 57.29578f * prop.m_radAngle;
                    prop.m_fixedHeight = propManager.m_props.m_buffer[i].FixedHeight;
                    prop.m_probability = 100;
                    fastList.Add(prop);
                }
            }
            TreeManager treeManager = Singleton <TreeManager> .instance;

            for (int j = 0; j < LimitTreeManager.Helper.TreeLimit; j++)
            {
                if ((treeManager.m_trees.m_buffer[j].m_flags & 3) == 1 && treeManager.m_trees.m_buffer[j].GrowState != 0)
                {
                    BuildingInfo.Prop prop1 = new BuildingInfo.Prop();
                    prop1.m_tree        = treeManager.m_trees.m_buffer[j].Info;
                    prop1.m_finalTree   = prop1.m_tree;
                    prop1.m_position    = matrix4x4.MultiplyPoint(treeManager.m_trees.m_buffer[j].Position);
                    prop1.m_fixedHeight = treeManager.m_trees.m_buffer[j].FixedHeight;
                    prop1.m_probability = 100;
                    fastList.Add(prop1);
                }
            }
            info.m_props = fastList.ToArray();
        }
Exemple #16
0
        public override void RenderOverlay(RenderManager.CameraInfo cameraInfo, Color toolColor, Color despawnColor)
        {
            if (!isValid)
            {
                return;
            }

            ushort      prop        = id.Prop;
            PropManager propManager = PropManager.instance;
            PropInfo    propInfo    = propManager.m_props.m_buffer[prop].Info;
            Vector3     position    = propManager.m_props.m_buffer[prop].Position;
            float       angle       = propManager.m_props.m_buffer[prop].Angle;
            Randomizer  randomizer  = new Randomizer((int)prop);
            float       scale       = propInfo.m_minScale + (float)randomizer.Int32(10000u) * (propInfo.m_maxScale - propInfo.m_minScale) * 0.0001f;
            float       alpha       = 1f;

            PropTool.CheckOverlayAlpha(propInfo, scale, ref alpha);
            toolColor.a *= alpha;
            PropTool.RenderOverlay(cameraInfo, propInfo, position, scale, angle, toolColor);
        }
Exemple #17
0
        public Game(uint[,] mapResource, int numOfTeam)
        {
            if (numOfTeam > maxTeamNum)
            {
                throw new TeamNumOverFlowException();
            }

            gameMap = new Map(mapResource);

            //加入队伍
            this.numOfTeam = numOfTeam;
            teamList       = new ArrayList();
            for (int i = 0; i < numOfTeam; ++i)
            {
                teamList.Add(new Team());
            }

            propManager   = new PropManager(gameMap);
            attackManager = new AttackManager(gameMap);
            moveManager   = new MoveManager(gameMap);
        }
    protected virtual void InteractableObjectUsed(object sender, InteractableObjectEventArgs e)
    {
        //Debug.Log("InteractableObjectUsed");

        PropManager propManagerScriptRef = this.GetComponent <PropManager>();

        //Vector3 cursorPosition = getCursor(sender, e).transform.position;

        // add new instance of prop
        if (!CurrentPropManager.Instance.getCurrentPropObj().name.Equals("Empty"))
        {
            GameObject recentProp = propManagerScriptRef.addProp(currentPropPrefab, cursorTransform.position - currentProp.GetComponent <Prop>().getCenterObjectOffset());

            if (CurrentPropManager.Instance.getPropBeingMoved() == true)
            {
                UIManager.Instance.openUIScreen(UIManager.UIScreens.EditProp, recentProp);
                CurrentPropManager.Instance.clearCurrentPropObj();
                CurrentPropManager.Instance.setPropBeingMoved(false);
            }
        }
    }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            //arielBlackFont = Content.Load<SpriteFont>("SpriteFont1");
            //splashScreen;

            device       = graphics.GraphicsDevice;
            spriteBatch  = new SpriteBatch(GraphicsDevice);
            origin.X     = graphics.PreferredBackBufferWidth / 2;
            origin.Y     = graphics.PreferredBackBufferHeight / 2;
            inputHandler = new InputHandler(origin);
            random       = new Random();
            tileRect     = new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            //tileRect = Window.ClientBounds;
            cam = new Camera(spriteBatch, tileRect);
            cam.loadGuiTextures(Content);

            aiController      = new AIController();
            physicsController = new PhysicsController();
            worldManager      = new WorldManager(random);
            worldManager.initWorldConfig(Content, "Content/Worlds.xml");

            SoundManager.Instance.initSoundConfig(Content, "Content/Sounds.xml", "Content/Music.xml");
            actorController = new ActorController();
            actorManager    = new ActorManager();
            actorManager.initAnimationConfig(Content, "Content/Animations.xml");
            actorManager.initActorConfig(Content, "Content/Actors.xml");

            itemManager = new ItemManager();
            itemManager.initWeaponConfig(Content, "Content/Weapons.xml");

            propManager = new PropManager();
            propManager.initPropConfig(Content, "Content/Props.xml");

            cam.enterStartMenu();
            cam.NewGame              += new EventHandler <EventArgs>(NewGameSelected);
            cam.Tutorial             += new EventHandler <EventArgs>(TutorialSelected);
            cam.Credits              += new EventHandler <EventArgs>(CreditsSelected);
            cam.CreditsExit          += new EventHandler <EventArgs>(CreditsExited);
            WorldManager.worldChange += new EventHandler <EventArgs>(WorldManager_worldChange);
        }
Exemple #20
0
    // Nathan wrote this
    // class constructor
    // road is the road object in the development environment
    public RoadData(Road road)
    {
        // store the environment as an EnvironmentData variable
        Buildings buildingScriptReference = road.getBuildingsReference();

        buildingsIndex = buildingScriptReference.getBuildingIndex();
        // store the fog variables
        FogControl fogControlScriptReference = road.getFogControl();

        fogDistance = fogControlScriptReference.getFogDistance();
        // store the lighting intensities
        BrightnessControl[] lightScripts = road.getLights();
        for (int i = 0; i < lightScripts.Length; i++)
        {
            lightIntensities[i] = lightScripts[i].getBrightness();
        }
        // store the lanes as a list of LaneData
        LinkedList <GameObject> roadLanes = road.getLanes();

        // store the lanes
        foreach (GameObject lane in roadLanes)
        {
            BasicLane laneScriptRef = (BasicLane)lane.GetComponent("BasicLane");
            LaneData  indLaneData   = null;

            // if we have a non-vehicle lane, create the independent lane data with a prop manager
            if (!laneScriptRef.isVehicleLane())
            {
                PropManager propManagerRef = lane.GetComponent <PropManager>();
                indLaneData = new LaneData(laneScriptRef, propManagerRef);
            }
            else
            {
                indLaneData = new LaneData(laneScriptRef);
            }

            laneData.Add(indLaneData);
        }
    }
        protected override Matrix4x4 RenderMesh(PropInfo info, BoardTextDescriptorGeneralXml[] descriptor, Vector3 position, Quaternion rotation, Vector3 scale, Matrix4x4 sourceMatrix, out Color targetColor, ref int defaultCallsCounter)
        {
            var                   propMatrix    = Matrix4x4.TRS(position, rotation, scale) * sourceMatrix;
            PropManager           instance      = Singleton <PropManager> .instance;
            MaterialPropertyBlock materialBlock = instance.m_materialBlock;

            materialBlock.Clear();
            targetColor = WTSDynamicTextRenderingRules.GetPropColor(0, 0, 0, m_defaultInstance, null, out bool colorFound);
            materialBlock.SetColor(instance.ID_Color, colorFound ? targetColor : Color.white);

            PropManager propManager = instance;

            propManager.m_drawCallData.m_batchedCalls += 1;

            if (info.m_rollLocation != null)
            {
                GetMaterial(info).SetVectorArray(instance.ID_RollLocation, info.m_rollLocation);
                GetMaterial(info).SetVectorArray(instance.ID_RollParams, info.m_rollParams);
            }
            defaultCallsCounter++;
            Graphics.DrawMesh(GetMesh(info), propMatrix, GetMaterial(info), info.m_prefabDataLayer, m_camera, 0, materialBlock, false, false, false);
            return(propMatrix);
        }
Exemple #22
0
 private static void init()
 {
     if (null == _instance)
     {
         _instance = FindObjectOfType(typeof(GameManager)) as GameManager;
     }
     if (null == characterManager)
     {
         characterManager = FindObjectOfType(typeof(CharacterManager)) as CharacterManager;
     }
     if (null == bossManager)
     {
         bossManager = FindObjectOfType(typeof(BossManager)) as BossManager;
     }
     if (null == propManager)
     {
         propManager = FindObjectOfType(typeof(PropManager)) as PropManager;
     }
     if (null == canvasManager)
     {
         canvasManager = FindObjectOfType(typeof(CanvasManager)) as CanvasManager;
     }
 }
        private static void ClearDecorations()
        {
            NetManager netManager = Singleton <NetManager> .instance;

            for (int i = 1; i < Mod.MAX_NET_SEGMENTS; i++)
            {
                if (netManager.m_segments.m_buffer[i].m_flags != NetSegment.Flags.None)
                {
                    netManager.ReleaseSegment((ushort)i, true);
                }
            }
            for (int j = 1; j < Mod.MAX_NET_NODES; j++)
            {
                if (netManager.m_nodes.m_buffer[j].m_flags != NetNode.Flags.None)
                {
                    netManager.ReleaseNode((ushort)j);
                }
            }
            PropManager propManager = Singleton <PropManager> .instance;

            for (int k = 1; k < 65536; k++)
            {
                if (propManager.m_props.m_buffer[k].m_flags != 0)
                {
                    propManager.ReleaseProp((ushort)k);
                }
            }
            TreeManager treeManager = Singleton <TreeManager> .instance;

            for (int l = 1; l < LimitTreeManager.Helper.TreeLimit; l++)
            {
                if (treeManager.m_trees.m_buffer[l].m_flags != 0)
                {
                    treeManager.ReleaseTree((uint)l);
                }
            }
        }
 private void Awake()
 {
     Instance = this;
 }
Exemple #25
0
    void Start()
    {
        Debug.Log("开始初始化参数");
        propManager   = GetComponent <PropManager>();
        heroManager   = GetComponent <HeroManager>();
        bulletManager = GetComponent <BulletManager>();
        Debug.Log(Application.dataPath);
        string str = File.ReadAllText(Application.streamingAssetsPath + "/JobTest.txt");

        /*TextAsset txt = Resources.Load("JobTest") as TextAsset;
         * string[] s = txt.text.Split(' ');*/
        string[] s = str.Split(' ');
        port     = (ushort)float.Parse(s[0]);
        teamId   = (int)float.Parse(s[1]);
        playerId = (int)float.Parse(s[2]);
        jobN     = (int)float.Parse(s[3]);
        // TO DO:初始化通信
        messageToServer         = new MessageToServer();
        csharpClient            = new CSharpClient();
        csharpClient.OnReceive += delegate()
        {
            //Debug.Log("Message Received.");
            if (csharpClient.TryTake(out IMsg iMsg))
            {
                switch (iMsg.PacketType)
                {
                case PacketType.MessageToClient:
                {
                    MessageToClient msg = iMsg.Content as MessageToClient;
                    //Debug.Log("msg received");
                    switch (msg.MessageType)
                    {
                    case MessageType.StartGame:
                        GameStart(msg); break;

                    case MessageType.Gaming:
                        Refresh(msg); break;

                    case MessageType.EndGame:
                        GameOver(); break;

                    default: break;
                    }
                    break;
                }

                case PacketType.MessageToOneClient:
                {
                    MessageToOneClient msg = iMsg.Content as MessageToOneClient;
                    //Debug.Log("msg received");
                    switch (msg.MessageType)
                    {
                    case MessageType.ValidPlayer:
                        Debug.Log("Info Valid");
                        break;

                    case MessageType.InvalidPlayer:
                        Debug.Log("Info Invalid");
                        break;

                    case MessageType.Send:
                        Debug.Log("Info Send");
                        break;

                    default: break;
                    }
                    break;
                }

                default: break;
                }
            }
            else
            {
                Debug.Log("Failed to pop a message");
            }
        };
        if (csharpClient.Connect("127.0.0.1", port))
        {
            Debug.Log("成功连接Agent.");
        }
        else
        {
            Debug.Log("连接Agent失败.");
            Application.Quit();
        }
        messageToServer.MessageType = MessageType.AddPlayer;
        messageToServer.TeamID      = teamId;
        messageToServer.PlayerID    = playerId;
        switch (jobN)
        {
        case 0: messageToServer.JobType = JobType.Job0; break;

        case 1: messageToServer.JobType = JobType.Job1; break;

        case 2: messageToServer.JobType = JobType.Job2; break;

        case 3: messageToServer.JobType = JobType.Job3; break;

        case 4: messageToServer.JobType = JobType.Job4; break;

        case 5: messageToServer.JobType = JobType.Job5; break;

        case 6: messageToServer.JobType = JobType.Job6; break;
        }

        csharpClient.SendMessage(messageToServer);
        //WebClient
        heros                = new ConcurrentDictionary <long, HeroScript>();
        props                = new ConcurrentDictionary <long, PropScript>();
        bullets              = new ConcurrentDictionary <long, BulletScript>();
        isCharactersExisted  = new ConcurrentDictionary <long, bool>();
        isPropsExisted       = new ConcurrentDictionary <long, bool>();
        isBulletsExisted     = new ConcurrentDictionary <long, bool>();
        laidList             = new ConcurrentDictionary <long, bool>();
        TaskQueue            = new ConcurrentQueue <KeyValuePair <long, GameObjInfo> >();
        LaidQueue            = new ConcurrentQueue <GameObjInfo>();
        isReady              = false;
        myAngle              = 0;
        isNewMessageToServer = false;
        for (int i = 0; i < 50; i++)
        {
            for (int j = 0; j < 50; j++)
            {
                mapColor[i, j]  = 0;
                cellColor[i, j] = 0;
            }
        }
        Debug.Log("参数初始化完成");
    }
Exemple #26
0
 private void Awake()
 {
     lifePropPool  = new LinkedList <Props>();
     deathPropPool = new LinkedList <Props>();
     instance      = this;
 }
Exemple #27
0
        /// <summary>
        /// Populates the target list with a list of map trees or props.
        /// </summary>
        protected override void TargetList()
        {
            // List of prefabs that have passed filtering.
            List <PropListItem> itemList = new List <PropListItem>();

            // Local references.
            TreeManager treeManager = Singleton <TreeManager> .instance;

            TreeInstance[] trees       = treeManager.m_trees.m_buffer;
            PropManager    propManager = Singleton <PropManager> .instance;

            PropInstance[] props = propManager.m_props.m_buffer;

            // Iterate through each tree instance map.
            for (int index = 0; index < (IsTree ? trees.Length : props.Length); ++index)
            {
                // Create new list item, hiding probabilities.
                PropListItem propListItem = new PropListItem {
                    showProbs = false
                };

                if (IsTree)
                {
                    // Local reference.
                    TreeInstance tree = trees[index];

                    // Skip non-existent trees (those with no flags).
                    if (tree.m_flags == (ushort)TreeInstance.Flags.None)
                    {
                        continue;
                    }

                    // Try to get any tree replacement.
                    propListItem.originalPrefab = MapTreeReplacement.instance.GetOriginal(tree.Info);

                    // DId we find a current replacment?
                    if (propListItem.originalPrefab == null)
                    {
                        // No - set current item as the original tree.
                        propListItem.originalPrefab = tree.Info;
                    }
                    else
                    {
                        // Yes - record current item as replacement.
                        propListItem.replacementPrefab = tree.Info;
                    }
                }
                else
                {
                    // Props.
                    PropInstance prop = props[index];

                    // Skip non-existent props (those with no flags).
                    if (prop.m_flags == (ushort)PropInstance.Flags.None)
                    {
                        continue;
                    }

                    // Try to get any prop replacement.
                    propListItem.originalPrefab = MapPropReplacement.instance.GetOriginal(prop.Info);

                    // DId we find a current replacment?
                    if (propListItem.originalPrefab == null)
                    {
                        // No - set current item as the original prop.
                        propListItem.originalPrefab = prop.Info;
                    }
                    else
                    {
                        // Yes - record current item as replacement.
                        propListItem.replacementPrefab = prop.Info;
                    }
                }

                // Check to see if we were succesful - if not (e.g. we only want trees and this is a prop), continue on to next instance.
                if (propListItem.originalPrefab?.name == null)
                {
                    continue;
                }

                // Map instances are always grouped, and we don't have lists of indexes - too many trees!
                propListItem.index = -1;

                // Are we grouping?
                if (propListItem.index == -1)
                {
                    // Yes, grouping - initialise a flag to show if we've matched.
                    bool matched = false;

                    // Iterate through each item in our existing list of props.
                    foreach (PropListItem item in itemList)
                    {
                        // Check to see if we already have this in the list - matching original prefab.
                        if (item.originalPrefab == propListItem.originalPrefab)
                        {
                            // We've already got an identical grouped instance of this item - set the flag to indicate that we've match it.
                            matched = true;

                            // No point going any further through the list, since we've already found our match.
                            break;
                        }
                    }

                    // Did we get a match?
                    if (matched)
                    {
                        // Yes - continue on to next tree (without adding this item separately to the list).
                        continue;
                    }
                }

                // Add this item to our list.
                itemList.Add(propListItem);
            }

            // Create return fastlist from our filtered list, ordering by name.
            targetList.m_rowsData = new FastList <object>
            {
                m_buffer = targetSearchStatus == (int)OrderBy.NameDescending ? itemList.OrderByDescending(item => item.DisplayName).ToArray() : itemList.OrderBy(item => item.DisplayName).ToArray(),
                m_size   = itemList.Count
            };
            targetList.Refresh();

            // If the list is empty, show the 'no props' label; otherwise, hide it.
            if (targetList.m_rowsData.m_size == 0)
            {
                noPropsLabel.Show();
            }
            else
            {
                noPropsLabel.Hide();
            }
        }
Exemple #28
0
    // Nathan wrote this
    // loads the road from a binary file
    public void loadRoad(string filename)
    {
        UIManager.Instance.closeCurrentUI();
        // steps:
        //      1. clear the contents of the road
        //      2. obtain the saved road data
        //      3. insert each saved lane into the road:
        //          a. obtain the saved lane's type
        //          b. find that lane type and insert it
        //          c. obtain a reference to the lane's script
        //          d. adjust the lane's stripes if it's not a vehicle lane
        //          e. load the rest of the attributes
        //          f. load the lanes props (if not a vehicle lane)
        //      4. load the saved environment
        //      5. load the saved fog settings
        //      6. load the saved lighting settings

        // 1. we have to clear whatever else the user has loaded in since the last save
        clearRoad();
        // 2. obtain the saved data
        RoadData        roadData   = RoadVizSaveSystem.loadRoadFromMemory(filename);
        List <LaneData> savedLanes = roadData.loadLaneData();
        // 3. load each of the saved lanes in
        GameObject currLane = null;

        foreach (LaneData savedLane in savedLanes)
        {
            // 3a: obtain the lane's type
            string loadedLaneType = savedLane.loadLaneType();
            // 3b. find the type and insert it
            GameObject loadedLane = findLaneType(loadedLaneType);
            insertLane(currLane, loadedLane, "right");
            currLane = roadLanes.Last.Value;
            // 3c. obtain a script reference
            BasicLane loadedLaneScriptReference = (BasicLane)currLane.GetComponent("BasicLane");
            // 3d. adjust stripes
            if (!loadedLaneScriptReference.isVehicleLane())
            {
                LinkedListNode <GameObject> loadedLaneNode = roadLanes.Last;
                handleNonVehicleLaneStripes(loadedLaneScriptReference, loadedLaneNode);
            }
            // 3e. load the rest of the lane's variables
            loadedLaneScriptReference.loadLaneAtts(savedLane);

            // 3f. load the lanes props (if not a vehicle lane)
            if (!loadedLaneScriptReference.isVehicleLane())
            {
                PropManager loadedPropManagerRef = currLane.GetComponent <PropManager>();
                loadedPropManagerRef.loadProps(savedLane.loadPropManagerData());
            }
        }
        // 4. load the saved buildings
        Buildings buildingsScriptReference = (Buildings)buildingsReference.GetComponent("Buildings");

        buildingsScriptReference.setBuildingType(roadData.loadBuildingsIndex());
        StartCoroutine(FrameDelayBuildingUpdate());
        // 5. load the saved fog settings
        FogControl fogControlScriptReference = (FogControl)fogController.GetComponent("FogControl");

        fogControlScriptReference.setFogDistance(roadData.loadFogDistance());
        // 6. load the saved lighting settings
        float[]             lightIntensities = roadData.loadLightIntensities();
        BrightnessControl[] lightScripts     = getLights();
        for (int i = 0; i < lightScripts.Length; i++)
        {
            lightScripts[i].setBrightness(lightIntensities[i]);
        }
    }
        public static void SaveProps(BuildingInfo info, ushort buildingID, ref Building data)
        {
            FastList <BuildingInfo.Prop> fastList = new FastList <BuildingInfo.Prop>();
            Vector3    pos       = data.m_position;
            Quaternion q         = Quaternion.AngleAxis(data.m_angle * 57.29578f, Vector3.down);
            Matrix4x4  matrix4x4 = new Matrix4x4();

            matrix4x4.SetTRS(pos, q, Vector3.one);
            matrix4x4 = matrix4x4.inverse;
            //begin mod
            Quaternion q_1         = Quaternion.AngleAxis(data.m_angle * 57.29578f, Vector3.down);
            Matrix4x4  matrix4x4_1 = new Matrix4x4();

            matrix4x4_1.SetTRS(pos, q_1, Vector3.one);
            matrix4x4_1 = matrix4x4_1.inverse;
            PropManager instance1                  = Singleton <PropManager> .instance;
            var         specialPoints              = CollectSpecialPoints();
            var         depotAI                    = info.m_buildingAI as DepotAI;
            var         cargoStationAI             = info.m_buildingAI as CargoStationAI;
            var         fishingHarborAI            = info.m_buildingAI as FishingHarborAI;
            List <DepotAI.SpawnPoint> spawnPoints  = new List <DepotAI.SpawnPoint>();
            List <DepotAI.SpawnPoint> spawnPoints2 = new List <DepotAI.SpawnPoint>();
            Vector3 unspawnPosition                = Vector3.zero;
            Vector3 unspawnTarget                  = Vector3.zero;

            Vector3 truckSpawnPosition   = Vector3.zero;
            Vector3 truckUnspawnPosition = Vector3.zero;


            for (ushort index = 0; index < ushort.MaxValue; ++index)
            {
                if (((int)instance1.m_props.m_buffer[index].m_flags & 67) == 1)
                {
                    if (specialPoints.ContainsKey(index))
                    {
                        if (depotAI != null || cargoStationAI != null || fishingHarborAI != null)
                        {
                            var position       = instance1.m_props.m_buffer[index].Position;
                            var globalPosition = matrix4x4_1.MultiplyPoint(position);
                            switch (specialPoints[index])
                            {
                            case SpecialPointType.SpawnPointPosition:
                            {
                                var calculatedPositionGlobalPosition =
                                    FindClosestPositionPoint(specialPoints, SpecialPointType.SpawnPointTarget, instance1, position, globalPosition, matrix4x4_1);
                                spawnPoints.Add(new DepotAI.SpawnPoint()
                                    {
                                        m_position = globalPosition.MirrorZ(),
                                        m_target   = calculatedPositionGlobalPosition.MirrorZ(),
                                    });
                                break;
                            }

                            case SpecialPointType.SpawnPoint2Position:
                            {
                                if (depotAI != null || cargoStationAI != null)
                                {
                                    var calculatedPositionGlobalPosition =
                                        FindClosestPositionPoint(specialPoints, SpecialPointType.SpawnPoint2Target, instance1, position, globalPosition, matrix4x4_1);
                                    spawnPoints2.Add(new DepotAI.SpawnPoint()
                                        {
                                            m_position = globalPosition.MirrorZ(),
                                            m_target   = calculatedPositionGlobalPosition.MirrorZ(),
                                        });
                                }
                                break;
                            }

                            case SpecialPointType.DespawnPointPosition:
                            {
                                if (fishingHarborAI != null)
                                {
                                    unspawnPosition = globalPosition.MirrorZ();
                                }
                                break;
                            }

                            case SpecialPointType.DespawnPointTarget:
                            {
                                if (fishingHarborAI != null)
                                {
                                    unspawnTarget = globalPosition.MirrorZ();
                                }
                                break;
                            }

                            case SpecialPointType.TruckSpawnPosition:
                            {
                                if (cargoStationAI != null)
                                {
                                    truckSpawnPosition = globalPosition.MirrorZ();
                                }
                                break;
                            }

                            case SpecialPointType.TruckDespawnPosition:
                            {
                                if (cargoStationAI != null)
                                {
                                    truckUnspawnPosition = globalPosition.MirrorZ();
                                }
                                break;
                            }

                            default:
                                continue;     //ignored
                            }
                        }
                        continue;
                    }
                    //end mod
                    BuildingInfo.Prop prop = new BuildingInfo.Prop();
                    prop.m_prop        = instance1.m_props.m_buffer[index].Info;
                    prop.m_finalProp   = prop.m_prop;
                    prop.m_position    = matrix4x4.MultiplyPoint(instance1.m_props.m_buffer[index].Position);
                    prop.m_radAngle    = instance1.m_props.m_buffer[index].Angle - data.m_angle;
                    prop.m_angle       = 57.29578f * prop.m_radAngle;
                    prop.m_fixedHeight = instance1.m_props.m_buffer[index].FixedHeight;
                    //begin mod
                    var flag = false;
                    foreach (var mProp in info.m_props ?? new BuildingInfo.Prop[] {})
                    {
                        if (mProp.m_prop != prop.m_prop || Vector3.Distance(mProp.m_position, prop.m_position) > 0.01)
                        {
                            continue;
                        }
                        prop.m_probability = mProp.m_probability;
                        flag = true;
                        Debug.Log($"Setting probability of {prop.m_prop.name} to {prop.m_probability}");
                        break;
                    }
                    if (!flag)
                    {
                        prop.m_probability = 100;
                    }
                    //end mod
                    fastList.Add(prop);
                }
            }
            //begin mod
            if (depotAI != null)
            {
                if (OptionsWrapper <Options> .Options.PreciseSpecialPointsPostions)
                {
                    var ai = (DepotAI)((BuildingInfo)ToolsModifierControl.toolController.m_editPrefabInfo).m_buildingAI;
                    depotAI.m_spawnPoints    = ai.m_spawnPoints;
                    depotAI.m_spawnPosition  = ai.m_spawnPosition;
                    depotAI.m_spawnTarget    = ai.m_spawnTarget;
                    depotAI.m_spawnPoints2   = ai.m_spawnPoints2;
                    depotAI.m_spawnPosition2 = ai.m_spawnPosition2;
                    depotAI.m_spawnTarget2   = ai.m_spawnTarget2;
                }
                else
                {
                    if (depotAI.m_transportInfo != null)
                    {
                        if (spawnPoints.Count == 1)
                        {
                            depotAI.m_spawnPosition = spawnPoints[0].m_position;
                            depotAI.m_spawnTarget   = spawnPoints[0].m_target;
                            depotAI.m_spawnPoints   = new DepotAI.SpawnPoint[] { };
                        }
                        else if (spawnPoints.Count > 1)
                        {
                            depotAI.m_spawnPosition = Vector3.zero;
                            depotAI.m_spawnTarget   = Vector3.zero;
                            depotAI.m_spawnPoints   = spawnPoints.ToArray();
                        }
                        else
                        {
                            depotAI.m_spawnPosition = Vector3.zero;
                            depotAI.m_spawnTarget   = Vector3.zero;
                            depotAI.m_spawnPoints   = new DepotAI.SpawnPoint[] { };
                        }
                    }
                    else
                    {
                        depotAI.m_spawnPosition = Vector3.zero;
                        depotAI.m_spawnTarget   = Vector3.zero;
                        depotAI.m_spawnPoints   = new DepotAI.SpawnPoint[] { };
                    }

                    if (depotAI.m_secondaryTransportInfo != null)
                    {
                        if (spawnPoints2.Count == 1)
                        {
                            depotAI.m_spawnPosition2 = spawnPoints2[0].m_position;
                            depotAI.m_spawnTarget2   = spawnPoints2[0].m_target;
                            depotAI.m_spawnPoints2   = new DepotAI.SpawnPoint[] { };
                        }
                        else if (spawnPoints2.Count > 1)
                        {
                            depotAI.m_spawnPosition2 = Vector3.zero;
                            depotAI.m_spawnTarget2   = Vector3.zero;
                            depotAI.m_spawnPoints2   = spawnPoints2.ToArray();
                        }
                        else
                        {
                            depotAI.m_spawnPosition2 = Vector3.zero;
                            depotAI.m_spawnTarget2   = Vector3.zero;
                            depotAI.m_spawnPoints2   = new DepotAI.SpawnPoint[] { };
                        }
                    }
                    else
                    {
                        depotAI.m_spawnPosition2 = Vector3.zero;
                        depotAI.m_spawnTarget2   = Vector3.zero;
                        depotAI.m_spawnPoints2   = new DepotAI.SpawnPoint[] { };
                    }
                }
            }
            if (cargoStationAI != null)
            {
                if (OptionsWrapper <Options> .Options.PreciseSpecialPointsPostions)
                {
                    var ai = (CargoStationAI)((BuildingInfo)ToolsModifierControl.toolController.m_editPrefabInfo).m_buildingAI;
                    cargoStationAI.m_spawnPosition        = ai.m_spawnPosition;
                    cargoStationAI.m_spawnTarget          = ai.m_spawnTarget;
                    cargoStationAI.m_spawnPosition2       = ai.m_spawnPosition2;
                    cargoStationAI.m_spawnTarget2         = ai.m_spawnTarget2;
                    cargoStationAI.m_truckSpawnPosition   = ai.m_truckSpawnPosition;
                    cargoStationAI.m_truckUnspawnPosition = ai.m_truckUnspawnPosition;
                }
                else
                {
                    if (cargoStationAI.m_transportInfo != null)
                    {
                        if (spawnPoints.Count == 1)
                        {
                            cargoStationAI.m_spawnPosition = spawnPoints[0].m_position;
                            cargoStationAI.m_spawnTarget   = spawnPoints[0].m_target;
                        }
                        else if (spawnPoints.Count == 0)
                        {
                            cargoStationAI.m_spawnPosition = Vector3.zero;
                            cargoStationAI.m_spawnTarget   = Vector3.zero;
                        }
                        else
                        {
                            UnityEngine.Debug.LogError("Too many spawn points 1!");
                        }
                    }
                    else
                    {
                        cargoStationAI.m_spawnPosition = Vector3.zero;
                        cargoStationAI.m_spawnTarget   = Vector3.zero;
                    }

                    if (cargoStationAI.m_transportInfo2 != null)
                    {
                        if (spawnPoints2.Count == 1)
                        {
                            cargoStationAI.m_spawnPosition2 = spawnPoints2[0].m_position;
                            cargoStationAI.m_spawnTarget2   = spawnPoints2[0].m_target;
                        }
                        else if (spawnPoints2.Count == 0)
                        {
                            cargoStationAI.m_spawnPosition2 = Vector3.zero;
                            cargoStationAI.m_spawnTarget2   = Vector3.zero;
                        }
                        else
                        {
                            UnityEngine.Debug.LogError("Too many spawn points 2!");
                        }
                    }
                    else
                    {
                        cargoStationAI.m_spawnPosition2 = Vector3.zero;
                        cargoStationAI.m_spawnTarget2   = Vector3.zero;
                    }
                    cargoStationAI.m_truckSpawnPosition   = truckSpawnPosition;
                    cargoStationAI.m_truckUnspawnPosition = truckUnspawnPosition;
                }
            }

            if (fishingHarborAI != null)
            {
                if (OptionsWrapper <Options> .Options.PreciseSpecialPointsPostions)
                {
                    var ai = (FishingHarborAI)((BuildingInfo)ToolsModifierControl.toolController.m_editPrefabInfo).m_buildingAI;
                    fishingHarborAI.m_boatSpawnPosition   = ai.m_boatSpawnPosition;
                    fishingHarborAI.m_boatSpawnTarget     = ai.m_boatSpawnTarget;
                    fishingHarborAI.m_boatUnspawnPosition = ai.m_boatUnspawnPosition;
                    fishingHarborAI.m_boatUnspawnTarget   = ai.m_boatUnspawnTarget;
                }
                else
                {
                    if (spawnPoints.Count == 1)
                    {
                        fishingHarborAI.m_boatSpawnPosition = spawnPoints[0].m_position;
                        fishingHarborAI.m_boatSpawnTarget   = spawnPoints[0].m_target;
                    }
                    else if (spawnPoints.Count == 0)
                    {
                        fishingHarborAI.m_boatSpawnPosition   = Vector3.zero;
                        fishingHarborAI.m_boatUnspawnPosition = Vector3.zero;
                    }
                    else
                    {
                        UnityEngine.Debug.LogError("Can be only 1 spawn point!");
                    }
                    fishingHarborAI.m_boatUnspawnPosition = unspawnPosition;
                    fishingHarborAI.m_boatUnspawnTarget   = unspawnTarget;
                }
            }
            //end mod
            TreeManager instance2 = Singleton <TreeManager> .instance;

            for (int index = 0; index < instance2.m_trees.m_buffer.Length; ++index)
            {
                if (((int)instance2.m_trees.m_buffer[index].m_flags & 3) == 1 && instance2.m_trees.m_buffer[index].GrowState != 0)
                {
                    BuildingInfo.Prop prop = new BuildingInfo.Prop();
                    prop.m_tree        = instance2.m_trees.m_buffer[index].Info;
                    prop.m_finalTree   = prop.m_tree;
                    prop.m_position    = matrix4x4.MultiplyPoint(instance2.m_trees.m_buffer[index].Position);
                    prop.m_fixedHeight = instance2.m_trees.m_buffer[index].FixedHeight;
                    //begin mod
                    var flag = false;
                    foreach (var mProp in info.m_props ?? new BuildingInfo.Prop[] {})
                    {
                        if (mProp.m_tree != prop.m_tree || Vector3.Distance(mProp.m_position, prop.m_position) > 0.01)
                        {
                            continue;
                        }
                        prop.m_probability = mProp.m_probability;
                        flag = true;
                        Debug.Log($"Setting probability of {prop.m_tree.name} to {prop.m_probability}");
                        break;
                    }
                    if (!flag)
                    {
                        prop.m_probability = 100;
                    }
                    //end mod
                    fastList.Add(prop);
                }
            }
            info.m_props = fastList.ToArray();
        }
 public static void Init()
 {
     currentPC          = null;
     currentPM          = null;
     currentPropManager = null;
 }