Example #1
0
    public static void OnMonsterAdd(int id, AiNetwork ai, Pathea.PeEntity entity)
    {
        EntityMonsterBeacon mbEntity = Pathea.EntityMgr.Instance.Get(id) as EntityMonsterBeacon;

        if (null != mbEntity)
        {
            mbEntity.OnMonsterCreated(entity);
        }
        else
        {
            if (null != entity)
            {
                Pathea.CommonCmpt cc = entity.GetCmpt <Pathea.CommonCmpt>();
                if (cc != null)
                {
                    AiTowerDefense td = AiTowerDefense.Get <AiTowerDefense>(id);
                    if (null != td)
                    {
                        cc.TDpos = td._pos;
                    }
                }

                Pathea.SkAliveEntity sae = entity.GetCmpt <Pathea.SkAliveEntity>();
                if (sae != null)
                {
                    sae.SetAttribute(Pathea.AttribType.DefaultPlayerID, 8);
                    sae.SetAttribute(Pathea.AttribType.CampID, 26);
                }
            }
        }
    }
Example #2
0
 void UpdateEnergeRecharge()
 {
     if (null != m_Skill && m_Skill.GetAttribute(AttribType.Energy) > PETools.PEMath.Epsilon)
     {
         for (int i = m_RechangeableEquipments.Count - 1; i >= 0; i--)
         {
             IRechargeableEquipment rechargeable = m_RechangeableEquipments[i];
             if (null != rechargeable && !rechargeable.Equals(null))
             {
                 if (Time.time > rechargeable.lastUsedTime + rechargeable.rechargeDelay)
                 {
                     if (rechargeable.enMax - rechargeable.enCurrent <= PETools.PEMath.Epsilon)
                     {
                         continue;
                     }
                     float currentEnerge  = m_Skill.GetAttribute(AttribType.Energy);
                     float rechargeEnerge = Mathf.Clamp(rechargeable.rechargeSpeed * Time.deltaTime,
                                                        0, rechargeable.enMax - rechargeable.enCurrent);
                     if (rechargeEnerge > currentEnerge)
                     {
                         rechargeEnerge = currentEnerge;
                     }
                     rechargeable.enCurrent += rechargeEnerge;
                     m_Skill.SetAttribute(AttribType.Energy, currentEnerge - rechargeEnerge);
                 }
             }
             else
             {
                 m_RechangeableEquipments.RemoveAt(i);
             }
         }
     }
 }
        public void SetDamagable(int campId, int damageId, int playerId)
        {
            SkAliveEntity skAlive = Entity.aliveEntity;

            if (skAlive != null)
            {
                skAlive.SetAttribute(AttribType.CampID, campId);
                skAlive.SetAttribute(AttribType.DamageID, damageId);
                _bDamagable = campId != SceneDoodadDesc.c_neutralCamp || damageId != SceneDoodadDesc.c_neutralDamage;
//				if(_bDamagable){
//					skAlive.deathEvent += DoodadEntityCreator.OnDoodadDeath;
//				} else {
//					skAlive.deathEvent -= DoodadEntityCreator.OnDoodadDeath;
//				}
                if (playerId >= 0)
                {
                    skAlive.SetAttribute(AttribType.DefaultPlayerID, playerId);
                }
            }
        }