// Update is called once per frame
    void Update()
    {
        if (!GameManager.Instance.m_Main.IsAfterLoadingComplete)
        {
            return;
        }
        if (!m_Character)
        {
            return;
        }

        float RotX = VerticalFollowCamera.GetTransform().eulerAngles.x;

        Quaternion rot = Quaternion.Euler(RotX, 0.0f, 0.0f);
        Vector3    pos = m_Character.transform.position + new Vector3(0.0f, 0.5f, -1.0f);

        transform.SetPositionAndRotation(pos, rot);

        m_HpBar.localScale = new Vector3(Mathf.Clamp01(m_Character.m_Health / m_Character.m_MaxHealth), 1.0f, 1.0f);
        float deltatime = Time.deltaTime;

        m_UpdateTimer -= deltatime;
        if (m_UpdateTimer <= 0.0f)
        {
            m_UpdateTimer = m_UpdateDelay;
            BuffIconUpdate();
        }
    }
    // Use this for initialization
    void Start()
    {
        targetPos = transform.position;
        // Get the camera's default height
        defaultCameraDistance = transform.position.z;
        targetDistance        = defaultCameraDistance;

        // Set up as main game camera
        if (isMainGameCamera)
        {
            mainGameCamera = this;
        }
    }
Exemple #3
0
    public void Initialize(Main _Main, Object _CameraTarget)
    {
        DefaultInstance = this;

        _Main.m_Camera = this;
        m_Target       = _CameraTarget;

        m_LocalPositionX = m_Target.transform.position.x;
        Vector3 tpos     = m_Target.transform.position;
        Vector3 pos      = m_Camera.transform.position;
        Vector3 fixedpos = new Vector3(pos.x, tpos.y + m_LocalPositionY + m_AddDistanceX, tpos.z + m_LocalPositionZ + m_AddDistanceZ);

        m_Camera.transform.position = fixedpos;
        m_Camera.transform.forward  = m_Target.transform.position - fixedpos;
    }
    public override void AttackMomentEvent()
    {
        if (m_Live == E_LIVE.DEAD)
        {
            return;
        }
        base.AttackMomentEvent();

        if (m_AttackTarget == null)
        {
            return;
        }

        VerticalFollowCamera.CameraWave(Mathf.Clamp(1.0f / m_AttackSpeed * 0.5f, 0.0f, 0.3f));
        m_AttackTarget.m_Character.GiveToDamage(GetDamages(), this);
    }
    void GameSequenceEvent()
    {
        if (m_UpdateSequence)
        {
            return;
        }
        m_UpdateSequence = true;

        if (m_SequenceProgress[(int)m_GameSequence])
        {
            return;
        }

        float timer = TimerNet.GetTimer(m_SequenceTimerKey);

        if (timer > 0.0f)
        {
            return;
        }

        switch (m_GameSequence)
        {
        case E_GAMESEQUENCE.BEGINGAME:
        {
            SetNextGameSequence();
        }
        break;

        case E_GAMESEQUENCE.READY:
        {
            m_GameReadyCanvas.Run();
            SetNextGameSequence();
        }
        break;

        case E_GAMESEQUENCE.START:
        {
            if (m_GameReadyCanvas.IsComplete)
            {
                SetNextGameSequence();
            }
        }
        break;

        case E_GAMESEQUENCE.NORMALSTAGESTART:
        {
            m_SpawnManager.NormalMonsterSpawnStart();
            m_ControlCanvas.SetActive(true);
            m_SkillUICanvas.SetActive(true);
            m_GameUICanvas.TimeCheck(true);
            SetNextGameSequence();
        }
        break;

        case E_GAMESEQUENCE.NORMALSTAGE:
        {
            if (m_SpawnManager.IsAllNormalMonsterSpawnOperationsCompleted())
            {
                SetNextGameSequence(1.5f);
            }
        }
        break;

        case E_GAMESEQUENCE.NORMALSTAGE_END:
        {
            m_PianoEffect.CurtainClose();
            SetNextGameSequence(2.0f);
        }
        break;

        case E_GAMESEQUENCE.BOSSSTAGESTART:
        {
            m_PianoEffect.CurtainOpen();
            m_BossUICanvas.gameObject.SetActive(true);
            m_MyCharacter.transform.position = m_BossRoomStartPoint.position;
            m_MyCharacter.transform.rotation = Quaternion.identity;
            VerticalFollowCamera.SetDistanceSmooth(5.0f, 1.5f);
            SetNextGameSequence();
        }
        break;

        case E_GAMESEQUENCE.BOSSSTAGE:
        {
            m_SpawnManager.BossMonsterSpawnStart();
            SetNextGameSequence();
        }
        break;

        case E_GAMESEQUENCE.BOSSSTAGE_END:
        {
            if (m_SpawnManager.IsAllBossMonsterSpawnOperationsCompleted())
            {
                DeleteTeamAllUnits(E_TEAMTYPE.BLUE);
                DeleteTeamAllUnits(E_TEAMTYPE.GREEN);
                DeleteTeamAllUnits(E_TEAMTYPE.YELLOW);
                GameClearUIOpen();
                m_GameUICanvas.TimeCheck(false);
                SetNextGameSequence();
            }
        }
        break;

        case E_GAMESEQUENCE.AFTERGAME:
        {
            m_SequenceProgress[(int)m_GameSequence] = true;
        }
        break;

        default:
            break;
        }
    }
    IEnumerator C_Initialize()
    {
        WaitForSeconds wait = new WaitForSeconds(0.5f);

        if (GameManager.Instance.m_TestMode)
        {
            TestModeDefaultItemSetting list = Resources.Load <TestModeDefaultItemSetting>("TestModeDefaultItemList");
            list.SetTestDefaultItemInventory();

            TestModeServerConnect();
            while (!PhotonNetwork.InRoom)
            {
                yield return(null);
            }
        }

        NetworkManager.Instance.RoomController.SetLocalPlayerProperties(PlayerCharacter.m_CharacterReadyKey, false);
        NetworkManager.Instance.RoomController.SetLocalPlayerProperties("InitComp", false);

        yield return(wait);

        if (PhotonNetwork.IsMasterClient)
        {
            // timer set
            TimerNet.CreateDefaultTimer();
            TimerNet.InsertTimer(m_SequenceTimerKey, 0.0f, true);
        }

        yield return(wait);

        GameObject pianoUI = Instantiate(Resources.Load <GameObject>("PianoEffectCanvas"));

        m_PianoEffect = pianoUI.GetComponent <PianoEffectCanvas>();
        m_PianoEffect.Initialize();
        GameObject readyUI = Instantiate(Resources.Load <GameObject>("GameReadyCanvas"));

        m_GameReadyCanvas = readyUI.GetComponent <GameReadyCanvas>();
        m_ControlCanvas   = Instantiate(Resources.Load <GameObject>("ControlCanvas"));
        m_ControlCanvas.SetActive(false);
        GameObject gameUI = Instantiate(Resources.Load <GameObject>("GameUICanvas"));

        m_GameUICanvas = gameUI.GetComponent <GameUICanvas>();
        List <Item> droplist = new List <Item>();

        for (int i = 0; i < m_DropItemList.Length; ++i)
        {
            droplist.Add(m_DropItemList[i].m_Item);
        }
        m_GameUICanvas.Initialize(this, droplist);
        m_GameUICanvas.TimeCheck(false);
        gameUI.SetActive(false);
        m_SkillUICanvas = Instantiate(Resources.Load <GameObject>("SkillUICanvas"), Vector3.zero, Quaternion.identity);
        m_SkillUICanvas.SetActive(false);
        GameObject bossUI = Instantiate(Resources.Load <GameObject>("BossUICanvas"));

        m_BossUICanvas = bossUI.GetComponent <BossCharacterUI>();
        bossUI.SetActive(false);
        m_SpawnManager.Initialize();

        GameObject g = PhotonNetwork.Instantiate("PlayerCharacter", Vector3.zero, Quaternion.identity, 0, new object[] { -1, -1, -1, -1, -1, InventoryManager.Instance.GetPlayerModelName() });

        m_MyCharacter = g.GetComponent <PlayerCharacter>();
        m_MyCharacter.AddDeadEvent(MyCharacterDeadEvent);

        m_VerticalCamera = Instantiate(m_VerticalCamera, Vector3.zero, Quaternion.identity);
        VerticalFollowCamera verticalcamera = m_VerticalCamera.GetComponent <VerticalFollowCamera>();

        verticalcamera.Initialize(this, m_MyCharacter);
        m_VerticalCamera.SetActive(false);

        NetworkManager.Instance.RoomController.SetLocalPlayerProperties("InitComp", true);

        yield return(wait);

        while (!IsBeginLoadingComplete)
        {
            Player[] players     = PhotonNetwork.PlayerList;
            int      compcount   = 0;
            int      playercount = players.Length;

            foreach (Player p in players)
            {
                if (NetworkManager.Instance.RoomController.GetOtherPlayerPropertie <bool>(p, "InitComp"))
                {
                    ++compcount;
                }
            }

            if (compcount >= playercount)
            {
                IsBeginLoadingComplete = true;
            }
            yield return(null);
        }

        m_IsMultiplayGame = NetworkManager.Instance.RoomController.GetRoomPropertie <bool>(MultiPlayKey);

        while (!IsAfterLoadingComplete)
        {
            Player[] players = PhotonNetwork.PlayerList;

            bool complete = true;
            for (int i = 0; i < players.Length; ++i)
            {
                if (!NetworkManager.Instance.RoomController.GetOtherPlayerPropertie <bool>(players[i], PlayerCharacter.m_CharacterReadyKey))
                {
                    complete = false;
                }
            }
            if (complete)
            {
                InitializeComplete();
            }
            yield return(null);
        }
    }