Esempio n. 1
0
    void Start()
    {
        base.Start();

        TSpriteRenderer = Instantiate(TSpriteRenderer).GetComponent <SpriteRenderer>();
        TSpriteRenderer.gameObject.transform.SetParent(this.transform, false);
        if (isServer)
        {
            if (RelatedInterface == null)
            {
                RelatedInterface = this.gameObject.GetComponent <IConstructionHandler>();
            }
            if (registerObject == null)
            {
                registerObject = this.gameObject.GetComponent <RegisterObject>();
            }

            if (PrefabCircuitBoard != null && CircuitBoard == null)
            {
                CircuitBoard = PoolManager.PoolNetworkInstantiate(PrefabCircuitBoard, this.transform.position, parent: this.transform.parent);
                if (CircuitBoard != null)
                {
                    CustomNetTransform netTransform = CircuitBoard.GetComponent <CustomNetTransform>();
                    netTransform.DisappearFromWorldServer();
                }
            }
            ListChance = Enumerable.Range(1, 100).ToList();
            int c = 0;
            foreach (var Stage in ConstructionStages)
            {
                foreach (var TOStageAdvance in Stage.StageAdvances)
                {
                    Stage.ToolStage[TOStageAdvance.RequiredTool] = TOStageAdvance;
                }


                GenerateStage(Stage, c);

                if (!ContainedObjects.ContainsKey(c))
                {
                    ContainedObjects[c] = new List <ComponentData>();
                }
                c++;
            }

            GoToStage(CurrentStage);
        }
        else
        {
            foreach (var Stage in ConstructionStages)
            {
                foreach (var TOStageAdvance in Stage.StageAdvances)
                {
                    Stage.ToolStage[TOStageAdvance.RequiredTool] = TOStageAdvance;
                }
            }
        }
    }