Пример #1
0
 void activeBoss(int index)
 {
     for (int i = 0; i < listBoss.Length; i++)
     {
         if (index == i)
         {
             UbhShotCtrl ubh = listBoss[i].GetComponent <UbhShotCtrl>();
             if (listBoss[i].enabled != true)
             {
                 listBoss[i].enabled = true;
                 ubh.enabled         = true;
                 ubh.StartShotRoutine();
             }
         }
         else
         {
             UbhShotCtrl ubh = listBoss[i].GetComponent <UbhShotCtrl>();
             if (listBoss[i].enabled != false)
             {
                 listBoss[i].GetComponent <PlaneDie>().Explosion();
                 listBoss[i].enabled = false;
                 ubh.StopShotRoutine();
                 ubh.enabled = false;
             }
         }
     }
 }
Пример #2
0
    /// <summary>
    /// startHP에 대해서 역순으로 정렬을 한 후 startHP값이 다를 경우에 phaseNumber를 1씩 증가시킨다.
    /// </summary>
    /// <param name="shotCtrl"></param>
    public static void SetPhaseNumber(UbhShotCtrl shotCtrl)
    {
        Dictionary <int, float> dic = new Dictionary <int, float>();

        for (int i = 0; i < shotCtrl._ShotList.Count; i++)
        {
            dic.Add(i, 100f - shotCtrl._ShotList[i].startHP);
        }

        List <KeyValuePair <int, float> > list = dic.OrderBy(ph => ph.Value).ToList();

        int phaseNumber = 1;

        for (int i = 0; i < list.Count; i++)
        {
            if (i > 0 && list[i].Value == list[i - 1].Value)
            {
                phaseNumber--;
            }

            shotCtrl._ShotList[list[i].Key].phaseNumber = phaseNumber;

            //Debug.Log(list[i] + " / " + phaseNumber);

            phaseNumber++;
        }
    }
Пример #3
0
 /// <summary>
 /// Add shot
 /// </summary>
 public void AddShot(UbhShotCtrl shotCtrl)
 {
     if (m_shotHashSet.Contains(shotCtrl))
     {
         return;
     }
     m_shotList.Add(shotCtrl);
     m_shotHashSet.Add(shotCtrl);
 }
Пример #4
0
 /// <summary>
 /// Remove shot
 /// </summary>
 public void RemoveShot(UbhShotCtrl shotCtrl)
 {
     if (m_shotHashSet.Contains(shotCtrl) == false)
     {
         return;
     }
     m_shotList.Remove(shotCtrl);
     m_shotHashSet.Remove(shotCtrl);
 }
Пример #5
0
    IEnumerator startShot()
    {
        yield return(new WaitForSeconds(1));

        UbhShotCtrl shotCtrl = GetComponent <UbhShotCtrl>();

        if (shotCtrl != null)
        {
            shotCtrl.StartShotRoutine();
        }
    }
Пример #6
0
    public override void Start()
    {
        m_count = 0;
        base.Start();
        Initialization(100, 300, gameObject.GetComponent <Animator>());

        if (!m_shotControl)
        {
            m_shotControl = GetComponent <UbhShotCtrl>();
        }
    }
Пример #7
0
 void Awake()
 {
     s_Instance = this;
     controller = GetComponent <CharacterController>();
     cam        = camMount.GetComponentInChildren <Camera>();
     anim       = GetComponentInChildren <Animator>();
     shot       = GetComponent <UbhShotCtrl>();
     mouseLook.Init(transform, camMount.transform);
     layermask = 1 << 8;
     layermask = ~layermask;
     ResetDash();
 }
Пример #8
0
 /// <summary>
 /// Update Shots
 /// </summary>
 public void UpdateShots(float deltaTime)
 {
     for (int i = m_shotList.Count - 1; i >= 0; i--)
     {
         UbhShotCtrl shotCtrl = m_shotList[i];
         if (shotCtrl == null)
         {
             m_shotList.Remove(shotCtrl);
             continue;
         }
         shotCtrl.UpdateShot(deltaTime);
     }
 }
Пример #9
0
    /// <summary>
    /// HP 백분율에 따라 페이즈를 추가한다.
    /// </summary>
    /// <param name="shotCtrl"></param>
    /// <param name="isActive"></param>
    /// <param name="currentPhase"></param>
    /// <param name="HPCurrent"></param>
    /// <param name="HPMaximum"></param>
    /// <param name="objectName"></param>
    /// <returns>HP 백분율.</returns>
    public static float PhaseUpdate(UbhShotCtrl shotCtrl, bool isActive, int currentPhase, float HPCurrent, float HPMaximum, string objectName = null)
    {
        bool showLogs = false;

        //if (showLogs) Debug.Log(objectName + " : " + CodeManager.GetMethodCall(true));

        float currentPercent = (HPCurrent / HPMaximum) * 100f;
        int   lastPhase      = 0;

        foreach (UbhShotCtrl.ShotInfo sh in shotCtrl._ShotList.OrderBy(ph => ph.phaseNumber).ToList())
        {
            if (currentPercent <= sh.startHP && currentPercent > sh.endHP)
            {
                if (!sh.activePhase)
                {
                    sh.activePhase = true;
                    currentPhase   = sh.phaseNumber;

                    //if (showLogs) Debug.Log(objectName + " / " + currentPhase + " / " + lastPhase + " / " + isActive);

                    if (lastPhase != currentPhase)
                    {
                        if (isActive)
                        {
                            if (objectName != null)
                            {
                                if (showLogs)
                                {
                                    Debug.Log(CodeManager.GetMethodName(true) + objectName + " Active Phase : " + currentPhase);
                                }
                            }

                            ChangePhase(shotCtrl);
                        }
                    }

                    lastPhase = currentPhase;
                }
            }
            else
            {
                if (sh.activePhase)
                {
                    sh.activePhase = false;
                }
            }
        }

        return(currentPercent);
    }
Пример #10
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        UbhShotCtrl script = target as UbhShotCtrl;

        script.m_loop = EditorGUILayout.Toggle("Loop", script.m_loop);

        script.m_FirstNotInLoop = EditorGUILayout.Toggle("First Not In Loop", script.m_FirstNotInLoop);

        if (script.m_FirstNotInLoop)
        {
            script.m_InitFristEleDelay = EditorGUILayout.FloatField("First Element Delay", script.m_InitFristEleDelay);
        }
    }
Пример #11
0
    IEnumerator StartShot()
    {
        float cntTimer = 0f;

        while (cntTimer < 1f)
        {
            cntTimer += UbhTimer.Instance.DeltaTime;
            yield return(0);
        }

        yield return(0);

        UbhShotCtrl shotCtrl = _GoShotCtrlList[_NowIndex].GetComponent <UbhShotCtrl>();

        if (shotCtrl != null)
        {
            shotCtrl.StartShotRoutine();
        }
    }
Пример #12
0
    private IEnumerator StartShot()
    {
        float cntTimer = 0f;

        while (cntTimer < 1f)
        {
            cntTimer += UbhTimer.instance.deltaTime;
            yield return(null);
        }

        yield return(null);

        UbhShotCtrl shotCtrl = m_goShotCtrlList[m_nowIndex].GetComponent <UbhShotCtrl>();

        if (shotCtrl != null)
        {
            shotCtrl.StartShotRoutine();
        }
    }
Пример #13
0
 void Awake()
 {
     shotCtrl = GetComponentInChildren <UbhShotCtrl>();
     SetSpawnTimer();
 }
Пример #14
0
 /// <summary>
 /// UbhShotCtrl setter.
 /// </summary>
 public void SetShotCtrl(UbhShotCtrl shotCtrl)
 {
     _ShotCtrl = shotCtrl;
 }
Пример #15
0
 void Awake()
 {
     shotCtrl = GetComponent <UbhShotCtrl>();
 }
Пример #16
0
 /// <summary>
 /// 샷 코루틴을 재실행.
 /// </summary>
 /// <param name="shotCtrl"></param>
 public static void ChangePhase(UbhShotCtrl shotCtrl)
 {
     shotCtrl.StopShotRoutine();
     shotCtrl.StartShotCoroutineIE();
 }
Пример #17
0
    void DrawProperties()
    {
        UbhShotCtrl obj = target as UbhShotCtrl;

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Start Shot Routine"))
        {
            if (Application.isPlaying && obj.gameObject.activeInHierarchy)
            {
                obj.StartShotRoutine();
            }
        }
        if (GUILayout.Button("Stop Shot Routine"))
        {
            if (Application.isPlaying && obj.gameObject.activeInHierarchy)
            {
                obj.StopShotRoutine();
            }
        }
        EditorGUILayout.EndHorizontal();

        Color guiColor = GUI.color;

        if (obj._ShotList == null || obj._ShotList.Count <= 0)
        {
            GUI.color = Color.yellow;
            EditorGUILayout.LabelField("*****WARNING*****");
            EditorGUILayout.LabelField("Size of ShotList is 0!");
            GUI.color = guiColor;
        }
        else
        {
            bool isShotErr = true;
            foreach (UbhShotCtrl.ShotInfo shotInfo in obj._ShotList)
            {
                if (shotInfo._ShotObj != null)
                {
                    isShotErr = false;
                    break;
                }
            }
            bool isDelayErr = true;
            foreach (UbhShotCtrl.ShotInfo shotInfo in obj._ShotList)
            {
                if (0f < shotInfo._AfterDelay)
                {
                    isDelayErr = false;
                    break;
                }
            }
            if (isShotErr || isDelayErr)
            {
                GUI.color = Color.yellow;
                EditorGUILayout.LabelField("*****WARNING*****");
                if (isShotErr)
                {
                    EditorGUILayout.LabelField("Some ShotObj of ShotList has not been set!");
                }
                if (isDelayErr)
                {
                    EditorGUILayout.LabelField("All AfterDelay of ShotList is zero!");
                }
                GUI.color = guiColor;
            }
        }

        EditorGUILayout.Space();

        DrawDefaultInspector();
    }
 private void Start()
 {
     //base.Initialize(0,"");
     m_shotControl    = GetComponent <UbhShotCtrl>();
     m_msBetweenShots = 6000;
 }