public void UpdateState2()
 {
     _time++;
     _curScale     = MathUtil.GetEaseOutQuadInterpolation(State1EndScale, State2EndScale, _time, _duration);
     _detectRadius = _curScale * DefaultRadius;
     //CheckCollisionWithEnemyBullets();
     //CheckCollisionWithEnemy();
     for (int i = 0; i < BombCount; i++)
     {
         _bombsTf[i].localScale = new Vector3(_curScale, _curScale, 1);
         _colliderList[i].SetSize(_detectRadius, _detectRadius);
     }
     if (_time >= _duration)
     {
         // 全屏伤害
         ColliderCircle collider = ColliderManager.GetInstance().CreateColliderByType(eColliderType.Circle) as ColliderCircle;
         collider.SetSize(500, 500);
         collider.SetColliderGroup(eColliderGroup.EnemyBullet | eColliderGroup.Enemy);
         collider.SetPosition(Global.PlayerPos.x, Global.PlayerPos.y);
         collider.SetEliminateType(eEliminateDef.PlayerSpellCard);
         collider.SetHitEnemyDamage(150);
         collider.SetExistDuration(1);
         _curState = 3;
     }
 }
Exemplo n.º 2
0
    /// <summary>
    /// 创建一个销毁敌机子弹以及敌机的ObjectCollider
    /// </summary>
    private void CreateEliminateEnemyCollider(Vector2 pos)
    {
        // 清除子弹用的collider
        ColliderCircle collider = ColliderManager.GetInstance().CreateColliderByType(eColliderType.Circle) as ColliderCircle;

        collider.SetPosition(pos);
        collider.SetSize(0, 0);
        collider.SetEliminateType(eEliminateDef.SpellCardFinish);
        collider.SetColliderGroup(eColliderGroup.EnemyBullet | eColliderGroup.Enemy);
        collider.ScaleToSize(400, 400, 30);
        collider.SetExistDuration(30);
    }
    public static bool Set(object o, TValue key, ref TValue value)
    {
        ColliderCircle collider = (ColliderCircle)o;

        if (key.TtIsString())
        {
            switch (key.SValue())
            {
                #region 基础变量
            case "x":
            {
                Vector2 pos = collider.GetPosition();
                pos.x = (float)value.NValue;
                collider.SetPosition(pos);
                return(true);
            }

            case "y":
            {
                Vector2 pos = collider.GetPosition();
                pos.y = (float)value.NValue;
                collider.SetPosition(pos);
                return(true);
            }

            case "rot":
            {
                collider.SetRotation((float)value.NValue);
                return(true);
            }

                #endregion
                #region 运动相关变量
            case "v":
            {
                collider.velocity = (float)value.NValue;
                return(true);
            }

            case "vx":
            {
                collider.vx = (float)value.NValue;
                return(true);
            }

            case "vy":
            {
                collider.vy = (float)value.NValue;
                return(true);
            }

            case "vAngle":
            {
                collider.vAngle = (float)value.NValue;
                return(true);
            }

            case "maxV":
            {
                collider.maxVelocity = (float)value.NValue;
                return(true);
            }

            case "acce":
            {
                collider.acce = (float)value.NValue;
                return(true);
            }

            case "accAngle":
            {
                collider.accAngle = (float)value.NValue;
                return(true);
            }
                #endregion
            }
        }
        value.SetSValue(string.Format("SetField of userData fail!Invalid key {0} for type {1}", key, typeof(ColliderCircle).Name));
        return(false);
    }