public StarConnectionAppearer(StarConnection conn, sceneAppearInfo[] sceneToPrefab, StarConnectionState connectionState) : base(sceneToPrefab, connectionState.appearableState)
 {
     this.preAppear       = preAppearFunc;
     this.postAppear      = postAppearFunc;
     this.connectionState = connectionState;
     this.conn            = conn;
 }
Exemple #2
0
        private StarConnection _makeConnection(StarNode nodeInstance, StarConnectionState state)
        {
            StarConnection conn;
            var            obj = GameManager.instance.objectTable.get(state.id);

            if (obj == null)
            {
                conn       = nodeInstance.gameObject.AddComponent <StarConnection>();
                conn.state = state;
                state.appearableState.appearTransform = nodeInstance.state.positionState.appearTransform;
                var infos = new sceneAppearInfo[_sceneToPrefab.Length];
                for (var i = 0; i < _sceneToPrefab.Length; i++)
                {
                    infos[i] = new sceneAppearInfo(_sceneToPrefab[i]);
                }
                GameManager.idMaker.insertObject(conn, state.id);

                var renderer = new StarConnectionAppearer(conn, infos, state);
                conn.Init(state, renderer);
            }
            else
            {
                conn = (StarConnection)obj;
            }

            return(conn);
        }
Exemple #3
0
        private StarConnection _makeConnection(StarNode nodeInstance, Reference <StarNode> referencedStarNode)
        {
            var state = new StarConnectionState()
            {
                appearableState = new State.AppearablePositionState(
                    appearTransform: nodeInstance.appearer.state.appearTransform,
                    position: new Vector3(-99999, -99999, -99999),
                    star: null
                    ),
                strength = Random.Range(.01f, .99f),
                nodes    = new Reference <StarNode>[] { (Reference <StarNode>)nodeInstance, referencedStarNode },
            };
            var infos = new sceneAppearInfo[_sceneToPrefab.Length];

            for (var i = 0; i < _sceneToPrefab.Length; i++)
            {
                infos[i] = new sceneAppearInfo(_sceneToPrefab[i]);
            }
            var conn = nodeInstance.gameObject.AddComponent <StarConnection>();

            state.id = GameManager.idMaker.newId(conn);

            var renderer = new StarConnectionAppearer(conn, infos, state);

            conn.Init(state, renderer);
            return(conn);
        }
Exemple #4
0
 public void Init(StarConnectionState state, StarConnectionAppearer renderer)
 {
     appearer   = renderer;
     this.state = state;
 }