Beispiel #1
0
    private void ActionDone(ActionBase action)
    {
        if (action.IsSuccess())
        {
            if (action is ActionGoTo && (action as ActionGoTo).FinalPosition == DesiredPosition)
            {
                Debug.Log(action.ToString() + "is done, setting E_AT_TARGET_POS to true");
                Owner.WorldState.SetWSProperty(E_PropKey.E_AT_TARGET_POS, true);
            }
            else if (action is ActionWeaponShow)
            {
                Debug.Log(action.ToString() + "is done, setting E_WEAPON_IN_HANDS to " + (action as ActionWeaponShow).Show.ToString());
                Owner.WorldState.SetWSProperty(E_PropKey.E_WEAPON_IN_HANDS, (action as ActionWeaponShow).Show);
            }
            else if (action is ActionUseLever)
            {
                Owner.WorldState.SetWSProperty(E_PropKey.E_USE_WORLD_OBJECT, false);
                InteractionObject = null;
                Interaction       = E_InteractionType.None;
            }
            else if (action is ActionPlayAnim)
            {
                Owner.WorldState.SetWSProperty(E_PropKey.E_PLAY_ANIM, false);
                DesiredAnimation = null;
            }
        }

        ActionFactory.Return(action);
    }
Beispiel #2
0
    public void Reset()
    {
        m_ActiveActions.Clear();

        //  Stop = false;
        MotionType     = E_MotionType.None;
        WeaponState    = E_WeaponState.NotInHands;
        WeaponToSelect = E_WeaponType.None;

        Speed = 0;

        Health = MaxHealth;

        Rage      = RageMin;
        Dodge     = DodgeMin;
        Fear      = FearMin;
        IdleTimer = 0;

        MoveDir = Vector3.zero;

        DesiredPosition  = Vector3.zero;
        DesiredDirection = Vector3.zero;

        InteractionObject = null;
        Interaction       = E_InteractionType.None;

        DesiredAnimation = "";

        DesiredTarget     = null;
        DesiredAttackType = E_AttackType.None;

        DontUpdate = false;
    }
Beispiel #3
0
    public override float DoInteraction(E_InteractionType interaction)
    {
        OnInteractionStart();

        if (DisableAfterUse)
        {
            InteractionObjectUsable = false;
        }

        string s;

        if (interaction == E_InteractionType.On)
        {
            s     = AnimON.name;
            State = E_State.E_GOING_ON;
        }
        else
        {
            s     = AnimOFF.name;
            State = E_State.E_GOING_OFF;
        }

        Animation.Play(s);

        Invoke("AnimationDone", Animation[s].length);

        return(Animation[s].length);
    }
Beispiel #4
0
    public override float DoInteraction(E_InteractionType type)
    {
        //  Debug.Log(gameObject.name + " DoInteraction");

        OnInteractionStart();

        Animation.Play(Anim.name);

        Invoke("AnimationDone", Animation[Anim.name].length);

        return(Animation[Anim.name].length);
    }
Beispiel #5
0
    public override float DoInteraction(E_InteractionType type)
    {
        if (DisableAfterUse)
        {
            Useable = false;
        }

        OnInteractionStart();

        Animation.Play(Anim.name);

        Invoke("AnimationDone", Animation[Anim.name].length);

        return(Animation[Anim.name].length);
    }
Beispiel #6
0
    public override string GetUseAnim(E_InteractionObjects objectType, E_InteractionType interaction)
    {
        if (objectType == E_InteractionObjects.UseLever)
        {
            return("useLever");
        }

        if (objectType == E_InteractionObjects.Trigger)
        {
            return("idle");
        }

        if (objectType == E_InteractionObjects.UseExperience)
        {
            return("attackJump");
        }

        return("idle");
    }
Beispiel #7
0
    public void OrderAdd(AgentOrder order)
    {
        //  Debug.Log(Time.timeSinceLevelLoad + " order arrived " + order.Type);

        if (IsOrderAddPossible(order.Type))
        {
            Owner.WorldState.SetWSProperty(E_PropKey.E_ORDER, order.Type);

            switch (order.Type)
            {
            case AgentOrder.E_OrderType.E_STOPMOVE:
                Owner.WorldState.SetWSProperty(E_PropKey.E_AT_TARGET_POS, true);
                DesiredPosition = Owner.Position;
                break;

            case AgentOrder.E_OrderType.E_GOTO:
                Owner.WorldState.SetWSProperty(E_PropKey.E_AT_TARGET_POS, false);
                DesiredPosition   = order.Position;
                DesiredDirection  = order.Direction;
                MoveSpeedModifier = order.MoveSpeedModifier;
                break;

            case AgentOrder.E_OrderType.E_DODGE:
                DesiredDirection = order.Direction;
                //  Debug.Log(Time.timeSinceLevelLoad + " order arrived " + order.Type);
                break;

            case AgentOrder.E_OrderType.E_USE:
                Owner.WorldState.SetWSProperty(E_PropKey.E_USE_WORLD_OBJECT, true);

                if ((order.Position - Owner.Position).sqrMagnitude <= 1)
                {
                    Owner.WorldState.SetWSProperty(E_PropKey.E_AT_TARGET_POS, true);
                }
                else
                {
                    Owner.WorldState.SetWSProperty(E_PropKey.E_AT_TARGET_POS, false);
                }
                DesiredPosition   = order.Position;
                InteractionObject = order.InteractionObject;
                Interaction       = order.Interaction;
                break;

            case AgentOrder.E_OrderType.E_ATTACK:
                if (order.Target == null || (order.Target.Position - Owner.Position).magnitude <= (WeaponRange + 0.2f))
                {
                    Owner.WorldState.SetWSProperty(E_PropKey.E_IN_WEAPONS_RANGE, true);
                }
                else
                {
                    Owner.WorldState.SetWSProperty(E_PropKey.E_IN_WEAPONS_RANGE, false);
                }

                DesiredAttackType  = order.AttackType;
                DesiredTarget      = order.Target;
                DesiredDirection   = order.Direction;
                DesiredAttackPhase = order.AnimAttackData;
                break;
            }

            // Debug.Log(Time.timeSinceLevelLoad + " order arrived " + order.Type);
        }
        else if (order.Type == AgentOrder.E_OrderType.E_ATTACK)
        {
            // Debug.Log(Time.timeSinceLevelLoad +  " " +order.Type + " is nto allowed because " + currentOrder);
        }
        AgentOrderFactory.Return(order);
    }
 public override string GetUseAnim(E_InteractionObjects objectType, E_InteractionType interaction)
 {
     return(null);
 }
Beispiel #9
0
 public abstract string GetUseAnim(E_InteractionObjects objectType, E_InteractionType interaction);
Beispiel #10
0
 public abstract float DoInteraction(E_InteractionType interaction);