Ejemplo n.º 1
0
    void StartAtk()
    {
        state = AtkState.atkbegin;


        if (Vector3.Distance(parent.transform.position, target.transform.position) > parent.GetAtkDis(target))
        {
            state = AtkState.non;
            return;
        }

        if (GameConst.CAMP_ATK[(int)target.camp, (int)parent.camp] == 0)
        {
            if (target.GetObjType() == InGameBaseObj.enObjType.equip)
            {
                InGameBaseEquip equip = (InGameBaseEquip)target;

                parent.StopAction();

                EquipData e = EquipSystem.GetInstance().RandEquipProperty(equip);
                InGameManager.GetInstance().inGamePlayerManager.AddEquip(e);

                MonoBehaviour.Destroy(equip.gameObject);
            }
            return;
        }

        parent.SetAnimatorState(parent.GetAtkAnimator(), parent.GetAtkSpeed());
        atkTime = 0;

        Vector3 v = (target.transform.position - parent.transform.position).normalized;

        parent.transform.forward = v;
    }
Ejemplo n.º 2
0
    //死亡
    public override void Die()
    {
        actionManager.Destory();

        //InGameManager.GetInstance().inGameUIManager.DelRole(this.instanceId);
        //base.Die();
        SetAnimatorState(AnimatorState.Dead, 1);

        if (camp == enMSCamp.en_camp_enemy)
        {
            if (killMe.GetObjType() == enObjType.character)
            {
                //爆装备
                InGameBaseCharacter source = (InGameBaseCharacter)killMe;
                if (UnityEngine.Random.Range(0, 100) < conf.outodds)
                {
                    EquipSystem.GetInstance().OutEquip(gameObject, level,
                                                       source.propertys.GetProperty(enCharacterProperty.equipdrop) +
                                                       this.conf.equipdrop);
                }
                EventData.CreateEvent(EventID.EVENT_DATA_KILLENEMY).AddData(source, this).Send();
            }
        }

        transform.GetComponent <BoxCollider>().enabled    = false;
        transform.GetComponent <SphereCollider>().enabled = false;
        Invoke("Delself", 3);
    }
Ejemplo n.º 3
0
    void StartAtk()
    {
        state = ActionState.atkbegin;

        if (target == null || target.IsDie())
        {
            state = ActionState.non;
            return;
        }
        if (Vector2.Distance(parent.transform.position, target.transform.position) > parent.GetAtkDis(target))
        {
            state = ActionState.move;
            return;
        }

        if (GameConst.CAMP_ATK[(int)target.camp, (int)parent.camp] == 0)
        {
            if (target.GetObjType() == InGameBaseObj.enObjType.equip)
            {
                InGameBaseEquip equip = (InGameBaseEquip)target;
                EquipData       e     = EquipSystem.GetInstance().RandEquipProperty(equip);
                InGameManager.GetInstance().inGamePlayerManager.AddEquip(e);
                MonoBehaviour.Destroy(equip.gameObject);
                parent.StopAction();
                return;
            }
            else if (target.GetObjType() == InGameBaseObj.enObjType.map)
            {
                InGameBaseMapObj mapobj = (InGameBaseMapObj)target;
                bool             isfin  = mapobj.HandleFuntion(parent);

                if (!isfin)
                {
                    Debug.Log("stop action");
                    parent.StopAction();
                    return;
                }
                Debug.Log("continue action");
            }
        }

        parent.SetAnimatorState(parent.GetAtkAnimator(), parent.GetAtkSpeed());
        atkTime = 0;

        parent.SetDir(target.transform.position.x - parent.transform.position.x);
    }