Ejemplo n.º 1
0
        private void Update()
        {
#if (UNITY_EDITOR)
            Gun gun = Global.gApp.CurScene.GetMainPlayerComp().GetWeaponMgr().GetFirstGun();
            Atk.text.text       = gun.GetBaseDamage().ToString();
            AtkTime.text.text   = gun.GetBaseAtkTime().ToString();
            PassParam.text.text = m_PassData.hpParam.ToString();
#endif
            m_CurTime = m_CurTime + BaseScene.GetDtTime();
            int time = (int)m_CurTime;
            if (time > m_PreTime)
            {
                m_PreTime = time;
                Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.TimeCoolDown, time);
            }
        }
Ejemplo n.º 2
0
        private void CalcAnglesWorld(float angleZ)
        {
            Vector3 eulerAngle = transform.eulerAngles;
            float   dtAngle    = angleZ - eulerAngle.z;

            if (dtAngle > 180)
            {
                dtAngle = (dtAngle) - 360;
            }
            else if (dtAngle < -180)
            {
                dtAngle = (dtAngle) + 360;
            }
            dtAngle = eulerAngle.z + dtAngle * BaseScene.GetDtTime() * 8;
            transform.eulerAngles = new Vector3(0, 0, dtAngle);
        }
Ejemplo n.º 3
0
        void Update()
        {
            float dtTime = BaseScene.GetDtTime();

            if (dtTime == 0)
            {
                m_Monster.SetSpeed(Vector2.zero);
                return;
            }

            if (m_StartAct)
            {
                m_Monster.SetSpeed(Vector2.zero);
                m_CurTime = m_CurTime + dtTime;
                FireToMainPlayer();

                Vector3 speedVec = m_Player.transform.position - transform.position;
                transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(speedVec, Vector3.up));
            }
            else if (!m_InAnimAct)
            {
                m_CurTime += GetActDtTime();
                if (m_CurTime >= DtTime)
                {
                    if (m_Monster.TriggerFirstAct())
                    {
                        m_CurTime = 0;
                        m_Monster.SetSpeed(Vector2.zero);
                        m_Monster.PlayAnim(GameConstVal.Skill01);
                        m_StartAct  = true;
                        m_InAnimAct = true;
                    }
                }
            }
            else
            {
                m_CurTime = m_CurTime + dtTime;
                if (m_CurTime >= m_AnimTime)
                {
                    m_Monster.SetSpeed(Vector2.zero);
                    m_Monster.PlayAnim(GameConstVal.Run);
                    m_Monster.EndFirstAct();
                    m_CurTime   = 0;
                    m_InAnimAct = false;
                }
            }
        }
Ejemplo n.º 4
0
 private void CheckEnded()
 {
     m_CurTime = m_CurTime + BaseScene.GetDtTime();
     if (BaseScene.GetDtTime() <= 0)
     {
         m_Monster.SetSpeed(Vector2.zero);
         return;
     }
     m_Monster.SetSpeed(Vector2.zero);
     if (m_CurTime >= m_EndTime)
     {
         m_CurTime  = 0;
         m_StartAct = false;
         m_Monster.PlayAnim(GameConstVal.Run);
         m_Monster.EndFirstAct();
     }
 }
Ejemplo n.º 5
0
        private void Update()
        {
            if (!m_NeedUpdate)
            {
                return;
            }

            m_CurTime = m_CurTime + BaseScene.GetDtTime();
            if (m_CurTime <= m_EffectTime)
            {
                Timepro.image.fillAmount = 1 - m_CurTime / m_EffectTime;
            }
            else
            {
                m_FightUi.RemoveCountItem(this);
            }
        }
Ejemplo n.º 6
0
 void Update()
 {
     m_CurTime = m_CurTime + BaseScene.GetDtTime();
     if (BaseScene.GetDtTime() > 0)
     {
         if (m_CurTime >= m_ActTime)
         {
             m_CurTime = 0;
             RandomAct();
         }
         StrollRandom();
     }
     else
     {
         m_Monster.SetSpeed(Vector2.zero);
     }
 }
Ejemplo n.º 7
0
        public override void MUpdate()
        {
            float dtTime = BaseScene.GetDtTime();

            if (dtTime > 0 && !m_InBreakState)
            {
                m_LockTools.Update();
                if (m_InBreakState)
                {
                    //m_Pet.SetSpeed(Vector2.zero);
                }
            }
            else
            {
                m_Pet.SetSpeed(Vector2.zero);
            }
        }
 void Update()
 {
     if (m_CurEleState == CElement.EleState.Open)
     {
         m_CurTime     = m_CurTime + BaseScene.GetDtTime();
         m_NewCurTime += BaseScene.GetDtTime();
         if (m_NewCurTime > m_DtTimeMax)
         {
             transform.localPosition = Vector3.zero;
             m_NewCurTime            = 0;
         }
         else if (m_NewCurTime > m_DtTimeMin)
         {
             transform.localPosition = new Vector3(1000, 1000, 1000);
         }
     }
 }
Ejemplo n.º 9
0
 private void LateUpdate()
 {
     if (!m_IsInDelayDestroy)
     {
         m_CurTime = m_CurTime + BaseScene.GetDtTime();
         if (m_CurTime < m_LiveTime)
         {
             Vector3 newPos = m_BulletEffect.transform.position;
             newPos.z           = 0;
             transform.position = newPos;
         }
         else
         {
             OnHitted();
         }
     }
 }
Ejemplo n.º 10
0
 private void JumpToMainPlayer()
 {
     m_CurTime = m_CurTime + BaseScene.GetDtTime();
     if (m_CurTime <= m_FlyTime)
     {
         if (m_CurTime >= m_DelayTime)
         {
             float rata = (m_CurTime - m_DelayTime) / (m_FlyTime - m_DelayTime);
             transform.position = m_CurPosition * (1 - rata) + rata * m_LockPos;
         }
     }
     else
     {
         transform.position = m_LockPos;
         m_StartAct         = false;
     }
 }
Ejemplo n.º 11
0
        private void Update()
        {
            float dtTime = BaseScene.GetDtTime();

            if (dtTime > 0)
            {
                if (m_TargetTsf && m_CurProp && !m_CurProp.InCameraView)
                {
                    UpdatePointArrow(true);
                }
                else
                {
                    UpdatePointArrow(false);
                }
                TimeLimitUp();
            }
        }
Ejemplo n.º 12
0
        void Update()
        {
            m_CurTime = m_CurTime + BaseScene.GetDtTime();
            Vector3 localPos = transform.parent.localPosition;

            if (localPos.y > m_StartPosY)
            {
                transform.localPosition = new Vector3(0, 0, 0);
            }
            else
            {
                transform.localPosition = new Vector3(1000, 1000, 1000);
            }
            if (m_CurTime >= m_LiveTime)
            {
                Destroy(gameObject);
            }
        }
Ejemplo n.º 13
0
        void Update()
        {
            if (!m_IsInDelayDestroy)
            {
                float dtTime = BaseScene.GetDtTime();

                m_CurTime      = m_CurTime + dtTime;
                m_ExplodeTime += dtTime;
                if (m_CurTime < m_LiveTime)
                {
                    transform.Translate(Vector3.right * m_Speed * BaseScene.GetDtTime(), Space.Self);
                }
                else
                {
                    Destroy(gameObject);
                }
            }
        }
Ejemplo n.º 14
0
 void Update()
 {
     m_CurTime     = m_CurTime + BaseScene.GetDtTime();
     m_NewCurTime += BaseScene.GetDtTime();
     if (m_NewCurTime > m_DtTimeMax)
     {
         transform.localPosition = Vector3.zero;
         m_NewCurTime            = 0;
     }
     else if (m_NewCurTime > m_DtTimeMin)
     {
         transform.localPosition = new Vector3(1000, 1000, 1000);
     }
     if (m_CurTime >= m_LiveTime)
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 15
0
        void Update()
        {
            m_CurTime = m_CurTime + BaseScene.GetDtTime();
            Vector3 localPos = transform.parent.localPosition;

            if (localPos.y > m_StartPosY)
            {
                transform.localPosition = new Vector3(0, 0, 0);
            }
            else
            {
                transform.localPosition = new Vector3(1000, 1000, 1000);
                if (m_CurEleState == CElement.EleState.Close)
                {
                    m_Animator.enabled = false;
                }
            }
        }
Ejemplo n.º 16
0
        void Update()
        {
            float dtTime = BaseScene.GetDtTime();

            m_CurTime = m_CurTime + dtTime;

            if (m_StartAct)
            {
                m_Monster.SetSpeed(Vector2.zero);
                if (dtTime == 0)
                {
                    return;
                }
                HurlToMainPlayer();
            }
            else if (!m_InAnimAct)
            {
                if (m_CurTime >= DtTime)
                {
                    if (!m_StartAct)
                    {
                        if (m_Monster.TriggerFirstAct())
                        {
                            m_CurTime = 0;
                            m_Monster.SetSpeed(Vector2.zero);
                            m_Monster.PlayAnim(GameConstVal.Skill02);
                            m_StartAct  = true;
                            m_InAnimAct = true;
                        }
                    }
                }
            }
            else
            {
                m_Monster.SetSpeed(Vector2.zero);
                if (m_CurTime >= m_AnimTime)
                {
                    m_Monster.PlayAnim(GameConstVal.Run);
                    m_Monster.EndFirstAct();
                    m_CurTime   = 0;
                    m_InAnimAct = false;
                }
            }
        }
Ejemplo n.º 17
0
        void Update()
        {
            float dtTime = BaseScene.GetDtTime();

            if (dtTime > 0)
            {
                dtTime     = 0.0333333f;
                m_CurTime += dtTime;
                float radio = m_CurTime / m_MaxTime;
                if (radio < 1)
                {
                    transform.localPosition = MinPos * radio + StartPos * (1 - radio);
                }
                else
                {
                    CalcNewTime();
                }
            }
        }
Ejemplo n.º 18
0
 void Update()
 {
     if (!m_IsInDelayDestroy)
     {
         m_CurTime = m_CurTime + BaseScene.GetDtTime();
         if (m_CurTime >= m_LiveTime)
         {
             GameObject effect = Global.gApp.gResMgr.InstantiateObj("Prefabs/Effect/enemy/2005_miss");
             effect.transform.position = transform.position;
             Destroy(gameObject);
         }
         else if (m_CurTime >= m_StartDamageTime && !m_Enable)
         {
             m_Enable = true;
             GetComponent <Collider2D>().enabled    = true;
             GetComponent <Rigidbody2D>().simulated = true;
         }
     }
 }
Ejemplo n.º 19
0
        void Update()
        {
            if (m_StartAct)
            {
                float dtTime = BaseScene.GetDtTime();
                if (dtTime == 0)
                {
                    m_Monster.SetSpeed(Vector2.zero);
                    return;
                }
                m_CurTime = m_CurTime + dtTime;
                if (m_CurTime < m_BackTime)
                {
                    if (m_BeatBackType == BeatBackType.OnPos || m_BeatBackType == BeatBackType.OnVec)
                    {
                        float speed = Mathf.Lerp(m_BackStartSpeed, m_BackEndSpeed, m_CurTime / m_BackTime);
                        m_Monster.SetSpeed(BaseScene.TimeScale * m_SpeedVec2 * speed / m_Weight);
                    }
                    else if (m_BeatBackType == BeatBackType.OnUp)
                    {
                        float   G    = m_BackStartSpeed * 2 / m_BackTime;
                        float   posZ = m_BackStartSpeed * m_CurTime - G * m_CurTime * m_CurTime / 2;
                        Vector3 pos  = m_Monster.transform.position;
                        pos.z = -posZ;
                        m_Monster.transform.position = pos;
                        m_Monster.SetSpeed(Vector3.zero);
                    }
                }
                else
                {
                    m_CurTime  = 0;
                    m_StartAct = false;

                    //if (m_BackStartSpeed == 0 && m_BackEndSpeed == 0)
                    //{
                    //    m_Monster.ResetSpeed();
                    //    m_Monster.ResetStaticByRigidProp();
                    //}
                    m_Monster.EndBackAct();
                }
            }
        }
Ejemplo n.º 20
0
        public void CalcCurAnim(float sx, float sy)
        {
            if (BaseScene.GetDtTime() <= 0)
            {
                return;
            }
            if (sx != 0 || sy != 0)
            {
                Vector3 speedV = new Vector3(sx, sy, 0);
                float   angle  = EZMath.SignedAngleBetween(speedV, Vector3.up);

                m_Player.angle = angle;

                // Debug.Log(angle);

                Vector3 roleEulerAngle = m_RotateRoleNode.eulerAngles;
                float   roleAngleZ     = roleEulerAngle.z;
                float   relativeAngleZ = angle - roleAngleZ;
                relativeAngleZ = relativeAngleZ >= 0 ? relativeAngleZ : relativeAngleZ + 360;
                if (relativeAngleZ <= 45 || relativeAngleZ >= 315)
                {
                    PlayDAnim(GameConstVal.Run);
                }
                else if (relativeAngleZ >= 45 && relativeAngleZ <= 135)
                {
                    PlayDAnim(GameConstVal.Run_left);
                }
                else if (relativeAngleZ >= 135 && relativeAngleZ <= 215)
                {
                    PlayDAnim(GameConstVal.Run_back);
                }
                else
                {
                    PlayDAnim(GameConstVal.Run_right);
                }
            }
            else
            {
                m_Player.angle = -1f;
                PlayDAnim(GameConstVal.Idle);
            }
        }
Ejemplo n.º 21
0
        void Update()
        {
            float dtTime = BaseScene.GetDtTime();

            m_CurTime = m_CurTime + dtTime;

            if (m_StartAct)
            {
                if (dtTime == 0)
                {
                    m_Monster.SetSpeed(Vector2.zero);
                    return;
                }
                m_Monster.SetSpeed(Vector2.zero);
                if (!m_EndedIdle && m_CurTime > IdleTime)
                {
                    m_EndedIdle = true;
                    m_CurTime   = 0;
                    m_Monster.PlayAnim(GameConstVal.Skill01);
                }
                if (m_EndedIdle)
                {
                    HitGround();
                }
            }
            else
            {
                if (m_CurTime >= DtTime)
                {
                    if (m_Monster.TriggerFirstAct())
                    {
                        m_CurTime = 0;
                        m_Monster.SetSpeed(Vector2.zero);
                        m_Monster.PlayAnim(GameConstVal.Idle);
                        m_StartAct       = true;
                        m_InstanceBullet = false;
                        m_EndedIdle      = false;
                        AddLockEffect();
                    }
                }
            }
        }
Ejemplo n.º 22
0
 private void Update()
 {
     if (m_StartCloseAct && !m_ReachedPlaceTag)
     {
         m_CurTime += BaseScene.GetDtTime();
         if (m_CurTime >= m_CloseMaxTime)
         {
             PursueCallBack(true);
         }
     }
     if (m_CurBornNode == null)
     {
         bool hasNewDstNode = GenerateBornNode();
         if (hasNewDstNode)
         {
             m_FightNpcPlayer.PlayAnim(GameConstVal.Run);
             m_FightNpcPlayer.GetAutoPathComp().SetAutoPathEnable(true, 0.2f, m_FleeSpeed, m_CurBornNode.transform, m_PursueCallBack);
         }
     }
 }
Ejemplo n.º 23
0
 public override void Update()
 {
     base.Update();
     if (!m_IsDeath)
     {
         m_CurLiveTime = m_CurLiveTime + BaseScene.GetDtTime();
         if (m_CurLiveTime >= KeepTime)
         {
             Global.gApp.CurScene.GetPropMgr().RemoveProp(gameObject);
         }
     }
     else
     {
         m_CurTime = m_CurTime + BaseScene.GetDtTime();
         if (m_CurTime >= m_EndedTime)
         {
             Global.gApp.CurScene.GetPropMgr().RemoveProp(gameObject);
         }
     }
 }
Ejemplo n.º 24
0
        public virtual void Update()
        {
            float dtTime = BaseScene.GetDtTime();

            if (InDeath)
            {
                m_CurDeadTime += dtTime;
                if (m_CurDeadTime >= m_DeadTime)
                {
                    RecycleSelf();
                }
            }
            else
            {
                if (m_AiBuffMgr != null)
                {
                    m_AiBuffMgr.Update(dtTime);
                }
            }
        }
Ejemplo n.º 25
0
 void Update()
 {
     if (BaseScene.GetDtTime() > 0)
     {
         if (m_StartBackStep1)
         {
             m_CurTime = m_CurTime + BaseScene.GetDtTime();
             StartBackActImp();
         }
         else if (m_StartAct)
         {
             m_CurTime = m_CurTime + BaseScene.GetDtTime();
             CheckEnd();
         }
         else
         {
             m_CurTime += GetActDtTime();
             if (m_CurTime >= DtTime)
             {
                 if (m_Monster.TriggerFirstAct())
                 {
                     m_CurTime = 0;
                     m_Monster.PlayAnim(GameConstVal.Skill01, -1, 0);
                     m_Monster.SetAnimFloat(GameConstVal.SpeedSymbolStr, 1.0f);
                     m_StartAct       = true;
                     m_StartBackStep1 = false;
                     m_StartBackStep2 = false;
                     Vector3 posStart  = transform.position;
                     Vector3 targetPos = m_Player.transform.position;
                     Vector2 velocity2 = new Vector2(targetPos.x - posStart.x, targetPos.y - posStart.y);
                     m_LockSpeed = velocity2.normalized * Speed;
                     m_Monster.SetSpeed(Vector2.zero);
                 }
             }
         }
     }
     else if (m_StartAct)
     {
         m_Monster.SetSpeed(Vector2.zero);
     }
 }
Ejemplo n.º 26
0
 public override void Update()
 {
     CreateAppear();
     base.Update();
     if (!m_IsDeath)
     {
         if (m_ChipGainType == ChipGainType.AutoGain)
         {
             AddChip();
             m_CurTime = m_CurTime + Time.deltaTime;
             if (m_CurTime > m_StartTime)
             {
                 float ratio = (m_CurTime - m_StartTime) / m_Time;
                 ratio = Mathf.Min(ratio, 1);
                 Vector3 newPos = Vector3.Lerp(m_StartPos, m_DestPos, ratio);
                 transform.position = newPos;
                 if (ratio >= 1f)
                 {
                     BroadGainChip();
                     if (m_Appear != null)
                     {
                         Destroy(m_Appear);
                         m_Appear = null;
                     }
                     if (m_CurTime > m_StartTime + m_Time + m_Wait)
                     {
                         Global.gApp.CurScene.GetPropMgr().RemoveProp(gameObject);
                     }
                 }
             }
         }
     }
     else
     {
         m_CurTime = m_CurTime + BaseScene.GetDtTime();
         if (m_CurTime >= m_EndedTime)
         {
             Global.gApp.CurScene.GetPropMgr().RemoveProp(gameObject);
         }
     }
 }
Ejemplo n.º 27
0
        private void Update()
        {
            if (m_StartBackAct)
            {
                float dtTime = BaseScene.GetDtTime();
                if (dtTime > 0)
                {
                    m_CurTime += dtTime;
                    if (m_CurTime >= m_WaitTime)
                    {
                        m_FightNpcPlayer.PlayAnim(GameConstVal.Run);

                        bool hasNewDstNode = GenerateBornNode();
                        if (hasNewDstNode)
                        {
                            m_FightNpcPlayer.GetAutoPathComp().SetAutoPathEnable(true, 0.2f, m_FleeSpeed, m_CurBornNode.transform);
                        }
                        if (!m_FightNpcPlayer.InCameraView)
                        {
                            if (m_CurTime > m_DestroyTime + m_WaitTime)
                            {
                                m_FightNpcPlayer.BroadPlotTips(m_PlotId);
                                m_FightNpcPlayer.GetAutoPathComp().SetAutoPathEnable(false);
                                m_FightNpcPlayer.GetAutoPathComp().SetSpeedScale(1);
                                Global.gApp.gUiMgr.ClosePanel(Wndid.FightNpcPlotUi);
                                m_FightNpcPlayer.DestroySelf();
                            }
                        }
                        else
                        {
                            m_CurTime = m_WaitTime;
                        }
                    }
                    else
                    {
                        m_FightNpcPlayer.PlayAnim(GameConstVal.Idle);
                        m_FightNpcPlayer.SetSpeed(Vector2.zero);
                    }
                }
            }
        }
Ejemplo n.º 28
0
 void Update()
 {
     if (m_TaskState == TaskState.Begin)
     {
         float dtTime = BaseScene.GetDtTime();
         if (dtTime > 0)
         {
             FindMonsterTargetTsf();
             if ((m_AppointProp && !m_AppointProp.InCameraView) || (m_Monster && !m_Monster.InCameraView))
             {
                 UpdatePointArrow(true);
             }
             else
             {
                 UpdatePointArrow(false);
             }
             BroadSecondPlotTip();
             TimeLimitUp();
         }
     }
 }
Ejemplo n.º 29
0
        private void Update()
        {
            if (m_CanAtk)
            {
                m_CurTime = m_CurTime + BaseScene.GetDtTime();

                if (m_CurTime >= m_DamageEndTime)
                {
                    StopAtkAbs();
                }
                else if (m_CurTime >= m_DamageTime)
                {
                    transform.localPosition = m_OriPos;
                    m_DamageEndTime         = 0;
                }
                else
                {
                    transform.localPosition = new Vector3(-500, 0, 0);
                }
            }
        }
Ejemplo n.º 30
0
 void Update()
 {
     if (m_InBeatBackState)
     {
         m_CurTime = m_CurTime + BaseScene.GetDtTime();
         if (m_CurTime < m_BackTime)
         {
             float speed = Mathf.Lerp(m_BackStartSpeed, m_BackEndSpeed, m_CurTime / m_BackTime);
             m_Player.SetSpeed(m_SpeedVec2 * speed * BaseScene.TimeScale / m_Weight);
             float z = m_V0 * m_CurTime - m_G * m_CurTime * m_CurTime / 2;
             z = Mathf.Max(z, 0);
             m_HeorNode.localPosition = new Vector3(0, 0, -z);
         }
         else
         {
             m_Player.SetSpeed(Vector2.zero);
             m_CurTime                = 0;
             m_InBeatBackState        = false;
             m_HeorNode.localPosition = Vector2.zero;
             m_Player.EndBackAct();
         }
     }
     else if (m_InLertPoPos)
     {
         m_CurTime = m_CurTime + BaseScene.GetDtTime();
         if (m_CurTime < m_LerpTime)
         {
             float rata = m_CurTime / m_LerpTime;
             transform.position = transform.position * (1 - rata) + rata * m_LertLockPos;
         }
         else
         {
             m_Player.SetSpeed(Vector2.zero);
             m_CurTime         = 0;
             m_InBeatBackState = false;
             m_InLertPoPos     = false;
             m_Player.EndBackAct();
         }
     }
 }