示例#1
0
    public CtrlTarget generateTarget(DataTargetParam _param)
    {
        GameObject objTarget = PrefabManager.Instance.MakeObject("prefab/objTarget", gameObject);
        CtrlTarget script    = objTarget.GetComponent <CtrlTarget> ();

        script.initialize(_param.serial,
                          m_Config.ReadFloat("xmin"),
                          m_Config.ReadFloat("xmax"),
                          m_Config.ReadFloat("ymin"),
                          m_Config.ReadFloat("ymax"),
                          m_Config.ReadFloat("target_move_interval"));
        return(script);
    }
示例#2
0
    public int GetActiveNum()
    {
        int iNum = 0;

        foreach (CtrlTarget target in m_targetList)
        {
            DataTargetParam param = m_dataTarget.SelectOne(string.Format("serial = {0}", target.m_iSerial));
            if ((DataTargetParam.STATUS)param.status == DataTargetParam.STATUS.ACTIVE)
            {
                iNum += 1;
            }
        }
        return(iNum);
    }
示例#3
0
 public void AddTargetTail(int _iCount)
 {
     for (int i = 0; i < _iCount; i++)
     {
         int iSerial = m_targetList.Count + 1;
         // 一応確認はする
         DataTargetParam targetParam = m_dataTarget.SelectOne(string.Format("serial = {0}", iSerial));
         if (targetParam.serial == 0)
         {
             targetParam.serial       = iSerial;
             targetParam.status       = (int)DataTargetParam.STATUS.ACTIVE;
             targetParam.time_destroy = TimeManager.StrGetTime();
             m_dataTarget.list.Add(targetParam);
         }
         m_targetList.Add(generateTarget(targetParam));
     }
 }
示例#4
0
    public int AppearAll()
    {
        int    iRet         = 0;
        string rebuild_time = TimeManager.StrGetTime(m_iTargetInterval * -1);

        foreach (CtrlTarget script in m_targetList)
        {
            DataTargetParam param = m_dataTarget.SelectOne(string.Format("serial = {0}", script.m_iSerial));
            if (param.status == (int)DataTargetParam.STATUS.DESTROIED)
            {
                param.time_destroy = rebuild_time;
                param.status       = (int)DataTargetParam.STATUS.ACTIVE;
                script.SetActive();
                iRet += 1;
            }
        }
        if (0 < iRet)
        {
            m_dataTarget.Save(DataManager.Instance.FILENAME_TARGET_DATA);
        }
        return(iRet);
    }
示例#5
0
    public void initialize(int _iSerial, float _fRangeMinX, float _fRangeMaxX, float _fRangeMinY, float _fRangeMaxY, float _fMoveInterval)
    {
        m_iSerial = _iSerial;

        DataTargetParam param = ManagerTarget.Instance.m_dataTarget.SelectOne(string.Format("serial = {0}", m_iSerial));

        m_eStep = STEP.NONE;
        if (param.status == (int)DataTargetParam.STATUS.ACTIVE)
        {
            m_eStep = STEP.IDLE;
        }
        m_eStepPre = STEP.MAX;

        m_fRangeMinX    = _fRangeMinX;
        m_fRangeMaxX    = _fRangeMaxX;
        m_fRangeMinY    = _fRangeMinY;
        m_fRangeMaxY    = _fRangeMaxY;
        m_fMoveInterval = _fMoveInterval;

        myTransform.localPosition = getRandomPos(m_fRangeMinX, m_fRangeMaxX, m_fRangeMinY, m_fRangeMaxY);


        sprite = GetComponent <UI2DSprite> ();
    }
示例#6
0
    void Update()
    {
        bool bInit = false;

        if (m_eStepPre != m_eStep)
        {
            m_eStepPre = m_eStep;
            bInit      = true;
        }
        switch (m_eStep)
        {
        case STEP.IDLE:
            if (bInit)
            {
                foreach (CtrlTarget script in m_targetList)
                {
                    script.TriggerClear();
                }
            }
            foreach (CtrlTarget script in m_targetList)
            {
                DataTargetParam param          = m_dataTarget.SelectOne(string.Format("serial = {0}", script.m_iSerial));
                int             iCheckInterval = m_iTargetInterval;
                if (DataManager.Instance.kvs_data.HasKey(DataManager.Instance.KEY_TARGET_SPEEDUP_END))
                {
                    if (0 < TimeManager.Instance.GetDiffNow(DataManager.Instance.kvs_data.Read(DataManager.Instance.KEY_TARGET_SPEEDUP_END)).TotalSeconds)
                    {
                        iCheckInterval /= 10;
                    }
                }
                if (param.status == (int)DataTargetParam.STATUS.DESTROIED)
                {
                    TimeSpan span = TimeManager.Instance.GetDiff(param.time_destroy, TimeManager.StrGetTime());


                    if (iCheckInterval < span.TotalSeconds)
                    {
                        param.status = (int)DataTargetParam.STATUS.ACTIVE;
                        script.SetActive();
                        m_dataTarget.Save(DataManager.Instance.FILENAME_TARGET_DATA);
                    }
                    //span.TotalSeconds
                }
                else if (script.ButtonPushed)
                {
                    SoundHolder.Instance.Call(DataManager.Instance.SOUND_NAME_TARGETGET);
                    script.TriggerClear();
                    param.status       = (int)DataTargetParam.STATUS.DESTROIED;
                    param.time_destroy = TimeManager.StrGetTime();
                    script.SetDelete();
                    m_dataTarget.Save(DataManager.Instance.FILENAME_TARGET_DATA);
                    m_iGetTarget += 1;
                }
                else
                {
                }
            }
            break;

        case STEP.GENERATE_WAIT:
            break;

        case STEP.GENERATE:
            break;

        case STEP.MAX:
        default:
            break;
        }
    }