Пример #1
0
        // Override
        public override void Start()
        {
            BaseStart();

            DoodadProtoDb.Item protoItem = DoodadProtoDb.Get(Entity.entityProto.protoId);
            _bound = new RadiusBound(protoItem.range, Entity.peTrans.trans);
            SkAliveEntity skAlive = Entity.aliveEntity;

            skAlive.deathEvent += DoodadEntityCreator.OnDoodadDeath;
            // Do not add to scene man here, set IsShown would do this thing
        }
Пример #2
0
    public static void OnDoodadDeath(SkEntity cur, SkEntity caster)
    {
        caster = PETools.PEUtil.GetCaster(caster);
        SkAliveEntity curAlive = cur as SkAliveEntity;
        SkAliveEntity casAlive = caster as SkAliveEntity;

        if (curAlive != null && casAlive != null)
        {
            int curPlayerID = Mathf.RoundToInt(curAlive.GetAttribute(AttribType.DefaultPlayerID));
            if (ReputationSystem.IsReputationTarget(curPlayerID))
            {
                int casPlayerID = Mathf.RoundToInt(casAlive.GetAttribute(AttribType.DefaultPlayerID));
                int casLvl      = (int)ReputationSystem.Instance.GetReputationLevel(casPlayerID, curPlayerID); //operate value depend the one be killed
                //lz-2017.05.11 冒险模式如果声望等级大于Cold的时候,攻击一下直接掉为Cold
                if (PeGameMgr.IsAdventure && casLvl > (int)ReputationSystem.ReputationLevel.Cold)
                {
                    int targetLvl   = (int)ReputationSystem.ReputationLevel.Cold;
                    int reduceValue = 0;
                    for (int i = targetLvl; i < casLvl; i++)
                    {
                        reduceValue -= ReputationSystem.GetLevelThreshold((ReputationSystem.ReputationLevel)i);
                    }
                    ReputationSystem.Instance.ChangeReputationValue(casPlayerID, curPlayerID, reduceValue, true);
                }
                else
                {
                    DoodadProtoDb.Item protoItem = DoodadProtoDb.Get(curAlive.Entity.entityProto.protoId);
                    RepVal             repVal;
                    if (protoItem != null && s_dicRepVals.TryGetValue(protoItem.repValId, out repVal))
                    {
                        int reduceValue = (int)(repVal._vals[casLvl] * ReputationSystem.ChangeValueProportion);         //reduceValue = addvalue * ChangeValueProportion;
                        ReputationSystem.Instance.ChangeReputationValue(casPlayerID, curPlayerID, reduceValue, true);   // reudce self no mater other side would be add;
                    }
                }
            }
        }
    }