コード例 #1
0
ファイル: NetEntity.cs プロジェクト: k3498gg/TSC
 void ChangeSpeed(ItemInfo item, ItemEffectInfo effect)
 {
     Debug.LogError("速度变化");
     //加速道具 停止使用加速功能
     this.Attribute.Speed = Attribute.BaseSpeed * effect.param1 / AppConst.factor;
     Timer.Instance.AddTimer(item.timer, 1, true, BackSpeed);
 }
コード例 #2
0
ファイル: NetEntity.cs プロジェクト: k3498gg/TSC
    public void UpdateState(StateType stateType, ItemInfo item, ItemEffectInfo effect)
    {
        this.State = stateType;
        switch (stateType)
        {
        case StateType.STATE_MARK:
            //TurnedBody(item);
            break;

        case StateType.STATE_MAGNET:
            Magnet(item, effect);
            break;

        case StateType.STATE_TRANSFERGATE:
            Transfer();
            break;

        case StateType.STATE_SPEED:
            ChangeSpeed(item, effect);
            break;

        case StateType.STATE_PROTECT:
            Protect();
            break;
        }
    }
コード例 #3
0
ファイル: NetEntity.cs プロジェクト: k3498gg/TSC
    //吸鐵石
    void Magnet(ItemInfo item, ItemEffectInfo effect)
    {
        Debug.LogError("吸铁石");
        float rate = (float)effect.param1 / AppConst.factor;

        this.Attribute.Atkdis = this.Attribute.Basedis * rate;
    }
コード例 #4
0
ファイル: Entity.cs プロジェクト: k3498gg/TSC
 void ChangeSpeed(ItemInfo item, ItemEffectInfo effect)
 {
     Debug.LogError("速度变化");
     //加速道具 停止使用加速功能
     EventCenter.Instance.Publish <Event_StopAcct>(null, new Event_StopAcct());
     this.Attribute.Speed = Attribute.BaseSpeed * effect.param1 / AppConst.factor;
     Timer.Instance.AddTimer(item.timer, 1, true, BackSpeed);
 }
コード例 #5
0
ファイル: DropItemInfo.cs プロジェクト: shanghaichina/TSC
 void EnergyUpdate(Entity entity, ItemEffectInfo effect)
 {
     entity.Attribute.Score  += effect.score;
     entity.Attribute.CurPhy += effect.phys;
     if (entity.Attribute.CurPhy > entity.Attribute.MaxPhy)
     {
         entity.Attribute.CurPhy = entity.Attribute.MaxPhy;
     }
 }
コード例 #6
0
ファイル: DropItemInfo.cs プロジェクト: shanghaichina/TSC
    public void FlyToEntity(Entity entity)
    {
        if (null == entity)
        {
            return;
        }
        if (IsLock)
        {
            return;
        }
        IsLock = true;

        Vector3 v = entity.CacheModel.position;

        Cache.DOJump(v, 3, 1, 0.35f).SetEase(Ease.Linear).OnComplete(() =>
        {
            ItemDropMgr.Instance.Despawner(ResourceType.RESOURCE_ITEM, this);
            ItemInfo item = InfoMgr <ItemInfo> .Instance.GetInfo(infoId);
            if (null == item)
            {
                return;
            }
            ItemEffectInfo effect = InfoMgr <ItemEffectInfo> .Instance.GetInfo(item.effectId);
            if (null == effect)
            {
                return;
            }
            ItemType type = effect.effType;
            switch (type)
            {
            case ItemType.ITEM_MARK:     //问号变身

                break;

            case ItemType.ITEM_MAGNET:     //吸铁石

                break;

            case ItemType.ITEM_TRANSFERGATE:     //传送门

                break;

            case ItemType.ITEM_SPEED:    //速度变化

                break;

            case ItemType.ITEM_PROTECT:     //保护罩

                break;

            case ItemType.ITEM_ENERGY:
                EnergyUpdate(entity, effect);
                break;
            }
        });
    }
コード例 #7
0
ファイル: Entity.cs プロジェクト: k3498gg/TSC
 //积分变换,体力变换
 public void EnergyUpdate(ItemEffectInfo effect)
 {
     Attribute.Score  = Attribute.Score + effect.param1;
     Attribute.CurPhy = Attribute.CurPhy + effect.param2;
     if (Attribute.CurPhy > Attribute.MaxPhy)
     {
         Attribute.CurPhy = Attribute.MaxPhy;
     }
     UpdateModelScale();
 }
コード例 #8
0
ファイル: NetEntity.cs プロジェクト: k3498gg/TSC
    //积分变换,体力变换
    public void EnergyUpdate(ItemEffectInfo effect)
    {
        Attribute.Score  = Attribute.Score + effect.param1;
        Attribute.CurPhy = Attribute.CurPhy + effect.param2;
        if (Attribute.CurPhy > Attribute.MaxPhy)
        {
            Attribute.CurPhy = Attribute.MaxPhy;
        }

        UpdateModelScale();

        if (TSCData.Instance.EntityInfoDic.ContainsKey(Id))
        {
            TSCData.Instance.EntityInfoDic[Id].Socre       = Attribute.Score;
            TSCData.Instance.EntityInfoDic[Id].Killcount   = KillCount;
            TSCData.Instance.EntityInfoDic[Id].BeKillCount = BeKillCount;
        }
    }
コード例 #9
0
    public void DropRareItem(Vector3 pos, int score, Transform parent)
    {
        if (null == m_dropItem)
        {
            m_dropItem = InfoMgr <ItemInfo> .Instance.GetInfo((int)ItemType.ITEM_RAREENERGY);
        }

        if (null == m_dropItemEffect)
        {
            m_dropItemEffect = InfoMgr <ItemEffectInfo> .Instance.GetInfo(m_dropItem.effectId);
        }

        int count = UnityEngine.Random.Range(score / 3 / m_dropItemEffect.param1, score / 2 / m_dropItemEffect.param1);

        for (int i = 0; i < count; i++)
        {
            float      dis   = Random.Range(AppConst.DropItemRangeParam1, AppConst.DropItemRangeParam2);
            float      angle = 360.0f * i / count;
            float      x     = Mathf.Cos(angle) * dis;
            float      y     = Mathf.Sin(angle) * dis;
            Vector3    v     = new Vector3(pos.x + x, 0, pos.z + y);
            GameObject go    = Spawner((int)ItemType.ITEM_RAREENERGY, pos, ResourceType.RESOURCE_ITEM, parent);
            if (null != go)
            {
                DropItemInfo dropItem = Util.AddComponent <DropItemInfo>(go);
                dropItem.IsLock = true;
                if (dropItem.ItemId == 0)
                {
                    dropItem.ItemId = Util.GetDropRareIndex();
                }
                dropItem.InfoId = (int)ItemType.ITEM_RAREENERGY;
                TSCData.Instance.RareEnergyDic[dropItem.ItemId] = dropItem;
                dropItem.Cache.DOMove(v, 0.5f).SetEase(Ease.Linear).OnComplete(() =>
                {
                    dropItem.IsLock = false;
                });
            }
        }
    }
コード例 #10
0
ファイル: DropItemInfo.cs プロジェクト: shanghaichina/TSC
 void ProtectUpdate(Entity entity, ItemEffectInfo effect)
 {
     Debug.LogError("保护时间");
 }
コード例 #11
0
    public void FlyToEntity(NetEntity entity)
    {
        if (null == entity)
        {
            return;
        }
        if (IsLock)
        {
            return;
        }
        IsLock = true;

        Vector3 v = entity.CacheModel.position;

        ItemInfo item = InfoMgr <ItemInfo> .Instance.GetInfo(infoId);

        if (null == item)
        {
            return;
        }
        ItemEffectInfo effect = InfoMgr <ItemEffectInfo> .Instance.GetInfo(item.effectId);

        if (null == effect)
        {
            return;
        }
        ItemType type = effect.effType;

        if ((int)type < (int)ItemType.ITEM_ENERGY)
        {
            //碰到状态道具 停止技能
            entity.EndCurrentStateToOtherState(StateID.Walk);
        }

        switch (type)
        {
        case ItemType.ITEM_MAGNET:
        case ItemType.ITEM_MARK:
        case ItemType.ITEM_PROTECT:
        case ItemType.ITEM_SPEED:
        case ItemType.ITEM_TRANSFERGATE:
            //非积分道具  人物状态变化
            StateType state = Util.ConvertItemType(type);
            entity.UpdateState(state, item, effect);
            break;

        case ItemType.ITEM_ENERGY:
            entity.EnergyUpdate(effect);
            break;
            //case ItemType.ITEM_RAREENERGY:
            //    entity.EnergyUpdate(effect);
            //    break;
            //case ItemType.ITEM_SUGAR:
            //    break;
        }


        Cache.DOJump(v, 3, 1, 0.35f).SetEase(Ease.Linear).OnComplete(() =>
        {
            ItemDropMgr.Instance.Despawner(ResourceType.RESOURCE_ITEM, this);
        });
    }