Пример #1
0
    public virtual bool OnAttackAction()
    {
        TrapAttackAction attackAction = mActionControl.AddAction(TrapAction.ENType.enAttackAction) as TrapAttackAction;

        if (attackAction != null)
        {
            attackAction.Init(mAttackActionAnimList);
            return(true);
        }
        return(false);
    }
Пример #2
0
    void ChangeResultID(AnimationEvent animEvent)
    {
        ActorProp selfProp = transform.parent.GetComponent <ActorProp>();

        if (null == selfProp)
        {
            return;
        }
        TrapAttackAction action = (selfProp.ActorLogicObj as Trap).mActionControl.LookupAction(TrapAction.ENType.enAttackAction) as TrapAttackAction;

        if (null != action)
        {
            action.mSkillResultID = animEvent.intParameter;
        }
    }
Пример #3
0
    public void Tick()
    {
        string strAnim = "standby";

//        TrapAction.ENType curActionType = TrapAction.ENType.enNone;
//        Vector3 mDirection = Vector3.zero;
        if (mActor.mActionControl.IsActionRunning(TrapAction.ENType.enAttackAction))
        {
            TrapAttackAction action = mActor.mActionControl.LookupAction(TrapAction.ENType.enAttackAction) as TrapAttackAction;
//            bool isNewAction = IsNewAction(TrapAttackAction.ENType.enAttackAction);
            string curActionAnimName = action.GetAnimationName();
            if (curActionAnimName != mLastAnimName)
            {
                mLastAnimName = curActionAnimName;
                float animLength = mActor.PlayAnimation(curActionAnimName);
                action.AnimStartTime = Time.time;
                action.AnimLength    = animLength;
            }
            return;
        }
        else if (mActor.mActionControl.IsActionRunning(TrapAction.ENType.enStandAction))
        {
            TrapStandAction action            = mActor.mActionControl.LookupAction(TrapAction.ENType.enStandAction) as TrapStandAction;
            string          curActionAnimName = action.GetAnimationName();
            if (curActionAnimName != mLastAnimName)
            {
                mLastAnimName = curActionAnimName;
                float animLength = mActor.PlayAnimation(curActionAnimName);
                action.AnimStartTime = Time.time;
                action.AnimLength    = animLength;
            }
            return;
        }
        if (strAnim == "")
        {
            return;
        }
        if (strAnim == "standby")
        {
            if (mActor.IsState_ReadyToFight)
            {
                strAnim = "readytofight";
            }
        }
    }
Пример #4
0
    IEnumerator Coroutine_PlayEffect(string effectName, float effectTime, string posByBone, bool isAdhered, Vector3 offset, bool isAddToAttackAction = false)
    {
        GameResPackage.AsyncLoadObjectData data = new GameResPackage.AsyncLoadObjectData();
        IEnumerator e = PoolManager.Singleton.Coroutine_Load(GameData.GetEffectPath(effectName), data);

        while (true)
        {
            e.MoveNext();
            if (data.m_isFinish)
            {
                break;
            }
            yield return(e.Current);
        }
        if (data.m_obj != null)
        {
            PlayEffect(data.m_obj as GameObject, effectTime, posByBone, isAdhered, offset);
            if (isAddToAttackAction)
            {
                if (ActionControl.IsActionRunning(ActorAction.ENType.enAttackAction))
                {
                    TrapAttackAction action = this.mActionControl.LookupAction(TrapAction.ENType.enAttackAction) as TrapAttackAction;
                    action.AddEffectObj(data.m_obj as GameObject);
                }
            }
        }
        else
        {
            TrapAttackAction action = mActionControl.LookupAction(TrapAttackAction.SGetActionType()) as TrapAttackAction;
            if (action != null)
            {
                Debug.LogWarning("Play effect fail, actorID:" + ID + ",effectName:" + effectName);
            }
            else
            {
                Debug.LogWarning("Play effect fail, name:" + effectName);
            }
        }
    }
Пример #5
0
    void OnAttackEnterCallBack(GameObject gameObject, Collider other)
    {
        if (other.isTrigger)
        {
            return;
        }
        Transform targetObj = other.transform;

        while (null != targetObj && targetObj.name != "body")
        {
            targetObj = targetObj.parent;
        }
        if (targetObj == null)
        {
            return;
        }
        TrapAttackAction action = mActionControl.LookupAction(TrapAction.ENType.enAttackAction) as TrapAttackAction;

        if (action != null)
        {
            action.OnTriggerEnter(gameObject, other);
        }
    }