Esempio n. 1
0
    private void Play(int entityID, RPGGameEvent actionStarted)
    {
        var animation = this.EntityManager.GetComponent <AnimationComponent>(entityID);

        if (animation == null)
        {
            return;
        }

        var form = this.EntityManager.GetComponent <FormComponent>(entityID);

        if (form == null)
        {
            return;
        }

        var animationData = animation.Animations.Find(x => x.TriggerEvent == actionStarted);

        if (animationData == null)
        {
            return;
        }

        if (animationData.DisablePhysics)
        {
            form.PhysicsEnabled = false;
        }

        animationData.theAnimation = form.PlayAnimation(animationData.Name, animationData.Sound);
        if (animationData.theAnimation != null)
        {
            ActiveAnimations.Add(animationData);
            this.EventManager.QueueEvent(RPGGameEvent.AnimationStarted, animationData);
        }
    }
Esempio n. 2
0
 public void Clear()
 {
     ActionType = RPGGameEvent.None;
     Duration   = 0.0f;
     IsTimed    = false;
     TargetID   = -1;
 }
Esempio n. 3
0
    public static int MenuSortOrder(RPGGameEvent option)
    {
        switch (option)
        {
        case RPGGameEvent.Menu_None:
            return(0);

        case RPGGameEvent.Menu_Open:
            return(10);

        case RPGGameEvent.Menu_Close:
            return(11);

        case RPGGameEvent.Menu_AttackMelee:
            return(20);

        case RPGGameEvent.Menu_PickLock:
            return(30);

        case RPGGameEvent.Menu_UseKey:
            return(40);

        case RPGGameEvent.Menu_Locked:
            return(50);

        case RPGGameEvent.Menu_DisarmTrap:
            return(60);

        case RPGGameEvent.Menu_TrapDetected:
            return(70);

        default:
            return(-1);
        }
    }
Esempio n. 4
0
    public void ClearAll()
    {
        MenuOptions = new SortedList <int, RPGGameEvent>();

        Distance           = -1;
        EntityID_Item      = -1;
        MouseButtonPressed = false;
        SelectedOption     = RPGGameEvent.None;
    }
Esempio n. 5
0
    public void AddOption(RPGGameEvent option)
    {
        int s = RPGGameEventUtils.MenuSortOrder(option);

        if (!MenuOptions.ContainsKey(s))
        {
            MenuOptions.Add(s, option);
        }
    }
Esempio n. 6
0
    private void UntimedActionCompleted(int entityID, RPGGameEvent actionType)
    {
        MenuSystem.ClearOptions(entityID);

        var action = this.EntityManager.GetComponent <ActionComponent>(entityID);

        if (action != null && action.ActionType == RPGGameEvent.FallStarted)
        {
            action.ActionType = RPGGameEvent.None;
        }
    }
Esempio n. 7
0
    public static bool MenuOptionIsDisabledType(RPGGameEvent option)
    {
        switch (option)
        {
        case RPGGameEvent.Menu_Locked:
        case RPGGameEvent.Menu_None:
        case RPGGameEvent.Menu_TrapDetected:
            return(true);

        default:
            return(false);
        }
    }
Esempio n. 8
0
    private void UntimedActionStarted(int entityID, RPGGameEvent actionType)
    {
        var action = this.EntityManager.GetComponent <ActionComponent>(entityID);

        if (action != null)
        {
            return;
        }

        action.ActionType = actionType;
        action.Duration   = 0.0f;
        action.IsTimed    = false;
        action.TargetID   = -1;

        MenuSystem.SetMenuToBusy(entityID);
    }
Esempio n. 9
0
    public static void AddOption(int entityID, RPGGameEvent option)
    {
        var menu = GameBehavior.thisGame.EntityManager.GetComponent <MenuComponent>(entityID);

        if (menu == null)
        {
            return;
        }

        int s = RPGGameEventUtils.MenuSortOrder(option);

        if (!menu.MenuOptions.ContainsKey(s))
        {
            menu.MenuOptions.Add(s, option);
        }
    }
Esempio n. 10
0
    private void TimedActionStarted(int entityID, RPGGameEvent actionType, float duration, bool isTimed, int targetID)
    {
        var action = this.EntityManager.GetComponent <ActionComponent>(entityID);

        if (action == null)
        {
            return;
        }

        action.ActionType = actionType;
        action.Duration   = duration;
        action.IsTimed    = isTimed;
        action.TargetID   = targetID;

        MenuSystem.SetMenuToBusy(entityID);

        this.EventManager.QueueEvent(RPGGameEvent.ActionStarted, new ActionStartedData()
        {
            ActorID = entityID, TargetID = action.TargetID, ActionType = action.ActionType
        });
    }
Esempio n. 11
0
    private static Delegate_CallOnActionCompleted ActionCompletedEvent(RPGGameEvent option)
    {
        switch (option)
        {
        case RPGGameEvent.Menu_DisarmTrap:
            return(TrapSystem.OnDisarmTrap);

        case RPGGameEvent.Menu_Close:
            return(OpenSystem.ToggleOpen);

        case RPGGameEvent.Menu_Open:
            return(OpenSystem.ToggleOpen);

        case RPGGameEvent.Menu_PickLock:
            return(LockSystem.OnPickLock);

        case RPGGameEvent.Menu_UseKey:
            return(LockSystem.OnUseKey);

        default:
            return(null);
        }
    }
Esempio n. 12
0
 public void RemoveOption(RPGGameEvent option)
 {
     MenuOptions.Remove(RPGGameEventUtils.MenuSortOrder(option));
 }
Esempio n. 13
0
 public bool OptionIsActive(RPGGameEvent option)
 {
     return(MenuOptions.ContainsKey(RPGGameEventUtils.MenuSortOrder(option)));
 }
Esempio n. 14
0
 public static bool BusyWithMenuOption(RPGGameEvent action)
 {
     return(action.ToString().StartsWith("Menu_"));
 }