示例#1
0
        public void ShowContents(StageOption option)
        {
            var factory = new ContentsCounterFactory();

            foreach (Transform tf in _contents)
            {
                Destroy(tf.gameObject);
            }
            foreach (var contents in CountContents <EnemyData>(option.SpawnTable))
            {
                var node    = factory.Create();
                var counter = node.GetComponent <ContentsCounter>();
                node.transform.SetParent(_contents);
                node.transform.localScale = Vector3.one;
                counter.Init(contents.Key, contents.Value, true);
            }
            if (0 < option.PickPoint)
            {
                var node    = factory.Create();
                var counter = node.GetComponent <ContentsCounter>();
                node.transform.SetParent(_contents);
                node.transform.localScale = Vector3.one;
                counter.Init(new Pick().Image, option.PickPoint, true);
            }
            if (0 < option.Stair)
            {
                var node    = factory.Create();
                var counter = node.GetComponent <ContentsCounter>();
                node.transform.SetParent(_contents);
                node.transform.localScale = Vector3.one;
                counter.Init(new Stair().Image, option.Stair, true);
            }
        }
示例#2
0
        public void ShowHints(IDictionary <Type, int> contentsMap)
        {
            var factory = new ContentsCounterFactory();

            foreach (var keyValuePair in contentsMap)
            {
                var obj             = factory.Create();
                var contentsCounter = obj.GetComponent <ContentsCounter>();
                var constructor     = keyValuePair.Key.GetConstructor(Type.EmptyTypes);
                var contents        = constructor.Invoke(null) as ITileContents;
                contentsCounter.Init(contents.Image, keyValuePair.Value, true, Color.white);
                obj.transform.SetParent(_hints);
                obj.transform.localScale = Vector3.one;
            }
        }