Exemplo n.º 1
0
 void Awake()
 {
     this.Group                = transform.FindChild("Group").gameObject.transform;
     this.SubjectPool          = transform.FindChild("SubjectPool").GetComponent <SimpleObjectPool> ();
     this.LeaderboardTitlePool = transform.FindChild("leaderboardTitlePool").GetComponent <SimpleObjectPool> ();
     this.LeaderboardUserPool  = transform.FindChild("leaderboardUserPool").GetComponent <SimpleObjectPool> ();
 }
Exemplo n.º 2
0
    public override void Awake()
    {
        base.Awake();

        boxCollider = gameObject.GetComponent <BoxCollider2D>();

        WeaponBackground = transform.Find("Case").gameObject;

        backGround = WeaponBackground.GetComponent <SpriteRenderer> ();

        RepairShowObject = GameObject.Find("RepairPanel").GetComponentInChildren <RepairObject>();

        weaponsSprite = WeaponBackground.transform.Find("WeaponSprite").GetComponent <SpriteRenderer>();

        ComplateScale = WeaponBackground.transform.Find("ComplateGaugeParent").GetComponent <Transform> ();

        goldTextPosition = GameObject.Find("Player").transform.Find("CriticalHitPosition").GetComponent <Transform> ();

        goldParent = GameObject.Find("RepairPanel").transform.Find("TextRespawnPoint").transform;

        showGoldPool = GameObject.Find("ShowGoldText").GetComponent <SimpleObjectPool> ();

        ComplateScale.localScale = new Vector3(1.0f, 0, 1.0f);

        cameraObj = GameObject.Find("Main Camera").GetComponent <Camera> ();

        playerController = GameObject.Find("PlayerRig").GetComponent <PlayerController> ();
    }
Exemplo n.º 3
0
        private static void SendToServer(string server, int port, IEnumerable <string> metrics, bool stream)
        {
            UdpMessenger messenger = null;
            SimpleObjectPool <UdpMessenger> serverPool = null;

            try
            {
                serverPool = _messengerPool.GetOrAdd(string.Format(CultureInfo.InvariantCulture, "{0}:{1}", server, port),
                                                     new SimpleObjectPool <UdpMessenger>(3, pool => new UdpMessenger(server, port)));
                messenger = serverPool.Pop();

                //all used up, sorry!
                if (null == messenger)
                {
                    return;
                }

                if (stream)
                {
                    messenger.StreamMetrics(metrics);
                }
                else
                {
                    messenger.SendMetrics(metrics);
                }
            }
            finally
            {
                if (null != serverPool && null != messenger)
                {
                    serverPool.Push(messenger);
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>Removes the current grid.</summary>
 public void RemoveGrid()
 {
     currentGridFile = null;
     if (grid != null && grid.Count > 0)
     {
         foreach (EditorList list in grid)
         {
             if (list != null)
             {
                 foreach (EditorTile space in list.list)
                 {
                     if (space != null)
                     {
                         SimpleObjectPool.Despawn(space.gridButton);
                         SimpleObjectPool.Despawn(space.gameObject);
                     }
                 }
             }
         }
         grid.Clear();
     }
     foreach (TeleporterColor color in teleportTiles.Keys)
     {
         teleportTiles[color].Clear();
     }
     removedTileButtons.Clear();
     enemySpawns.Clear();
     player = null;
 }
Exemplo n.º 5
0
 public BallFactory(SimpleObjectPool simpleObjectPool, GameObject ceiling, Vector2 offset, float spacing)
 {
     _simpleObjectPool = simpleObjectPool;
     _ceiling          = ceiling;
     _offset           = offset;
     _spacing          = spacing;
 }
 protected override void Start()
 {
     _iconPool = GetComponent <SimpleObjectPool>();
     DisplayLevels();
     GameManager.Instance.EventBus.Subscribe <SelectLevelEventArgs>(OnLevelSelected);
     ShowLevelBrowser();
 }
Exemplo n.º 7
0
        public static RectTransform NewUIGameObject(string name, GameObject parent = null)
        {
            SimpleObjectPool <GameObject> simpleObjectPool = new SimpleObjectPool <GameObject> (
                () => {
                GameObject clone        = new GameObject(name);
                RectTransform rect      = clone.OnAddComponent <RectTransform> ();
                rect.localScale         = Vector3.one;
                rect.anchoredPosition3D = Vector3.zero;
                if (parent != null)
                {
                    clone.transform.parent = parent.transform;
                }
                return(clone);
            },
                (GameObject g) => {
                Debug.Log(g.name);
                g.transform.parent = null;
                g.GetComponent <RectTransform> ().anchoredPosition = Vector3.zero;
                g.SetActive(false);
            },
                1);
            //从对象池中获取对象
            GameObject go = simpleObjectPool.Allocate();

            return(go.GetComponent <RectTransform> ());
        }
Exemplo n.º 8
0
        //这里的对象池无法回收
        public static GameObject NewGameObject(string name, GameObject parent = null)
        {
            SimpleObjectPool <GameObject> simpleObjectPool = new SimpleObjectPool <GameObject> (
                () => {
                GameObject clone = new GameObject(name);
                if (parent != null)
                {
                    clone.transform.parent     = parent.transform;
                    clone.transform.position   = Vector3.zero;
                    clone.transform.localScale = Vector3.one;
                    //Debug.Log ("GameObjectTool:" + clone.name + "创建成功");
                }
                return(clone);
            },
                (GameObject g) => {
                Debug.Log(g.name);
                g.transform.parent = null;
                g.GetComponent <RectTransform> ().anchoredPosition = Vector3.zero;
                g.SetActive(false);
            },
                1);
            //从对象池中获取对象
            GameObject go = simpleObjectPool.Allocate();

            return(go);
        }
Exemplo n.º 9
0
        protected override void OnInit()
        {
            eventPool = new SimpleObjectPool <GameEvent>(5);

            delayEventTaskInfo = new Dictionary <GameEvent, TimerTaskInfo>();
            eventHandlerDic    = new Dictionary <int, List <GameEventHandler> >();
        }
Exemplo n.º 10
0
 void InitializeObjectsPool()
 {
     objectsPool              = GetComponent <SimpleObjectPool>();
     objectsPool.prefab       = prefabBalls;
     objectsPool.bubbleHolder = bubbleHolder;
     objectsPool.InitializePool(100);  // Предустановка
 }
Exemplo n.º 11
0
    private void Start()
    {
        noteObjectPool = GameObject.Find("NotePool").GetComponent <SimpleObjectPool> ();

        animator = gameObject.GetComponent <Animator> ();
        noteObjectPool.PreloadPool();
        gameObject.SetActive(false);
    }
Exemplo n.º 12
0
    void Start()
    {
        battleManager = GameObject.Find("BattleManager").GetComponent <BattleManager> ();

        skillManager     = battleManager.skillManager;
        characterManager = battleManager.characterManager;
        objectPool       = battleManager.skillObjectPool;
    }
        protected override void Start()
        {
            var gameEventBus = GameManager.Instance.EventBus;

            gameEventBus.Subscribe <BallDestroyByGiantLaserEventArgs>(OnBallDestroyed);
            _simpleObjectPool             = GetComponent <SimpleObjectPool>();
            _floatingScoreEffectGenerator = FloatingScoreGenerator.GetComponent <FloatingScoreEffectGenerator>();
        }
Exemplo n.º 14
0
        /// <summary>	Initializes a new instance of the PooledSocketAsyncEventArgs class. </summary>
        /// <param name="parentPool">	The pool that owns this instance. </param>
        public PoolAwareSocketAsyncEventArgs(SimpleObjectPool <SocketAsyncEventArgs> parentPool)
        {
            if (null == parentPool)
            {
                throw new ArgumentNullException("parentPool");
            }

            _parentPool = parentPool;
        }
    public void UpdateOwningInfo(LDJam44FPSController newOwningPlayerController, SimpleObjectPool newOwningPool, int newDamageToCause)
    {
        owningPlayerController = newOwningPlayerController;
        owningPool             = newOwningPool;
        //owningPlayerID = newOwningPlayerID;
        damageToCause = newDamageToCause;

        currentLifetime = lifeTime;
    }
        /// <summary>	Initializes a new instance of the PooledSocketAsyncEventArgs class. </summary>
        /// <param name="parentPool">	The pool that owns this instance. </param>
        public PoolAwareSocketAsyncEventArgs(SimpleObjectPool<SocketAsyncEventArgs> parentPool)
        {
            if (null == parentPool)
            {
                throw new ArgumentNullException("parentPool");
            }

            _parentPool = parentPool;
        }
 // Use this for initialization
 void Awake()
 {
     _subTaskGroup        = transform.FindChild("Sub Task Group").gameObject;
     _subTaskList         = new List <GameObject> ();
     _pool                = _subTaskGroup.GetComponent <SimpleObjectPool> ();
     _taskTilteText       = transform.FindChild("Title").GetComponent <Text> ();
     _taskDescriptionText = transform.FindChild("Description").GetComponent <Text> ();
     _regularSlider       = transform.FindChild("Title Bar").transform.FindChild("Progress Slider").GetComponent <Slider> ();
     _bonusSlider         = transform.FindChild("Title Bar").transform.FindChild("Bonus Slider").GetComponent <Slider> ();
 }
Exemplo n.º 18
0
    private void Start()
    {
        noteObjectPool = GameObject.Find("NotePool").GetComponent <SimpleObjectPool> ();

        fXPos    = bossNoteRespawnPoint.position.x;
        fYPos    = bossNoteRespawnPoint.position.y;
        animator = gameObject.GetComponent <Animator> ();
        noteObjectPool.PreloadPool();
        gameObject.SetActive(false);
    }
Exemplo n.º 19
0
 void Awake()
 {
     this._pageSwapper     = GameObject.FindWithTag("Pageswapper").GetComponent <Pageswapper>();
     this.ButtonGroupPool  = transform.FindChild("ButtonGroupPool").GetComponent <SimpleObjectPool> ();
     this.MainButtonPool   = transform.FindChild("MainButtonPool").GetComponent <SimpleObjectPool> ();
     this.SubButtonPool    = transform.FindChild("SubButtonPool").GetComponent <SimpleObjectPool> ();
     this.SubMenuGroupPool = transform.FindChild("SubMenuGroupPool").GetComponent <SimpleObjectPool> ();
     this.group            = transform.FindChild("Group").transform;
     CreateStandardMenus();
 }
Exemplo n.º 20
0
    // Creates the subject gameobject and sets the title and adds the users in the leaderboard.
    public void Setup(SimpleObjectPool titleObjectPool, SimpleObjectPool userObjectPool, Leaderboard ldbSubObj)
    {
        this._titleObjectPool = titleObjectPool;
        this._userObjectPool  = userObjectPool;
        this._title           = ldbSubObj.Title;
        this._userList        = ldbSubObj.LeaderboardUsers;

        this.CreateTitle();
        this.InsertLeaderboardUsers();
    }
Exemplo n.º 21
0
        void Start()
        {
            var gameEventBus = GameManager.Instance.EventBus;

            gameEventBus.Subscribe <BallGridMatchArgs>(OnMatchFound);

            _simpleObjectPool                = GetComponent <SimpleObjectPool>();
            _floatingScoreEffectGenerator    = FloatingScoreGenerator.GetComponent <FloatingScoreEffectGenerator>();
            _powerGemParticleEffectGenerator = PowerGemEffectGenerator.GetComponent <PowerGemParticleEffectGenerator>();
        }
    public void Shoot(Transform weaponBarrelEnd, SimpleObjectPool bulletObjectPool)
    {
        this.bulletObjectPool = bulletObjectPool;
        gameObject.transform.SetParent(null);
        transform.position = weaponBarrelEnd.position;
        transform.rotation = weaponBarrelEnd.rotation;
        GetComponent <Rigidbody>().velocity = transform.forward * 25;

        StartCoroutine(WaitToReturnToObjectPool());
    }
 void Awake()
 {
     //Debug.Log ("im awake");
     this.ThisPage     = transform.gameObject;
     this.ContentPanel = transform.FindChild("Scroll View").FindChild("Viewport").FindChild("Content").transform;
     //Debug.Log ("this is the contentpanel" + this.ContentPanel);
     this.ButtonObjectPool     = transform.FindChild("ButtonObjectPool").gameObject.GetComponent <SimpleObjectPool>();
     this.AddTaskButton        = transform.FindChild("AddTasksButton").gameObject.GetComponent <AddTaskButtonScript> ();
     this.PageSwapperReference = GameObject.Find("Page Swapper").gameObject.GetComponent <Pageswapper> ();
 }
Exemplo n.º 24
0
    public override IEnumerator BasicBezierShoot(SimpleObjectPool _simpleObjectPool, SkillManager _skillManager, Character _AttackCharacter, Character _TargetCharacter, Vector3 _startPosition, bool _bIsCritical)
    {
        yield return(StartCoroutine(BezierCurve(_startPosition, _TargetCharacter.transform.position)));

        _skillManager.BasicAttack(_AttackCharacter, _TargetCharacter, _bIsCritical);

        _simpleObjectPool.ReturnObject(gameObject);

        yield break;
    }
Exemplo n.º 25
0
    public override IEnumerator ActiveBezierShoot(SimpleObjectPool _simpleObjectPool, Character _AttackCharacter, Vector3 _TargetCharacterPosition, int _nActiveSkillIndex, bool _bIsCritical)
    {
        yield return(StartCoroutine(BezierCurve(_AttackCharacter.transform.position, _TargetCharacterPosition)));

        _AttackCharacter.PlayActiveSkill(_nActiveSkillIndex, _bIsCritical);

        _simpleObjectPool.ReturnObject(gameObject);

        yield break;
    }
Exemplo n.º 26
0
    ///Summary
    ///Singleton function, only instantiate the object when it needs to
    ///Summary
    public SimpleObjectPool Instance()
    {
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(this);
        }

        return(instance);
    }
 protected void InitPool(int size1, GameObject prefab1, int size2 = 0, GameObject prefab2 = null)
 {
     mainpoollength   = size1;
     secendpoollength = size2;
     selfMainpool     = new SimpleObjectPool <GameObject> (() => Instantiate(prefab1), null, size1);
     if (size2 == 0)
     {
         return;
     }
     selfSecendpool = new SimpleObjectPool <GameObject>(() => Instantiate(prefab2), null, size2);
 }
Exemplo n.º 28
0
    private void Start()
    {
        skullObjectPool       = GameObject.Find("SkullPool").GetComponent <SimpleObjectPool> ();
        bossSkullRespawnPoint = GameObject.Find("BossSkullCreateArea2").GetComponent <RectTransform>();
        fXPos = bossSkullRespawnPoint.position.x;
        fYPos = bossSkullRespawnPoint.position.y;

        gameObject.SetActive(false);
        animator = gameObject.GetComponent <Animator> ();

        skullObjectPool.PreloadPool();
    }
Exemplo n.º 29
0
    public void StartNoteObjMove()
    {
        myRectTransform = GetComponent <RectTransform> ();
        fRandomX        = Random.Range(-0.5f, 0.5f);
        fRandomY        = Random.Range(-0.5f, 0.5f);

        randomDir = new Vector3(fRandomX, fRandomY, 0);
        randomDir.Normalize();
        note3ObjectPool = GameObject.Find("Note3Pool").GetComponent <SimpleObjectPool>();

        StartCoroutine(NoteObjMove());
    }
Exemplo n.º 30
0
    static private void Initialize()
    {
        instance = FindObjectOfType <SimpleObjectPool>();

        if (instance == null)
        {
            GameObject temp = new GameObject("SimpleObjectPool");
            instance = temp.AddComponent <SimpleObjectPool>();
        }

        instance.CreateStartUpPools();
    }
Exemplo n.º 31
0
    public void generateEnemy(Transform enemySpawn, SimpleObjectPool enemyCartucho, Transform playerPosition, generateEnemys generateEnemys)
    {
        this.generateEnemys = generateEnemys;
        var random = Random.Range(0, 4);

        this.playerPosition = playerPosition;
        this.enemyCartucho  = enemyCartucho;
        transform.SetParent(enemySpawn);
        transform.position = new Vector3(enemySpawn.position.x + random, enemySpawn.position.y + 1, enemySpawn.position.z + random);
        transform.rotation = enemySpawn.rotation;
        WaitToShootAgain();
    }