Esempio n. 1
0
    public void OnTriggerEnter(Collider other)
    {
        TriggerObject interaction = other.GetComponent <TriggerObject>();

        if (interaction != null)
        {
            if (interaction.GetEntryTransform() == null)
            {
                return;
            }

            //  当玩家碰到触发器,播放使用动画
            Owner.transform.position = interaction.GetEntryTransform().position;
            Owner.transform.rotation = interaction.GetEntryTransform().rotation;

            useMode = false;

            AgentOrder order = AgentOrderFactory.Create(AgentOrder.E_OrderType.E_USE);

            order.InteractionObject = interaction;
            order.Position          = order.InteractionObject.GetEntryTransform().position;
            order.Interaction       = E_InteractionType.On;
            Owner.BlackBoard.OrderAdd(order);

            ActionUseLever actionUseLever = ActionFactory.Create(ActionFactory.E_Type.E_USE_LEVER) as ActionUseLever;
            actionUseLever.InterObj    = interaction;
            actionUseLever.Interaction = E_InteractionType.On;

            GetComponent <AnimComponent>().HandleAction(actionUseLever);

            return;
        }
    }
Esempio n. 2
0
    override public void OnDeactivate()
    {
        //Time.timeScale = 1;

        Action.SetSuccess();
        Action = null;
        base.OnDeactivate();
    }
Esempio n. 3
0
    protected override void Initialize(ActionBase action)
    {
        base.Initialize(action);

        Action = action as ActionUseLever;

        StartPosition = Owner.transform.position;
        StartRotation.SetLookRotation(Owner.transform.forward);

        FinalPosition = Action.InterObj.GetEntryTransform().position;
        FinalRotation.SetLookRotation(Action.InterObj.GetEntryTransform().forward);


        RotationProgress = 0;
        CurrentMoveTime  = 0;
        MoveTime         = 0.1f;

        RotationOk = false;
        PositionOK = false;
        State      = E_State.E_PREPARING_FOR_USE;
    }
Esempio n. 4
0
    //  生成动作
    static public ActionBase Create(E_Type type)
    {
        int index = (int)type;

        ActionBase a;

        if (m_UnusedActions[index].Count > 0)
        {
            a = m_UnusedActions[index].Dequeue();
        }
        else
        {
            switch (type)
            {
            case E_Type.E_IDLE:
                a = new ActionIdle();
                break;

            case E_Type.E_MOVE:
                a = new ActionMove();
                break;

            case E_Type.E_GOTO:
                a = new ActionGoTo();
                break;

            case E_Type.E_COMBAT_MOVE:
                a = new ActionCombatMove();
                break;

            case E_Type.E_ATTACK:
                a = new ActionAttack();
                break;

            case E_Type.E_ATTACK_ROLL:
                a = new ActionAttackRoll();
                break;

            case E_Type.E_ATTACK_WHIRL:
                a = new ActionAttackWhirl();
                break;

            case E_Type.E_INJURY:
                a = new ActionInjury();
                break;

            case E_Type.E_DAMAGE_BLOCKED:
                a = new ActionDamageBlocked();
                break;

            case E_Type.E_BLOCK:
                a = new ActionBlock();
                break;

            case E_Type.E_ROLL:
                a = new ActionRoll();
                break;

            case E_Type.E_INCOMMING_ATTACK:
                a = new ActionIncommingAttack();
                break;

            case E_Type.E_WEAPON_SHOW:
                a = new ActionWeaponShow();
                break;

            case E_Type.E_Rotate:
                a = new ActionRotate();
                break;

            case E_Type.E_USE_LEVER:
                a = new ActionUseLever();
                break;

            case E_Type.E_PLAY_ANIM:
                a = new ActionPlayAnim();
                break;

            case E_Type.E_PLAY_IDLE_ANIM:
                a = new ActionPlayIdleAnim();
                break;

            case E_Type.E_DEATH:
                a = new ActionDeath();
                break;

            case E_Type.E_KNOCKDOWN:
                a = new ActionKnockdown();
                break;

            case E_Type.E_Teleport:
                a = new ActionTeleport();
                break;

            default:
                Debug.LogError("no Action to create");
                return(null);
            }
        }
        a.Reset();
        a.SetActive();

        m_ActionsInAction.Add(a);
        return(a);
    }