Пример #1
0
    public bool Create(EctypeCreatContext createContext)
    {
        mCreateContext = createContext;
        m_attackerTeam = new EctypeTeamAttacker(this);
        m_defenderTeam = new EctypeTeamDefender(this);

        for (int i = 0; i < mCreateContext.attackerTeam.entityList.Count; i++)
        {
            EntityCreateCtx ctx      = mCreateContext.attackerTeam.entityList[i];
            EctypeEntity    attacker = new EctypeEntity();
            attacker.entity = GameMgr.Instance.m_entityMgr.Build(ctx);

            if (attacker.entity == null)
            {
                Debug.Log("Ectype::Create Attacker failed !");
                continue;
            }
            attacker.Status = EntityEctypeStatus.Idle;
            attacker.Camp   = EntityCamp.Attacker;

            m_attackerTeam.m_entityList.Add(attacker);
            GameMgr.Instance.m_uiMgr.UIFight.CreateAttacker(attacker.entity);
        }

        for (int i = 0; i < mCreateContext.defenderTeam.entityList.Count; i++)
        {
            EntityCreateCtx ctx      = mCreateContext.defenderTeam.entityList[i];
            EctypeEntity    defender = new EctypeEntity();
            defender.entity = GameMgr.Instance.m_entityMgr.Build(ctx);

            if (defender.entity == null)
            {
                Debug.Log("Ectype::Create Defender failed !");
                continue;
            }
            defender.Status = EntityEctypeStatus.Idle;
            defender.Camp   = EntityCamp.Defender;

            m_defenderTeam.m_entityList.Add(defender);
            GameMgr.Instance.m_uiMgr.UIFight.CreateDeffender(defender.entity);
        }

        return(true);
    }
Пример #2
0
    private void OnUpdateEntityStatus(EctypeEntity ectypeEntity)
    {
        switch (ectypeEntity.Status)
        {
        case EntityEctypeStatus.Idle:
            break;

        case EntityEctypeStatus.Alert:
            break;

        case EntityEctypeStatus.Chase:
            break;

        case EntityEctypeStatus.Combat:
        {
        }
        break;
        }
    }
Пример #3
0
    public UseSkillResult UseSkill()
    {
        EctypeEntity       ectypeEntity = GameMgr.Instance.m_ectypeMgr.m_Ectype.GetNearestTarget(m_owner);
        SkillCreateContext ctx          = new SkillCreateContext();

        ctx.Owner     = m_owner;
        ctx.SkillData = m_skillData;
        ctx.TargetUID = ectypeEntity.entity.UID;

        Skill skill = CreateSkill(ctx);

        if (skill == null)
        {
            return(UseSkillResult.None);
        }

        AddSkill(skill);

        return(UseSkillResult.OK);
    }
Пример #4
0
    public EctypeEntity GetNearestTarget(Entity own)
    {
        EctypeEntity retEntity = null;
        float        minDis    = 9999999.0f;

        for (int i = 0; i < m_entityList.Count; i++)
        {
            EctypeEntity ectypeEntity = m_entityList[i];
            if (ectypeEntity == null || ectypeEntity.entity == null || ectypeEntity.entity.IsDead())
            {
                continue;
            }

            float dis = Vector3.Distance(own.Position, ectypeEntity.entity.Position);
            if (dis < minDis)
            {
                retEntity = ectypeEntity;
                minDis    = dis;
            }
        }

        return(retEntity);
    }