public void OnSpawnMover(DirectionAxis axis, ObjecTPoolType type, Identifier identifier)
    {
        int index = Random.Range(0, GameDesignManager.blockLevelSize);

        GameObject mover = ObjectPoolManager.Instance.FindPoolObjectItem(type);

        StartCoroutine(RoutineSetPosition(mover.transform, Vector3.zero, SetTargetPosition(axis.AxisToIndex(), index)));
        StartCoroutine(RoutineSetRotation(mover.transform, Quaternion.identity, SetTargetRotation(axis.AxisToIndex(), index, identifier)));
    }
    public void OnClickVertex(ObjecTPoolType type, DirectionAxis axis, Vector3 start)
    {
        int index          = Random.Range(0, GameDesignManager.blockLevelSize);
        int axisConversion = (axis.AxisToIndex() + 2) % 3;

        GameObject mover = ObjectPoolManager.Instance.FindPoolObjectItem(type);

        Vector3 end = SetTargetPosition(axisConversion, index);

        AudioManager.Instance.PlaySFXSound(SFXSoundType.MoverSpawn);
        StartCoroutine(RoutineSetParabola(mover.transform, start, end));
        StartCoroutine(RoutineSetRotation(mover.transform, Quaternion.identity, SetTargetRotation(axisConversion, index, Identifier.Positive)));
    }
    private GameObject GetFromObjectPool(List <GameObject> objectList, ObjecTPoolType type)
    {
        for (int i = 0; i < objectList.Count; i++)
        {
            if (!objectList[i].activeSelf)
            {
                objectList[i].SetActive(true);
                return(objectList[i]);
            }
        }
        GameObject newPoolItem = Instantiate(poolContainedList[type.PoolTypeToIndex()].itemPrefab);

        poolContainedList[type.PoolTypeToIndex()].PoolList.Add(newPoolItem);
        return(newPoolItem);
    }
Esempio n. 4
0
        public static int PoolTypeToIndex(this ObjecTPoolType particleType)
        {
            switch (particleType)
            {
            default:
                return(0);

            case ObjecTPoolType.SpawnLizard:
                return(1);

            case ObjecTPoolType.SpawnWolf:
                return(2);

            case ObjecTPoolType.SpawnCoin:
                return(3);
            }
        }
 public GameObject FindPoolObjectItem(ObjecTPoolType type)
 {
     return(GetFromObjectPool(poolContainedList[type.PoolTypeToIndex()].PoolList, type));
 }