コード例 #1
0
ファイル: AsheW.cs プロジェクト: papamoomin/AOSMyScript
    private void OnTriggerEnter(Collider other)
    {
        // 다른 챔피언과 충돌한 적 있는지 검사
        if (isFirstAtk)
        {
            bool isTrig = false;

            // 현재 충돌한 적에 따라 각각의 HitMe 함수를 호출한다
            if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Champion")))
            {
                if (!other.gameObject.Equals(mySkill.gameObject))
                {
                    ChampionBehavior champBehav = other.GetComponent <ChampionBehavior>();

                    if (champBehav.team != mySkill.TheChampionBehaviour.team)
                    {
                        isTrig = true;
                        float damage = CalculateDamage();

                        if (champBehav != null)
                        {
                            champBehav.HitMe(damage, "AD", mySkill.gameObject, mySkill.name);
                        }
                    }
                }
            }
            else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Monster")))
            {
                MonsterBehaviour monBehav = other.GetComponent <MonsterBehaviour>();
                float            damage   = CalculateDamage();

                if (monBehav != null)
                {
                    isTrig = true;

                    if (monBehav.HitMe(damage, "AD", mySkill.gameObject))
                    {
                        mySkill.TheChampionAtk.ResetTarget();
                    }
                }
            }
            else if (other.tag.Equals("Minion"))
            {
                MinionBehavior minBehav = other.GetComponent <MinionBehavior>();

                if (!other.name.Contains(mySkill.TheChampionBehaviour.team))
                {
                    isTrig = true;
                    float damage = CalculateDamage();

                    if (minBehav != null)
                    {
                        minBehav.HitMe(damage, "AD", mySkill.gameObject);
                    }
                }
            }

            // 피격당한 게 확인되면 isFirstAtk을 꺼 다른 이에게 충돌할 일이 없도록 처리한다.
            if (isTrig)
            {
                gameObject.SetActive(false);
                isFirstAtk = false;
            }
        }
    }
コード例 #2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag.Equals("Minion"))
        {
            MinionBehavior mB = other.GetComponent <MinionBehavior>();
            if (!other.gameObject.name.Contains(mySkill.TheChampionBehaviour.Team))
            {
                float damage = (mySkill.skillData.eDamage[mySkill.TheChampionData.skill_E - 1]
                                + mySkill.Acalculate(mySkill.skillData.eAstat, mySkill.skillData.eAvalue)) / 10f;
                if (mB != null)
                {
                    int viewID = mB.GetComponent <PhotonView>().viewID;
                    //mySkill.HitRPC(viewID, damage, "AP");
                    if (mB.HitMe(damage, "AP", mySkill.gameObject))
                    {
                        //여기에는 나중에 평타 만들면 플레이어의 현재 공격 타겟이 죽었을 시 초기화해주는 것을 넣자.
                        mySkill.TheChampionAtk.ResetTarget();

                        // 스킬쏜애 주인이 나면 킬올리자
                        if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                        {
                            mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 1, other.transform.position);
                        }
                    }
                }
            }
        }
        //else if(other.tag.Equals("Player"))
        else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Champion")))
        {
            ChampionBehavior cB = other.GetComponent <ChampionBehavior>();
            if (cB.Team != mySkill.TheChampionBehaviour.Team)
            {
                float damage = (mySkill.skillData.eDamage[mySkill.TheChampionData.skill_E - 1]
                                + mySkill.Acalculate(mySkill.skillData.eAstat, mySkill.skillData.eAvalue)) / 10f;
                if (cB != null)
                {
                    int viewID = cB.GetComponent <PhotonView>().viewID;
                    //mySkill.HitRPC(viewID, damage, "AP");
                    if (cB.HitMe(damage, "AP", mySkill.gameObject, mySkill.name))
                    {
                        mySkill.TheChampionAtk.ResetTarget();
                        if (!sysmsg)
                        {
                            sysmsg = GameObject.FindGameObjectWithTag("SystemMsg").GetComponent <SystemMessage>();
                        }
                        sysmsg.sendKillmsg("alistar", other.GetComponent <ChampionData>().ChampionName, mySkill.TheChampionBehaviour.Team.ToString());
                        // 스킬쏜애 주인이 나면 킬올리자
                        if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                        {
                            mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 0, other.transform.position);
                        }
                    }
                }
            }
        }
        else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Monster")))
        {
            MonsterBehaviour mB = other.GetComponent <MonsterBehaviour>();

            float damage = (mySkill.skillData.eDamage[mySkill.TheChampionData.skill_E - 1]
                            + mySkill.Acalculate(mySkill.skillData.eAstat, mySkill.skillData.eAvalue)) / 10f;
            if (mB != null)
            {
                int viewID = mB.GetComponent <PhotonView>().viewID;
                //mySkill.HitRPC(viewID, damage, "AP");
                if (mB.HitMe(damage, "AP", mySkill.gameObject))
                {
                    mySkill.TheChampionAtk.ResetTarget();

                    //// 스킬쏜애 주인이 나면 킬올리자
                    //if (mySkill.GetComponent<PhotonView>().owner.Equals(PhotonNetwork.player))
                    //{
                    //    mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 3, other.transform.position);
                    //}
                }
            }
        }
    }
コード例 #3
0
 private void Start()
 {
     monster = GetComponentInParent <MonsterBehaviour>();
 }
コード例 #4
0
 IEnumerator AtkMotion()
 {
     while (true)
     {
         if (!isAtkPause)
         {
             bool check = true;
             if (!isTargetting)
             {
                 check = false;
             }
             else if (AtkTargetObj == null)
             {
                 check = false;
             }
             else if (AtkTargetObj.Equals(AStarTargetObj))
             {
                 check = false;
             }
             if (check)
             {
                 myChampBehav.transform.DOLookAt(AtkTargetObj.transform.position, 0);
                 if (AtkTargetObj.tag.Equals("Minion"))
                 {
                     if (isAshe)
                     {
                         float moveTime = 0.4f;
                         myChampBehav.ArrowRPC(AtkTargetObj.transform.position, moveTime);
                     }
                     MinionBehavior behav    = AtkTargetObj.GetComponent <MinionBehavior>();
                     AudioSource    minAudio = behav.transform.GetChild(behav.transform.childCount - 1).GetComponent <AudioSource>();
                     if (behav != null)
                     {
                         int viewID = behav.GetComponent <PhotonView>().viewID;
                         myChampBehav.HitRPC(viewID);
                         ChampionSound.instance.IamAttackedSound(minAudio, champname);
                         if (isAshe)
                         {
                             asheSkill.qCountUp();
                         }
                         if (behav.HitMe(myChampionData.totalstat.Attack_Damage, "AD", myChampBehav.gameObject))
                         {
                             // 미니언쳤는데 죽었으면 cs, 골드 경험치 올려라
                             myChampionData.Kill_CS_Gold_Exp(AtkTargetObj.name, 1, AtkTargetObj.transform.position);
                             ResetTarget();
                         }
                         if (!skillKey.Equals(""))
                         {
                             if (--skillKeyNum < 1)
                             {
                                 skillKey = "";
                             }
                         }
                     }
                 }
                 //else if (AtkTargetObj.tag.Equals("Player"))
                 else if (AtkTargetObj.layer.Equals(LayerMask.NameToLayer("Champion")))
                 {//이 태그대로 할건지 바뀌는지는 모르겠음. 우선 챔피언 공격임.
                     if (isAshe)
                     {
                         float moveTime = 0.4f;
                         myChampBehav.ArrowRPC(AtkTargetObj.transform.position, moveTime);
                     }
                     ChampionBehavior behav      = AtkTargetObj.GetComponent <ChampionBehavior>();
                     AudioSource      champaudio = behav.gameObject.GetComponent <AudioSource>();
                     if (behav != null)
                     {
                         int viewID = behav.GetComponent <PhotonView>().viewID;
                         myChampBehav.HitRPC(viewID);
                         ChampionSound.instance.IamAttackedSound(champaudio, champname);
                         if (isAshe)
                         {
                             asheSkill.qCountUp();
                         }
                         if (behav.HitMe(myChampionData.totalstat.Attack_Damage, "AD", myChampBehav.gameObject, myChampBehav.name))
                         {
                             // 유저쳤는데 죽었으면 kill 골드 경험치 올려라
                             myChampionData.Kill_CS_Gold_Exp(AtkTargetObj.name, 0, AtkTargetObj.transform.position);
                             sysmsg.sendKillmsg(myChampionData.ChampionName, behav.GetComponent <ChampionData>().ChampionName, myChampBehav.Team);
                             ResetTarget();
                         }
                         if (!skillKey.Equals(""))
                         {
                             if (--skillKeyNum < 1)
                             {
                                 skillKey = "";
                             }
                         }
                     }
                 }
                 else if (AtkTargetObj.tag.Equals("Tower"))
                 {
                     if (isAshe)
                     {
                         float moveTime = 0.4f;
                         myChampBehav.ArrowRPC(AtkTargetObj.transform.position, moveTime);
                     }
                     TowerBehaviour behav      = AtkTargetObj.GetComponent <TowerBehaviour>();
                     AudioSource    towerAudio = behav.GetComponent <AudioSource>();
                     if (behav != null)
                     {
                         string key     = "";
                         char[] keyChar = behav.gameObject.name.ToCharArray();
                         for (int i = 13; i < 16; ++i)
                         {
                             key += keyChar[i];
                         }
                         myChampBehav.HitRPC(key);
                         ChampionSound.instance.IamAttackedSound(towerAudio, champname);
                         if (isAshe)
                         {
                             asheSkill.qCountUp();
                         }
                         if (behav.HitMe(myChampionData.totalstat.Attack_Damage))
                         {
                             // 타워쳤는데 죽으면 cs 골드 경험치 올려라
                             myChampionData.Kill_CS_Gold_Exp(AtkTargetObj.name, 2, AtkTargetObj.transform.position);
                             ResetTarget();
                         }
                         if (!skillKey.Equals(""))
                         {
                             if (--skillKeyNum < 1)
                             {
                                 skillKey = "";
                             }
                         }
                     }
                 }
                 else if (AtkTargetObj.tag.Equals("Suppressor"))
                 {
                     if (isAshe)
                     {
                         float moveTime = 0.4f;
                         myChampBehav.ArrowRPC(AtkTargetObj.transform.position, moveTime);
                     }
                     SuppressorBehaviour behav = AtkTargetObj.GetComponent <SuppressorBehaviour>();
                     if (behav != null)
                     {
                         string key     = "";
                         char[] keyChar = behav.gameObject.name.ToCharArray();
                         for (int i = 11; i < 14; ++i)
                         {
                             key += keyChar[i];
                         }
                         myChampBehav.HitRPC(key);
                         if (isAshe)
                         {
                             asheSkill.qCountUp();
                         }
                         if (behav.HitMe(myChampionData.totalstat.Attack_Damage))
                         {
                             // 억제기쳤는데 죽으면 cs 골드 경험치 올려라
                             myChampionData.Kill_CS_Gold_Exp(AtkTargetObj.name, 2, AtkTargetObj.transform.position);
                             ResetTarget();
                         }
                         if (!skillKey.Equals(""))
                         {
                             if (--skillKeyNum < 1)
                             {
                                 skillKey = "";
                             }
                         }
                     }
                 }
                 else if (AtkTargetObj.tag.Equals("Nexus"))
                 {
                     if (isAshe)
                     {
                         float moveTime = 0.4f;
                         myChampBehav.ArrowRPC(AtkTargetObj.transform.position, moveTime);
                     }
                     SuppressorBehaviour behav = AtkTargetObj.GetComponent <SuppressorBehaviour>();
                     if (behav != null)
                     {
                         string key     = "";
                         char[] keyChar = behav.gameObject.name.ToCharArray();
                         key += keyChar[6];
                         myChampBehav.HitRPC(key);
                         if (isAshe)
                         {
                             asheSkill.qCountUp();
                         }
                         if (behav.HitMe(myChampionData.totalstat.Attack_Damage))
                         {
                             ResetTarget();
                         }
                         if (!skillKey.Equals(""))
                         {
                             if (--skillKeyNum < 1)
                             {
                                 skillKey = "";
                             }
                         }
                     }
                 }
                 else if (AtkTargetObj.layer.Equals(LayerMask.NameToLayer("Monster")))
                 {
                     if (isAshe)
                     {
                         float moveTime = 0.4f;
                         myChampBehav.ArrowRPC(AtkTargetObj.transform.position, moveTime);
                     }
                     MonsterBehaviour behav = AtkTargetObj.GetComponent <MonsterBehaviour>();
                     if (behav != null)
                     {
                         int viewID = behav.GetComponent <PhotonView>().viewID;
                         myChampBehav.HitRPC(viewID);
                         if (isAshe)
                         {
                             asheSkill.qCountUp();
                         }
                         if (behav.HitMe(myChampionData.totalstat.Attack_Damage, "AD", myChamp))
                         {
                             // 죽었으면 cs올려라
                             //myChampionData.Kill_CS_Gold_Exp(AtkTargetObj.name, 3, AtkTargetObj.transform.position);
                             ResetTarget();
                         }
                         if (!skillKey.Equals(""))
                         {
                             if (--skillKeyNum < 1)
                             {
                                 skillKey = "";
                             }
                         }
                     }
                 }
             }
         }
         float AS = myChampionData.mystat.Attack_Speed * (1 + (myChampionData.totalstat.UP_AttackSpeed * (myChampionData.totalstat.Level - 1) + (myChampionData.totalstat.Attack_Speed - myChampionData.mystat.Attack_Speed)) / 100);
         atkDelayTime = 1f / AS;
         yield return(new WaitForSeconds(atkDelayTime));
     }
 }
コード例 #5
0
    private void ImpactTargetMonster(EntityModel monster, EntityModel ownerData, int affectTarget, int srcLevel, int srcHit)
    {
        MonsterBehaviour mBehavior            = (MonsterBehaviour)monster.Behaviour;
        SMsgPropCreateEntity_SC_Monster mData = (SMsgPropCreateEntity_SC_Monster)monster.EntityDataStruct;
        int  destLevel        = mData.MonsterUnitValues.UNIT_FIELD_LEVEL;
        int  destMiss         = mData.MonsterInvisibleValue.UNIT_FIELD_JOOK;
        bool monsterProtected = (mData.MonsterInvisibleValue.UINT_FILED_PROTECTED == 1);

        CampType monsterCampType = (CampType)(mData.MonsterUnitValues.UNIT_FIELD_FIGHT_HOSTILITY);

        if ((AffectTarget == 1 && monsterCampType != m_ownerCampType) || //作用于敌方阵营,子弹和目标怪物阵营不一致
            (AffectTarget == 2 && monsterCampType == m_ownerCampType) || //作用于己方阵营,子弹和目标怪物阵营一致
            AffectTarget == 3 ||          //所有
            AffectTarget == 6)
        {
            if (IsInShape(monster.GO.transform.position))
            {
                if (!mBehavior.IsDie &&
                    (!(mBehavior.Invincible || monsterProtected))
                    )
                {
                    if (m_ownerCampType == monsterCampType || IsHit(srcLevel, destLevel, srcHit, destMiss))
                    {
                        SendFightEffect(monster.EntityDataStruct.SMsg_Header.uidEntity);
                        if (EctGuideManager.Instance.IsEctypeGuide)
                        {
                            //发出命中消息,目前在副本引导里会进行命中后减速检测
                            RaiseEvent(EventTypeEnum.HitMonsterForGuide.ToString(), new BulletHitData()
                            {
                                BulletId = BulletID, BeFightId = mData.BaseObjectValues.OBJECT_FIELD_ENTRY_ID
                            });
                        }

                        EntityController.Instance.ShowHurtEffect(monster, (uint)BulletID, FormEntityID);
                        EntityController.Instance.ShowHurtUiEffect(ownerData, (uint)BulletID);

                        //新增 移除怪物 结算
                        if (m_impactData.m_damage_type == 3)
                        {
                            DoDestroySelf();
                            return;
                        }

                        if (m_impactData.m_beatBackSpeed == 0 && m_impactData.m_beatBackAcceleration == 0 && m_impactData.m_beatBackDuration != 0)
                        {
                            bool noneFreeze = false;
                            if (mBehavior.FSMSystem.CurrentStateID == StateID.MonsterAttack)
                            {
                                MonsterAttackState attackState = ((MonsterAttackState)mBehavior.FSMSystem.CurrentState);
                                noneFreeze = attackState.CurrentSkillBase != null &&
                                             attackState.CurrentSkillBase.OnFire &&
                                             attackState.CurrentSkillBase.CurrentActionThresHold == CommonDefineManager.Instance.CommonDefine.NoneFreezeIronLevel;
                            }
                            //horde
                            if (!noneFreeze)
                            {
                                Horde(monster.EntityDataStruct.SMsg_Header.uidEntity, monster.GO.transform.position);
                            }
                        }
                        else if (mData.MonsterUnitValues.UNIT_FIELD_SHARD == 0 && !mBehavior.IronBody && mData.MonsterInvisibleValue.UNIT_FIELD_ARMOR != 1)                         //shield broke
                        {
                            Vector3 beatBackDir = Vector3.zero;
                            if (ownerData == null)                           //怪物实体不存在的情况 (死亡子弹)
                            {
                                beatBackDir = GetBeatBackDir(monster.GO.transform, monster.GO.transform);
                            }
                            else
                            {
                                beatBackDir = GetBeatBackDir(ownerData.GO.transform, monster.GO.transform);
                            }


                            if (m_impactData.m_beatFlyLevel > 0)
                            {
                                //fly
                                BeatFly(monster.EntityDataStruct.SMsg_Header.uidEntity, monster.GO.transform.position, beatBackDir);
                            }
                            else if (m_impactData.m_beatBackLevel > 0)
                            {
                                if (m_impactData.m_beatBackDir == 6)
                                {
                                    //absord
                                    Absord(monster.EntityDataStruct.SMsg_Header.uidEntity, monster.GO.transform.position, beatBackDir);
                                }
                                else
                                {
                                    //beat back
                                    BeatBack(monster.EntityDataStruct.SMsg_Header.uidEntity, monster.GO.transform.position, beatBackDir);
                                }
                            }
                        }
                        if (BulletData.m_overParam == 2)
                        {
                            DoDestroySelf();
                        }
                    }
                    else
                    {
                        Miss(monster.EntityDataStruct.SMsg_Header.uidEntity);
                        if (AffectTarget == 6)                       //只结算一次
                        {
                            DoDestroySelf();
                        }
                    }
                }
            }
        }
    }
コード例 #6
0
    public virtual void Attack(MonsterBehaviour _monster)
    {
        GameObject g = ObjectPoolManager.Instance.Get(prop.effectName);

        g.transform.position = _monster.transform.position;
    }
コード例 #7
0
    /// <summary>
    /// W 스킬 함수
    /// </summary>
    public override void W()
    {
        GameObject enemyObj    = wArguObj;
        Vector3    enemyVector = wArguVec;

        OnMove();
        HitEffectRPC("Alistar", "W");
        GameObject obj = GetSkillInThePool("W");

        obj.transform.position = transform.position;
        obj.SetActive(true);

        // 공격하는 대상에 따라 공격 처리를 한다.
        if (enemyObj.tag.Equals("Minion"))
        {
            MinionBehavior minBehav = enemyObj.GetComponent <MinionBehavior>();

            // 적인지 확인
            if (!enemyObj.gameObject.name.Contains(TheChampionBehaviour.team))
            {
                MinionAtk  minAtk       = minBehav.minAtk;
                Vector3    directionVec = (enemyObj.transform.position - enemyVector).normalized;
                Vector3    maxVec       = enemyObj.transform.position + (directionVec * 10);;
                RaycastHit hit;

                if (Physics.Raycast(minAtk.transform.position, directionVec, out hit, 12, 1 << LayerMask.NameToLayer("WallCollider")))
                {
                    float dist = Vector3.Distance(hit.point, enemyObj.transform.position);
                    maxVec = enemyObj.transform.position + (directionVec * (dist - 1f));
                }

                //밀친 후 공격당한 대상의 HitMe 함수를 호출
                maxVec.y = 0;
                minAtk.PushMe(maxVec, 0.5f);
                minAtk.PauseAtk(1f, true);
                float damage = skillData.wDamage[TheChampionData.skill_W - 1] + Acalculate(skillData.wAstat, skillData.wAvalue);

                if (minBehav != null)
                {
                    int viewID = minBehav.GetComponent <PhotonView>().viewID;
                    HitRPC(viewID, damage, "AP", "Push");
                    minBehav.HitMe(damage, "AP", gameObject);
                }
            }
        }
        else if (enemyObj.layer.Equals(LayerMask.NameToLayer("Champion")))
        {
            ChampionBehavior champBehav = enemyObj.GetComponent <ChampionBehavior>();

            // 적인지 확인
            if (champBehav.team != TheChampionBehaviour.team)
            {
                ChampionAtk champAtk     = champBehav.myChampAtk;
                Vector3     directionVec = (enemyObj.transform.position - enemyVector).normalized;
                Vector3     maxVec       = enemyObj.transform.position + (directionVec * 5);;
                RaycastHit  hit;

                if (Physics.Raycast(champAtk.transform.position, directionVec, out hit, 6, 1 << LayerMask.NameToLayer("WallCollider")))
                {
                    float dis = Vector3.Distance(hit.point, enemyObj.transform.position);
                    maxVec = enemyObj.transform.position + (directionVec * (dis - 1f));
                }

                //밀친 후 공격당한 대상의 HitMe 함수를 호출
                maxVec.y = 0.5f;
                champAtk.PushMe(maxVec, 0.5f);
                champAtk.PauseAtk(1f, true);
                float damage = skillData.wDamage[TheChampionData.skill_W - 1] + Acalculate(skillData.wAstat, skillData.wAvalue);

                if (champBehav != null)
                {
                    int viewID = champBehav.GetComponent <PhotonView>().viewID;

                    HitRPC(viewID, damage, "AP", "Push");
                    champBehav.HitMe(damage, "AP", gameObject, gameObject.name);
                }
            }
        }
        else if (enemyObj.layer.Equals(LayerMask.NameToLayer("Monster")))
        {
            MonsterBehaviour monBehav     = enemyObj.GetComponent <MonsterBehaviour>();
            MonsterAtk       monAtk       = monBehav.monAtk;
            Vector3          directionVec = (enemyObj.transform.position - enemyVector).normalized;
            Vector3          maxVec       = enemyObj.transform.position + (directionVec * 5);;
            RaycastHit       hit;

            if (Physics.Raycast(monAtk.transform.position, directionVec, out hit, 6, 1 << LayerMask.NameToLayer("WallCollider")))
            {
                float dist = Vector3.Distance(hit.point, enemyObj.transform.position);
                maxVec = enemyObj.transform.position + (directionVec * (dist - 1f));
            }

            //밀친 후 공격당한 대상의 HitMe 함수를 호출
            maxVec.y = 0;
            monAtk.PushMe(maxVec, 0.5f);
            monAtk.PauseAtk(1f, true);
            float damage = skillData.wDamage[TheChampionData.skill_W - 1] + Acalculate(skillData.wAstat, skillData.wAvalue);

            if (monBehav != null)
            {
                int viewID = monBehav.GetComponent <PhotonView>().viewID;
                HitRPC(viewID, damage, "AP", "Push");
                monBehav.HitMe(damage, "AP", gameObject);
            }
        }

        // 스킬 선택을 해제함
        skillSelect = SkillSelect.none;
    }
コード例 #8
0
 public void setCurrentMonster(MonsterBehaviour m)
 {
     _monsterSelected = m;
 }
コード例 #9
0
 /// <summary>
 /// 重写基类,怪物Prefab有两个状态,正常和死亡分离
 /// </summary>
 /// <param name="role"></param>
 public override void SetRole(View role)
 {
     this.m_roleBehaviour          = role;
     m_MonsterBehaviour            = (MonsterBehaviour)this.m_roleBehaviour;
     this.m_roleAnimationComponent = m_MonsterBehaviour.NormalStatus.animation;
 }
コード例 #10
0
    private void OnTriggerEnter(Collider other)
    {
        if (firstAtk)
        {
            bool trig = false;
            if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Champion")))
            {
                if (other.gameObject.Equals(mySkill.gameObject))
                {
                    return;
                }
                ChampionBehavior cB = other.GetComponent <ChampionBehavior>();
                if (cB.Team != mySkill.TheChampionBehaviour.Team)
                {
                    trig = true;
                    float damage = mySkill.skillData.qDamage[mySkill.TheChampionData.skill_Q - 1]
                                   + mySkill.Acalculate(mySkill.skillData.qAstat, mySkill.skillData.qAvalue);
                    if (cB != null)
                    {
                        //int viewID = mB.GetComponent<PhotonView>().viewID;
                        //mySkill.HitRPC(viewID, damage, "AP");
                        int x2 = 1;
                        ChampionSound.instance.PlayOtherFx(cB.GetComponentInChildren <AudioSource>(), ChampionSound.instance.Mundo_Q_Hit);
                        if (cB.HitMe(damage, "AP", mySkill.gameObject, mySkill.name))
                        {
                            x2 = 2;
                            mySkill.TheChampionAtk.ResetTarget();
                            if (!sysmsg)
                            {
                                sysmsg = GameObject.FindGameObjectWithTag("SystemMsg").GetComponent <SystemMessage>();
                            }
                            sysmsg.sendKillmsg("mundo", other.GetComponent <ChampionData>().ChampionName, mySkill.TheChampionBehaviour.Team.ToString());
                            // 스킬쏜애 주인이 나면 킬올리자
                            if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                            {
                                mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 0, other.transform.position);
                            }
                        }
                        mySkill.Heal(damage * x2);
                    }
                }
            }
            else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Monster")))
            {
                MonsterBehaviour mB     = other.GetComponent <MonsterBehaviour>();
                float            damage = mySkill.skillData.qDamage[mySkill.TheChampionData.skill_Q - 1]
                                          + mySkill.Acalculate(mySkill.skillData.qAstat, mySkill.skillData.qAvalue);
                if (mB != null)
                {
                    trig = true;
                    //int viewID = mB.GetComponent<PhotonView>().viewID;
                    //mySkill.HitRPC(viewID, damage, "AP");
                    int x2 = 1;
                    //몬스터 오디오 처리하면 켤것
                    //ChampionSound.instance.PlayOtherFx(mB.GetComponentInChildren<AudioSource>(), ChampionSound.instance.Mundo_Q_Hit);
                    if (mB.HitMe(damage, "AP", mySkill.gameObject))
                    {
                        x2 = 2;
                        mySkill.TheChampionAtk.ResetTarget();

                        //// 스킬쏜애 주인이 나면 킬올리자
                        //if (mySkill.GetComponent<PhotonView>().owner.Equals(PhotonNetwork.player))
                        //{
                        //    mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 3, other.transform.position);

                        //}
                    }
                    mySkill.Heal(damage * x2);
                }
            }
            else if (other.tag.Equals("Minion"))
            {
                MinionBehavior mB = other.GetComponent <MinionBehavior>();
                if (!other.name.Contains(mySkill.TheChampionBehaviour.Team))
                {
                    trig = true;
                    float damage = mySkill.skillData.qDamage[mySkill.TheChampionData.skill_Q - 1]
                                   + mySkill.Acalculate(mySkill.skillData.qAstat, mySkill.skillData.qAvalue);
                    if (mB != null)
                    {
                        //int viewID = mB.GetComponent<PhotonView>().viewID;
                        //mySkill.HitRPC(viewID, damage, "AP");
                        ChampionSound.instance.PlayOtherFx(mB.Audio, ChampionSound.instance.Mundo_Q_Hit);
                        int x2 = 1;
                        if (mB.HitMe(damage, "AP", mySkill.gameObject))
                        {
                            x2 = 2;
                            mySkill.TheChampionAtk.ResetTarget();

                            // 스킬쏜애 주인이 나면 킬올리자
                            if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                            {
                                mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 1, other.transform.position);
                            }
                        }
                        mySkill.Heal(damage * x2);
                    }
                }
            }

            if (trig)
            {
                gameObject.SetActive(false);
                firstAtk = false;
            }
        }
    }
コード例 #11
0
 public void setTarget(MonsterBehaviour m)
 {
     _target = m;
 }
コード例 #12
0
 void OnDestroyedMonster(MonsterBehaviour value)
 {
     monstersOnScreen.Remove(value);
 }
コード例 #13
0
    IEnumerator AtkMotion()
    {
        while (true)
        {
            if (!isAtkPause)
            {
                bool check = true;
                if (nowTarget == null)
                {
                    check = false;
                }
                else if (!nowTarget.activeInHierarchy)
                {
                    check = false;
                }
                if (check)
                {
                    Anim.SetBool("walking", false);
                    Anim.SetBool("attack", true);

                    myMonster.transform.DOLookAt(nowTarget.transform.position, 1);

                    if (nowTarget.layer.Equals(LayerMask.NameToLayer("Champion")))
                    {
                        ChampionBehavior behav = nowTarget.GetComponent <ChampionBehavior>();
                        if (behav != null)
                        {
                            int viewID = behav.GetComponent <PhotonView>().viewID;
                            myBehav.HitRPC(viewID);
                            if (behav.HitMe(myBehav.stat.Attack_Damage, "AD", myMonster, myMonster.name))
                            {
                                //ResetTarget();
                                sysmsg.sendKillmsg("monster", behav.GetComponent <ChampionData>().ChampionName, "ex");
                                enemiesList.Remove(nowTarget);
                                if (enemiesList.Count < 1)
                                {
                                    isReturn = true;
                                    for (int i = 0; i < myBehav.friendsList.Count; ++i)
                                    {
                                        if (myBehav.friendsList[i] != null)
                                        {
                                            if (myBehav.friendsList[i].activeInHierarchy)
                                            {
                                                MonsterBehaviour m = myBehav.friendsList[i].GetComponent <MonsterBehaviour>();
                                                if (m.monAtk.enemiesList.Contains(nowTarget))
                                                {
                                                    m.monAtk.enemiesList.Remove(nowTarget);
                                                }
                                                m.monAtk.isReturn = true;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            atkDelayTime = 1f;
            yield return(new WaitForSeconds(1));
        }
    }
コード例 #14
0
    private void OnTriggerEnter(Collider other)
    {
        a.Add(other.gameObject);
        if (firstAtk)
        {
            bool trig = false;
            if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Champion")))
            {
                if (!other.gameObject.Equals(mySkill.gameObject))
                {
                    ChampionBehavior mB = other.GetComponent <ChampionBehavior>();
                    if (mB.Team != mySkill.TheChampionBehaviour.Team)
                    {
                        trig = true;
                        float damage = mySkill.skillData.wDamage[mySkill.TheChampionData.skill_W - 1]
                                       + mySkill.Acalculate(mySkill.skillData.wAstat, mySkill.skillData.wAvalue);
                        if (mB != null)
                        {
                            if (mB.HitMe(damage, "AD", mySkill.gameObject, mySkill.name))
                            {
                                mySkill.TheChampionAtk.ResetTarget();
                                if (!sysmsg)
                                {
                                    sysmsg = GameObject.FindGameObjectWithTag("SystemMsg").GetComponent <SystemMessage>();
                                }
                                //sysmsg.sendKillmsg("ashe", other.GetComponent<ChampionData>().ChampionName, mySkill.TheChampionBehaviour.Team.ToString());
                                // 스킬쏜애 주인이 나면 킬올리자
                                if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                                {
                                    mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 0, other.transform.position);
                                }
                            }
                        }
                    }
                }
            }
            else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Monster")))
            {
                MonsterBehaviour mB     = other.GetComponent <MonsterBehaviour>();
                float            damage = mySkill.skillData.wDamage[mySkill.TheChampionData.skill_W - 1]
                                          + mySkill.Acalculate(mySkill.skillData.wAstat, mySkill.skillData.wAvalue);
                if (mB != null)
                {
                    trig = true;
                    if (mB.HitMe(damage, "AD", mySkill.gameObject))
                    {
                        mySkill.TheChampionAtk.ResetTarget();
                        //// 스킬쏜애 주인이 나면 킬올리자
                        //if (mySkill.GetComponent<PhotonView>().owner.Equals(PhotonNetwork.player))
                        //{
                        //   //mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 3, other.transform.position);
                        //}
                    }
                }
            }
            else if (other.tag.Equals("Minion"))
            {
                MinionBehavior mB = other.GetComponent <MinionBehavior>();
                if (!other.name.Contains(mySkill.TheChampionBehaviour.Team))
                {
                    trig = true;
                    float damage = mySkill.skillData.wDamage[mySkill.TheChampionData.skill_W - 1]
                                   + mySkill.Acalculate(mySkill.skillData.wAstat, mySkill.skillData.wAvalue);
                    if (mB != null)
                    {
                        if (mB.HitMe(damage, "AD", mySkill.gameObject))
                        {
                            mySkill.TheChampionAtk.ResetTarget();

                            // 스킬쏜애 주인이 나면 킬올리자
                            if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                            {
                                mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 1, other.transform.position);
                            }
                        }
                    }
                }
            }

            if (trig)
            {
                gameObject.SetActive(false);
                firstAtk = false;
            }
        }
    }
コード例 #15
0
ファイル: AIAttack.cs プロジェクト: kyn320/SwordLine
 protected virtual void Awake()
 {
     monster = GetComponent<MonsterBehaviour>();
 }
コード例 #16
0
    private void Update()
    {
        damageTime -= Time.deltaTime;

        // 0.5초마다 반경 내의 적에게 데미지를 준다
        if (damageTime <= 0)
        {
            damageTime = 0.5f;

            for (int i = 0; i < enemyList.Count; ++i)
            {
                if (enemyList[i].Equals(mySkill.gameObject))
                {
                    continue;
                }

                float damage = mySkill.skillData.wDamage[mySkill.TheChampionData.skill_W - 1]
                               + mySkill.Acalculate(mySkill.skillData.wAstat, mySkill.skillData.wAvalue, true);

                // 현재 충돌한 적에 따라 각각의 HitMe 함수를 호출한다
                if (enemyList[i].layer.Equals(LayerMask.NameToLayer("Champion")))
                {
                    ChampionBehavior champBehav = enemyList[i].GetComponent <ChampionBehavior>();

                    if (champBehav.team != mySkill.TheChampionBehaviour.team)
                    {
                        if (champBehav != null)
                        {
                            champBehav.HitMe(damage, "AP", mySkill.gameObject, mySkill.name);

                            if (champBehav.myChampionData.totalStat.Hp <= 0)
                            {
                                enemyDeleteStack.Push(enemyList[i]);
                            }
                        }
                    }
                }
                else if (enemyList[i].layer.Equals(LayerMask.NameToLayer("Monster")))
                {
                    MonsterBehaviour monBehav = enemyList[i].GetComponent <MonsterBehaviour>();

                    if (monBehav != null)
                    {
                        if (monBehav.HitMe(damage, "AP", mySkill.gameObject))
                        {
                            mySkill.TheChampionAtk.ResetTarget();
                            enemyDeleteStack.Push(enemyList[i]);
                        }

                        if (monBehav.stat.Hp <= 0)
                        {
                            enemyDeleteStack.Push(enemyList[i]);
                        }
                    }
                }
                else if (enemyList[i].tag.Equals("Minion"))
                {
                    MinionBehavior minBehav = enemyList[i].GetComponent <MinionBehavior>();

                    if (!enemyList[i].name.Contains(mySkill.TheChampionBehaviour.team))
                    {
                        if (minBehav != null)
                        {
                            minBehav.HitMe(damage, "AP", mySkill.gameObject);

                            if (minBehav.stat.Hp <= 0)
                            {
                                enemyDeleteStack.Push(enemyList[i]);
                            }
                        }
                    }
                }

                // 죽은 적은 데미지를 입히는 대상에서 제외시킨다
                while (enemyDeleteStack.Count > 0)
                {
                    GameObject deletingEnemyObj = enemyDeleteStack.Pop();

                    if (enemyList.Contains(deletingEnemyObj))
                    {
                        enemyList.Remove(deletingEnemyObj);
                    }
                }
            }
        }
    }
コード例 #17
0
ファイル: AlistarQ.cs プロジェクト: kunana/AOS
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag.Equals("Minion")) //나중에챔피언일때도적일때도조건에추가
        {                               //미니언의 경우 트리거 켜진건 공격 추-적 반경이라 디스턴스를 추가
         //if (Vector3.Distance(other.transform.position, transform.position) <= skillRange)
         //{
            MinionBehavior mB = other.GetComponent <MinionBehavior>();
            if (!other.gameObject.name.Contains(mySkill.TheChampionBehaviour.Team))
            {
                mB.minAtk.PauseAtk(1f, true);
                //other.GetComponent<Rigidbody>().AddForce(0, upPower, 0);
                //s = other.transform.DOJump(other.transform.position, 3, 1, 1f).OnUpdate(() => { if (mB.isDead) if (s != null) s.Kill(); });
                float damage = mySkill.skillData.qDamage[mySkill.TheChampionData.skill_Q - 1]
                               + mySkill.Acalculate(mySkill.skillData.qAstat, mySkill.skillData.qAvalue);
                //공격 코드(데미지 등) 삽입'
                //float damage = mySkill.QSkillInfo.myskill.Damage[mySkill.QSkillInfo.myskill.skillLevel]
                //    + mySkill.QSkillInfo.Acalculate(mySkill.QSkillInfo.myskill.Astat, mySkill.QSkillInfo.myskill.Avalue);

                if (mB != null)
                {
                    int viewID = mB.GetComponent <PhotonView>().viewID;
                    //mySkill.HitRPC(viewID, damage, "AP", "Jump");
                    if (mB.HitMe(damage, "AP", mySkill.gameObject))
                    {
                        //여기에는 나중에 평타 만들면 플레이어의 현재 공격 타겟이 죽었을 시 초기화해주는 것을 넣자.
                        mySkill.TheChampionAtk.ResetTarget();

                        // 스킬쏜애 주인이 나면 킬올리자
                        if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                        {
                            mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 1, other.transform.position);
                        }
                    }
                }
            }
        }
        //else if (other.tag.Equals("Player"))
        else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Champion")))
        {
            ChampionBehavior cB = other.GetComponent <ChampionBehavior>();
            if (cB.Team != mySkill.TheChampionBehaviour.Team)
            {
                cB.myChampAtk.PauseAtk(1f, true);
                float damage = mySkill.skillData.qDamage[mySkill.TheChampionData.skill_Q - 1]
                               + mySkill.Acalculate(mySkill.skillData.qAstat, mySkill.skillData.qAvalue);
                if (cB != null)
                {
                    int viewID = cB.GetComponent <PhotonView>().viewID;
                    //mySkill.HitRPC(viewID, damage, "AP", "Jump");
                    if (cB.HitMe(damage, "AP", mySkill.gameObject, mySkill.name))
                    {
                        mySkill.TheChampionAtk.ResetTarget();
                        if (!sysmsg)
                        {
                            sysmsg = GameObject.FindGameObjectWithTag("SystemMsg").GetComponent <SystemMessage>();
                        }
                        sysmsg.sendKillmsg("alistar", other.GetComponent <ChampionData>().ChampionName, mySkill.TheChampionBehaviour.Team.ToString());
                        // 스킬쏜애 주인이 나면 킬올리자
                        if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                        {
                            mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 0, other.transform.position);
                        }
                    }
                }
                //s = other.transform.DOJump(other.transform.position, 3, 1, 1f).OnUpdate(() =>
                //{
                //    if (cB.myChampionData.totalstat.Hp - ((damage * 100f) / (100f + cB.myChampionData.totalstat.Ability_Def)) <= 1)
                //    {
                //        if (s != null)
                //            s.Kill();
                //    }
                //});
            }
        }
        else if (other.gameObject.layer.Equals(LayerMask.NameToLayer("Monster")))
        {
            MonsterBehaviour mB = other.GetComponent <MonsterBehaviour>();
            mB.monAtk.PauseAtk(1f, true);
            //s = other.transform.DOJump(other.transform.position, 3, 1, 1f).OnUpdate(() => { if (mB.isDead) if (s != null) s.Kill(); });
            float damage = mySkill.skillData.qDamage[mySkill.TheChampionData.skill_Q - 1]
                           + mySkill.Acalculate(mySkill.skillData.qAstat, mySkill.skillData.qAvalue);
            if (mB != null)
            {
                int viewID = mB.GetComponent <PhotonView>().viewID;
                //mySkill.HitRPC(viewID, damage, "AP", "Jump");
                if (mB.HitMe(damage, "AP", mySkill.gameObject))
                {
                    mySkill.TheChampionAtk.ResetTarget();

                    //// 스킬쏜애 주인이 나면 킬올리자
                    //if (mySkill.GetComponent<PhotonView>().owner.Equals(PhotonNetwork.player))
                    //{
                    //    mySkill.TheChampionData.Kill_CS_Gold_Exp(other.gameObject.name, 3, other.transform.position);
                    //}
                }
            }
        }
    }
コード例 #18
0
    private void Update()
    {
        if (atkDelayTime > 0)
        {
            atkDelayTime -= Time.deltaTime;
            if (!isAtkDelayTime)
            {
                isAtkDelayTime = true;
            }
        }
        else
        {
            if (isAtkDelayTime)
            {
                isAtkDelayTime = false;
            }
        }
        if (isWarding)
        {
            if (willAtkAround)
            {
                willAtkAround = false;
            }
            if (Vector3.Distance(transform.position, AStarTargetObj.transform.position) < 15f)
            {
                isWarding = false;
                --wardAmount;
                myChampBehav.WardRPC(myChampBehav.Team, myChampionData.mystat.Level, AStarTargetObj.transform.position);
                AStarTargetObj.transform.position = transform.position;
                ResetTarget();
            }
        }
        if (willAtkAround)
        {
            float      dist = 1000000, nowD;
            GameObject temp = null;
            for (int i = 0; i < enemiesList.Count; ++i)
            {
                if (enemiesList[i].tag.Equals("Tower"))
                {
                    if (!enemiesList[i].GetComponent <TowerBehaviour>().isCanAtkMe)
                    {
                        continue;
                    }
                }
                else if (enemiesList[i].tag.Equals("Suppressor") || enemiesList[i].tag.Equals("Nexus"))
                {
                    if (!enemiesList[i].GetComponent <SuppressorBehaviour>().isCanAtkMe)
                    {
                        continue;
                    }
                }
                else if (enemiesList[i].layer.Equals(LayerMask.NameToLayer("Monster")))
                {
                    MonsterBehaviour m = enemiesList[i].GetComponent <MonsterBehaviour>();
                    if (!m.TheFogEntity.isCanTargeting)
                    {
                        continue;
                    }
                    if (!m.monAtk.isAtking)
                    {
                        continue;
                    }
                }
                nowD = (enemiesList[i].transform.position - myChamp.transform.position).sqrMagnitude;
                if (dist > nowD)
                {
                    dist = nowD;
                    temp = enemiesList[i];
                }
                if (temp != null)
                {
                    AtkTargetObj = temp;
                    isTargetting = true;
                }
            }
        }
        if (AtkTargetObj != null)
        {
            if (isTargetting && AtkTargetObj.activeInHierarchy)
            {
                if (TheAIDest.target != AtkTargetObj.transform)
                {
                    TheAIDest.target = AtkTargetObj.transform;
                }

                tempVec1   = AtkTargetObj.transform.position;
                tempVec2   = myChamp.transform.position;
                tempVec1.y = 0;
                tempVec2.y = 0;
                float atkRevision = 0;
                if (AtkTargetObj.tag.Equals("Tower") && AtkRange < 5)//타워 크기 보정
                {
                    atkRevision = 1f;
                }
                else if (AtkTargetObj.tag.Equals("Suppressor") && AtkRange < 5)//억제기 반지름 보정
                {
                    atkRevision = 2.5f;
                }
                else if (AtkTargetObj.tag.Equals("Nexus") && AtkRange < 5)
                {
                    atkRevision = 7f;
                }

                if (Vector3.Distance(tempVec1, tempVec2) > AtkRange + atkRevision)
                {//머니까 겁내 뛰어가자
                    if (!TheAIPath.canMove)
                    {
                        TheAIPath.canMove   = true;
                        TheAIPath.canSearch = true;
                        myChampionAnimation.AttackAnimation(false);
                    }
                    if (AtkCoroutine != null)
                    {
                        myChampionAnimation.AttackAnimation(false);
                        StopCoroutine(AtkCoroutine);
                        AtkCoroutine = null;
                    }
                }
                else
                {//패자 계속 갈구자
                    if (!isAtkDelayTime)
                    {
                        if (TheAIPath.canMove)
                        {
                            TheAIPath.canMove   = false;
                            TheAIPath.canSearch = false;

                            myChampionAnimation.AttackAnimation(true);
                        }
                        if (AtkCoroutine == null)
                        {
                            AtkCoroutine = StartCoroutine(AtkMotion());
                        }
                    }
                }
            }
            else
            {
                ResetTarget();
            }
        }
        else
        {
            ResetTarget();
        }

        if (wardAmount < 2)
        {
            wardMadeCooldown -= Time.deltaTime;
            if (wardMadeCooldown <= 0f)
            {
                ++wardAmount;
                wardMadeCooldown = Mathf.Round(wardMadeMaxTime - ((wardMadeTermTime * ((float)(myChampionData.mystat.Level - 1))) / 17f));
            }
        }
    }
コード例 #19
0
    private void Update()
    {
        damagetime -= Time.deltaTime;
        if (damagetime <= 0)
        {
            damagetime = 0.5f;
            for (int i = 0; i < EnemyList.Count; ++i)
            {
                if (EnemyList[i].Equals(mySkill.gameObject))
                {
                    continue;
                }
                float damage = mySkill.skillData.wDamage[mySkill.TheChampionData.skill_W - 1]
                               + mySkill.Acalculate(mySkill.skillData.wAstat, mySkill.skillData.wAvalue);
                if (EnemyList[i].layer.Equals(LayerMask.NameToLayer("Champion")))
                {
                    ChampionBehavior cB = EnemyList[i].GetComponent <ChampionBehavior>();
                    if (cB.Team != mySkill.TheChampionBehaviour.Team)
                    {
                        if (cB != null)
                        {
                            if (cB.HitMe(damage, "AP", mySkill.gameObject, mySkill.name))
                            {
                                mySkill.TheChampionAtk.ResetTarget();
                                //if (!sysmsg)
                                //    sysmsg = GameObject.FindGameObjectWithTag("SystemMsg").GetComponent<SystemMessage>();
                                //sysmsg.sendKillmsg("mundo", EnemyList[i].GetComponent<ChampionData>().ChampionName, mySkill.TheChampionBehaviour.Team.ToString());
                                // 스킬쏜애 주인이 나면 킬올리자
                                if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                                {
                                    mySkill.TheChampionData.Kill_CS_Gold_Exp(EnemyList[i].gameObject.name, 0, EnemyList[i].transform.position);
                                }
                                EnemyDeleteStack.Push(EnemyList[i]);
                            }
                            if (cB.myChampionData.totalstat.Hp <= 0)
                            {
                                EnemyDeleteStack.Push(EnemyList[i]);
                            }
                        }
                    }
                }
                else if (EnemyList[i].layer.Equals(LayerMask.NameToLayer("Monster")))
                {
                    MonsterBehaviour mB = EnemyList[i].GetComponent <MonsterBehaviour>();
                    if (mB != null)
                    {
                        if (mB.HitMe(damage, "AP", mySkill.gameObject))
                        {
                            mySkill.TheChampionAtk.ResetTarget();

                            //// 스킬쏜애 주인이 나면 킬올리자
                            //if (mySkill.GetComponent<PhotonView>().owner.Equals(PhotonNetwork.player))
                            //{
                            //    mySkill.TheChampionData.Kill_CS_Gold_Exp(EnemyList[i].gameObject.name, 3, EnemyList[i].transform.position);
                            //}
                            EnemyDeleteStack.Push(EnemyList[i]);
                        }
                        if (mB.stat.Hp <= 0)
                        {
                            EnemyDeleteStack.Push(EnemyList[i]);
                        }
                    }
                }
                else if (EnemyList[i].tag.Equals("Minion"))
                {
                    MinionBehavior mB = EnemyList[i].GetComponent <MinionBehavior>();
                    if (!EnemyList[i].name.Contains(mySkill.TheChampionBehaviour.Team))
                    {
                        if (mB != null)
                        {
                            if (mB.HitMe(damage, "AP", mySkill.gameObject))
                            {
                                mySkill.TheChampionAtk.ResetTarget();

                                // 스킬쏜애 주인이 나면 킬올리자
                                if (mySkill.GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                                {
                                    mySkill.TheChampionData.Kill_CS_Gold_Exp(EnemyList[i].gameObject.name, 1, EnemyList[i].transform.position);
                                }
                                EnemyDeleteStack.Push(EnemyList[i]);
                            }
                            if (mB.stat.Hp <= 0)
                            {
                                EnemyDeleteStack.Push(EnemyList[i]);
                            }
                        }
                    }
                }
                while (EnemyDeleteStack.Count > 0)
                {
                    GameObject g = EnemyDeleteStack.Pop();
                    if (EnemyList.Contains(g))
                    {
                        EnemyList.Remove(g);
                    }
                }
            }
        }
    }
コード例 #20
0
ファイル: UIEnemy.cs プロジェクト: kunana/AOS
    public void ApplyObject(GameObject go)
    {
        selectedObject = go;

        // 챔피언을 눌렀을때
        if (go.layer.Equals(LayerMask.NameToLayer("Champion")))
        {
            selectType = SelectType.player;
            cd         = go.GetComponent <ChampionData>();

            // 챔피언의 스탯을 가져와서 스탯업데이트
            stat       = cd.totalstat;
            originstat = cd.mystat;
            StatUpdate();

            // 챔피언의 아이콘을 가져와서 아이콘 업데이트
            icon.sprite = Resources.Load <Sprite>("Champion/ChampionIcon/" + cd.ChampionName);

            // 챔피언의 아이템을 가져와서 아이템 업데이트
            ItemUpdate();
        }

        else if (go.layer.Equals(LayerMask.NameToLayer("Monster")))
        {
            selectType = SelectType.monster;
            monB       = go.GetComponent <MonsterBehaviour>();
            stat       = monB.stat;
            StatUpdate();
            icon.sprite = null;
        }

        // 미니언을 눌렀을때
        else if (go.CompareTag("Minion"))
        {
            selectType = SelectType.minion;
            mb         = go.GetComponent <MinionBehavior>();

            stat = mb.stat;
            StatUpdate();

            if (mb.name.Contains("Red"))
            {
                if (mb.name.Contains("Magician"))
                {
                    icon.sprite = Resources.Load <Sprite>("Icon/Minion_caster_red");
                }
                else if (mb.name.Contains("Melee"))
                {
                    icon.sprite = Resources.Load <Sprite>("Icon/Minion_melee_red");
                }
                else if (mb.name.Contains("Siege"))
                {
                    icon.sprite = Resources.Load <Sprite>("Icon/Minion_siege_red");
                }
            }
            else if (mb.name.Contains("Blue"))
            {
                if (mb.name.Contains("Magician"))
                {
                    icon.sprite = Resources.Load <Sprite>("Icon/Minion_caster_blue");
                }
                else if (mb.name.Contains("Melee"))
                {
                    icon.sprite = Resources.Load <Sprite>("Icon/Minion_melee_blue");
                }
                else if (mb.name.Contains("Siege"))
                {
                    icon.sprite = Resources.Load <Sprite>("Icon/Minion_siege_blue");
                }
            }
            else
            {
                icon.sprite = null;
            }

            for (int i = 0; i < itemicon.Length; i++)
            {
                itemicon[i].gameObject.GetComponent <ItemInfo>().myItem = null;
                itemicon[i].sprite = null;
                itemicon[i].color  = new Color(14f / 255f, 26f / 255f, 23f / 255f, 1);
            }
        }

        // 타워를 눌렀을때
        else if (go.CompareTag("Tower"))
        {
            selectType = SelectType.tower;
            tb         = go.GetComponent <TowerBehaviour>();

            stat = tb.towerstat;
            StatUpdate();

            if (tb.Team.Equals("Red"))
            {
                icon.sprite = Resources.Load <Sprite>("Icon/Tower_Icon_Red");
            }
            else if (tb.Team.Equals("Blue"))
            {
                icon.sprite = Resources.Load <Sprite>("Icon/Tower_Icon_Blue");
            }
            else
            {
                icon.sprite = null;
            }

            for (int i = 0; i < itemicon.Length; i++)
            {
                itemicon[i].gameObject.GetComponent <ItemInfo>().myItem = null;
                itemicon[i].sprite = null;
                itemicon[i].color  = new Color(14f / 255f, 26f / 255f, 23f / 255f, 1);
            }
        }
    }