예제 #1
0
    private void TaskOnClick()
    {
        if (Moral.GetCurrentMoralState() == MoralState.Best && !wantsHeal && !wantsDetermination)
        {
            return;
        }

        var character = PartyActions.GetActiveCharacter();

        if (wantsHeal)
        {
            CharacterActions.HealCharacterBy(1, character);
        }
        else
        {
            int moralevalue = Moral.GetMoraleInt();
            if (moralevalue < 0)
            {
                CharacterActions.LowerCharacterDeterminationBy(moralevalue, character);
            }
            else
            {
                CharacterActions.RaiseCharacterDeterminationBy(moralevalue, character);
            }
        }
        Destroy(popUp);
        var phaseView = FindObjectOfType <PhaseView>();

        phaseView.NextPhase();
    }
예제 #2
0
 private void Awake()
 {
     foreach (var entity in m_entities)
     {
         entity.BindActions(CharacterActions.CreateWithControllerBindings(), InputManager.ActiveDevice);
     }
 }
예제 #3
0
    public void ProcessCleanAction(ActionContainer action)
    {
        var character = action.GetExecutingCharacter();

        CharacterActions.RaiseCharacterDeterminationBy(2, character);
        Moral.RaiseMoral();
    }
예제 #4
0
 public static void LowerDeterminationOfPartyBy(int amount)
 {
     foreach (Character c in PartyHandler.PartySession)
     {
         CharacterActions.LowerCharacterDeterminationBy(amount, c);
     }
 }
예제 #5
0
        void Handle_ActionsPopoverWillShowPopover(object sender, EventArgs e)
        {
            UIAlertView view = null;

            if (!_ActionsPopoverShown)
            {
                view = new UIAlertView("Loading", "Accessing Database...", new UIAlertViewDelegate(), null, new string[] {});
                view.Show();
                NSRunLoop.Current.RunUntil(NSDate.Now.AddSeconds(.1));
                //show waiting dialog
            }

            UIWebView v = new UIWebView(new CGRect(0, 0, 180, 120));

            v.LoadHtmlString(MonsterHtmlCreator.CreateHtml(_Character.Monster, _Character, true), new NSUrl("http://localhost/"));
            _ActionsPopover.AccessoryView = v;

            List <CharacterActionItem> actions = CharacterActions.GetActions(_Character, _CharacterListView.SelectedCharacter);

            if (!_ActionsPopoverShown)
            {
                view.DismissWithClickedButtonIndex(0, false);
                //hide waiting dialog
                _ActionsPopoverShown = true;
            }
            AddActionItems(actions, _ActionsPopover.Items);
        }
예제 #6
0
 public PlayerState(PlayerStateMachine stateMachine, PlayerCharacter character, PlayerController controller)
 {
     this.stateMachine = stateMachine;
     this.controller   = controller;
     this.character    = character;
     Actions           = character.Input.Actions;
 }
예제 #7
0
    private float characterJumpFinalPosition;  ///Needed to assess the final position of a jump



    void Start()
    {
        currentCharacter = this.GetComponent <CharacterFeatures>();
        characterActions = this.GetComponent <CharacterActions>();
        animator         = currentCharacter.GetAnimator();
        rigidBody        = this.GetComponent <Rigidbody2D>();
    }
예제 #8
0
 void Start()
 {
     inputManager = GetComponent <InputManager>();
     actions      = GetComponent <CharacterActions>();
     character    = GetComponent <Character>();
     Reset();
 }
예제 #9
0
 public CharacterActionsAdapter(Context context, Character character, CombatState state)
 {
     _Context     = context;
     _Character   = character;
     _ActionItems = CharacterActions.GetActions(_Character, _Character, new List <Character>(
                                                    from x in state.Characters where x.IsMonster == _Character.IsMonster select x));
 }
예제 #10
0
        public async Task CreateNewCharacterAction(CharacterActions currCharacter, string name)
        {
            try
            {
                Character charToUpdate = _context.Characters.FirstOrDefault(c => c.Name == name);

                long actionId = _context.CharacterActions
                                .Where(ca => ca.CharacterAttack.Name == currCharacter.CharacterAttack.Name)
                                .Select(cs => cs.CharacterActionsId)
                                .FirstOrDefault();

                if (charToUpdate != null)
                {
                    var link = new ActionsLink()
                    {
                        CharacterId        = charToUpdate.CharacterId,
                        CharacterActionsId = actionId
                    };
                    _context.ActionsLink.Add(link);
                    _context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                throw ex;
            }
        }
예제 #11
0
        void Handle_ActionsPopoverItemClicked(object sender, ButtonStringPopover.PopoverEventArgs e)
        {
            CharacterActionItem item = (CharacterActionItem)e.Tag;

            if (item.Action != CharacterActionType.None)
            {
                CharacterActionResult res = CharacterActions.TakeAction(_CombatState, item.Action, _Character, new List <Character>()
                {
                    _Character
                }, item.Tag);
                switch (res)
                {
                case CharacterActionResult.NeedConditionDialog:

                    _ConditionView = new ConditionViewController();
                    _ConditionView.ConditionApplied += ConditionApplied;
                    MainUI.MainView.AddSubview(_ConditionView.View);
                    break;

                case CharacterActionResult.NeedNotesDialog:

                    _TextBoxDialog            = new TextBoxDialog();
                    _TextBoxDialog.HeaderText = "Notes";
                    _TextBoxDialog.Value      = _Character.Notes;
                    MainUI.MainView.AddSubview(_TextBoxDialog.View);
                    _TextBoxDialog.OKClicked += Handle_NotesTextBoxDialogOKClicked;
                    break;

                case CharacterActionResult.NeedMonsterEditorDialog:
                    Monster newMonster = (Monster)Character.Monster.Clone();

                    _MonsterEditorDialog = new MonsterEditorDialog(newMonster);
                    _MonsterEditorDialog.MonsterEditorComplete += (sd, monster) =>
                    {
                        Character.Monster.CopyFrom(newMonster);
                    };
                    MainUI.MainView.AddSubview(_MonsterEditorDialog.View);

                    break;

                case CharacterActionResult.RollAttack:
                    DieRollerView.Roller.RollAttack((Attack)item.Tag, _Character);
                    break;

                case CharacterActionResult.RollAttackSet:
                    DieRollerView.Roller.RollAttackSet((AttackSet)item.Tag, _Character);
                    break;

                case CharacterActionResult.RollSave:
                    DieRollerView.Roller.RollSave((Monster.SaveType)item.Tag, _Character);
                    break;

                case CharacterActionResult.RollSkill:
                    var sks = (Tuple <string, string>)item.Tag;
                    DieRollerView.Roller.RollSkill(sks.Item1, sks.Item2, _Character);
                    break;
                }
            }
        }
예제 #12
0
 // Start is called before the first frame update
 void Start()
 {
     input = new CharacterActions();
     input.Select.AddDefaultBinding(Key.Space);
     input.Select.AddDefaultBinding(Key.Z);
     input.Select.AddDefaultBinding(Mouse.LeftButton);
     input.Select.AddDefaultBinding(InputControlType.Action1);
 }
예제 #13
0
    void Start()
    {
        characterActions = GetComponent <CharacterActions>();

        if (corners.Count > 0)
        {
            transform.position = corners[0];
        }
    }
예제 #14
0
        void ListViewItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            ListView lv = (ListView)FindViewById(Resource.Id.actionListView);
            CharacterActionsAdapter ca = (CharacterActionsAdapter)lv.Adapter;
            CharacterActionItem     ai = ca.ActionItems[e.Position];

            if (ai.SubItems != null)
            {
                ca.MoveToSubItems(ai);
                ca.NotifyDataSetChanged();
            }
            else if (ai.Name != null && ai.Name.Length > 0)
            {
                CharacterActionResult res = CharacterActions.TakeAction(_State, ai.Action, _Character, new List <CombatManager.Character>()
                {
                    _Character
                }, ai.Tag);
                Dismiss();

                switch (res)
                {
                case CharacterActionResult.NeedAttacksDialog:
                    break;

                case CharacterActionResult.NeedMonsterEditorDialog:
                    ShowMonsterEditor();
                    break;

                case CharacterActionResult.NeedConditionDialog:
                    ShowConditionDialog();
                    break;

                case CharacterActionResult.NeedNotesDialog:
                    ShowNotesDialog();
                    break;

                case CharacterActionResult.RollAttack:
                    _State.Roll(CombatState.RollType.Attack, _Character, (Attack)ai.Tag, null);
                    break;

                case CharacterActionResult.RollAttackSet:
                    _State.Roll(CombatState.RollType.AttackSet, _Character, (AttackSet)ai.Tag, null);
                    break;

                case CharacterActionResult.RollSave:

                    _State.Roll(CombatState.RollType.Save, _Character, (Monster.SaveType)ai.Tag, null);
                    break;

                case CharacterActionResult.RollSkill:
                    var sks = (Tuple <string, string>)ai.Tag;
                    _State.Roll(CombatState.RollType.Skill, _Character, sks.Item1, sks.Item2);
                    break;
                }
            }
        }
    public InputBindings()
    {
        actionSet = new CharacterActions(null);

        bindMovementActions();
        bindCameraActions();
        bindPlayerActions();
        // I hate you kbob
        // Hate you too, Ty<3
    }
    public InputBindings()
    {
        actionSet = new CharacterActions( null );

        bindMovementActions();
        bindCameraActions();
        bindPlayerActions();
        // I hate you kbob
        // Hate you too, Ty<3
    }
예제 #17
0
 void Start()
 {
     uiController     = GameObject.Find("Main UI").GetComponent <UIController>();
     characterActions = GetComponent <CharacterActions>();
     health           = fullHealth;
     if (this.gameObject.tag == "Player" && uiController.healthText.text == "")
     {
         uiController.Health(health);
     }
 }
예제 #18
0
 /// <summary>
 /// Start is called on the frame when a script is enabled just before
 /// any of the Update methods is called the first time.
 /// </summary>
 private void Start()
 {
     if (m_useKeyBoard)
     {
         _action = CharacterActions.CreateWithKeyboardBindings();
     }
     else
     {
         _action = CharacterActions.CreateWithControllerBindings();
     }
 }
예제 #19
0
 public static void DamageAllPlayers(int amount)
 {
     foreach (Character c in PartyHandler.PartySession)
     {
         if (c is ISideCharacter)
         {
             continue;
         }
         CharacterActions.DamageCharacterBy(amount, c);
     }
 }
예제 #20
0
 private void UpdateMoralArrow()
 {
     if (CharacterActions.IsCharacterHealthInPreMoralChangeRange(currentMainCharacter))
     {
         moralArrow.color = new Color(255, 255, 255, 255);
     }
     else
     {
         moralArrow.color = new Color(255, 255, 255, 0);
     }
 }
예제 #21
0
        private void AddCharacterCreationActions()
        {
            List <playercreateinfo_action> newCreateInfoActions = PlayerCreateActions.Where(s => s.race == Owner.Character.race && s.@class == Owner.Character.@class).ToList();

            newCreateInfoActions.ForEach(a => CharacterActions.Add(new character_action()
            {
                guid = this.Owner.ObjectGUID.Low, action = a.action, button = (byte)a.button, type = (byte)a.type
            }));

            CharacterDatabase.SaveChanges();
        }
예제 #22
0
 private void Start()
 {
     if (charSettings.isDummy)
     {
         charInput = new DummyInput();
     }
     else
     {
         charInput = new PlayerInput(playerNumber);
     }
     charActions = new CharacterActions(charInput, rb, charSettings, charState, charAnimations);
 }
예제 #23
0
        /// <summary>
        /// Copies the values of all the actions from an existing set of actions.
        /// </summary>
        public void SetValues(CharacterActions characterActions)
        {
            @jump.value     = characterActions.jump.value;
            @run.value      = characterActions.run.value;
            @interact.value = characterActions.interact.value;
            @jetPack.value  = characterActions.jetPack.value;
            @dash.value     = characterActions.dash.value;
            @crouch.value   = characterActions.crouch.value;


            @movement.value = characterActions.movement.value;
        }
예제 #24
0
        public ActionButtonCollection(PlayerEntity playerEntity)
        {
            Owner = playerEntity;

            var characterActions = CharacterActions.Where(cs => cs.guid == Owner.Character.guid).ToList();

            //Must be a new character, get initial spells
            if (characterActions.Count == 0)
            {
                AddCharacterCreationActions();
            }
        }
예제 #25
0
 public void UpdateButtonMap(PlayerIndex playerIndex, Buttons button, CharacterActions characterAction)
 {
     Dictionary<CharacterActions, Buttons> playerCharacterButtonsMap = playersCharacterButtonsMap[playerIndex];
     foreach (KeyValuePair<CharacterActions, Buttons> pair in playerCharacterButtonsMap)
     {
         if (pair.Value.Equals(button))
         {
             playerCharacterButtonsMap[pair.Key] = playerCharacterButtonsMap[characterAction];
         }
     }
     playerCharacterButtonsMap[characterAction] = button;
 }
예제 #26
0
    public static void CheckDistance(CharacterActions characterActions)
    {
        string screenDistance = characterActions.GetPositionBetweenCharacters();

        if (screenDistance == "In-close" || screenDistance == "Poke-range")
        {
            conditions |= AIConditions.distance;
        }
        else
        {
            conditions &= ~AIConditions.distance;
        }
    }
예제 #27
0
        public void UpdateButtonMap(PlayerIndex playerIndex, Buttons button, CharacterActions characterAction)
        {
            Dictionary <CharacterActions, Buttons> playerCharacterButtonsMap = playersCharacterButtonsMap[playerIndex];

            foreach (KeyValuePair <CharacterActions, Buttons> pair in playerCharacterButtonsMap)
            {
                if (pair.Value.Equals(button))
                {
                    playerCharacterButtonsMap[pair.Key] = playerCharacterButtonsMap[characterAction];
                }
            }
            playerCharacterButtonsMap[characterAction] = button;
        }
예제 #28
0
파일: Character.cs 프로젝트: pontura/mundo
    void Start()
    {
        actions      = GetComponent <CharacterActions>();
        states       = GetComponent <CharacterStates>();
        rotateByDrag = GetComponent <RotateByDrag>();

        CameraChangeView(CharacterEyesCamera.states.OUT);

        Events.ClickedOnScreen  += ClickedOnScreen;
        Events.OnDragging       += OnDragging;
        Events.CameraChangeView += CameraChangeView;
        Events.OnWalking        += OnWalking;
    }
예제 #29
0
            void HandleActionsPopoverItemClicked(object sender, ButtonStringPopover.PopoverEventArgs e)
            {
                Character ch = (Character)((ButtonStringPopover)sender).Data;

                CharacterActionItem item = (CharacterActionItem)e.Tag;

                if (item.Action != CharacterActionType.None)
                {
                    CharacterActions.TakeAction(state._CombatState, item.Action, ch, new List <Character>()
                    {
                        ch
                    }, item.Tag);
                }
            }
예제 #30
0
    public static void Enable()
    {
        //EditorVoxels.Begin();

        /*if (EditorVoxels.MyWorld == null) {
         *      EditorVoxels.MyWorld = GameObject.FindObjectOfType<VoxelEngine.World>();
         * }*/
        //SceneView.onSceneGUIDelegate += OnScene;
        //Debug.Log("Scene GUI : Enabled");
        //UnityEditor.EditorApplication.update += Update;

        CharacterActions MyWindow =
            (CharacterActions)EditorWindow.GetWindow(typeof(CharacterActions));
    }
예제 #31
0
    public override void Start()
    {
        base.Start();
        swapFX.Kill();
        if (active)
        {
            Ship.ActiveShip = this;
            fsm.ChangeState(ShipState.ACTIVE);
        }
        else
        {
            fsm.ChangeState(ShipState.INACTIVE);
        }
        this.collider = GetComponent <Collider2D>();
        input         = new CharacterActions();
        input.Left.AddDefaultBinding(Key.A);
        input.Left.AddDefaultBinding(Key.LeftArrow);
        input.Left.AddDefaultBinding(InputControlType.LeftStickLeft);

        input.Right.AddDefaultBinding(Key.D);
        input.Right.AddDefaultBinding(Key.RightArrow);
        input.Right.AddDefaultBinding(InputControlType.LeftStickRight);

        input.Down.AddDefaultBinding(Key.DownArrow);
        input.Down.AddDefaultBinding(Key.S);
        input.Down.AddDefaultBinding(InputControlType.LeftStickDown);

        input.Up.AddDefaultBinding(Key.UpArrow);
        input.Up.AddDefaultBinding(Key.W);
        input.Up.AddDefaultBinding(InputControlType.LeftStickUp);

        input.Shoot.AddDefaultBinding(Key.Space);
        input.Shoot.AddDefaultBinding(InputControlType.Action1);
        input.Shoot.AddDefaultBinding(Key.Z);
        input.Shoot.AddDefaultBinding(Mouse.LeftButton);

        input.Switch.AddDefaultBinding(Key.Q);
        input.Switch.AddDefaultBinding(Key.E);
        input.Switch.AddDefaultBinding(Key.X);
        input.Switch.AddDefaultBinding(Mouse.RightButton);
        input.Switch.AddDefaultBinding(InputControlType.Action4);

        this.defaultCharacterSprite = characterSprite.sprite;


        this.fsm.Bind(ShipState.ACTIVE, OnActiveStart, OnActiveUpdate, OnActiveEnd);
        this.fsm.Bind(ShipState.INACTIVE, OnInactiveStart, OnInactiveUpdate, OnInactiveEnd);
        this.fsm.Bind(ShipState.SWITCHING, OnSwitchStart, OnSwitchUpdate, OnSwitchEnd);
    }
예제 #32
0
    public void ProcessRestAction(ActionContainer action)
    {
        var character = action.GetExecutingCharacter();

        if (InventionStorage.IsAvailable(Invention.Bed))
        {
            var active = PartyActions.ExecutingCharacter;
            CharacterActions.RaiseCharacterDeterminationBy(1, active);
            CharacterActions.HealCharacterBy(2, active);
        }
        else
        {
            var active = PartyActions.ExecutingCharacter;
            CharacterActions.HealCharacterBy(1, active);
        }
    }
 public Character(Rectangle winSize, Vector2 position, int width, int height,
     string assetName, int textureColumns, int textureLines)
 {
     _windowSize = winSize;
     _position = position;
     _graphicalBounds = new GraphicalBounds<CharacterActions>(new Dictionary<CharacterActions, Rectangle>());
     _sprite = new AnimatedSprite(new Rectangle((int)position.X - width / 2, (int)position.Y - height, width, height), winSize, assetName, textureColumns, textureLines, 30, 1, -1, -1, true);
     _canMove = true;
     _jumping = false;
     _jumpHeight = 0;
     _direction = true; // = right
     _timer = 0;
     _physics = new Physics();
     Life = 1;
     _action = CharacterActions.StandRight;
     _attacks = new Dictionary<CharacterActions, Attack>();
 }
 public Character(Rectangle winSize, Vector2 position, int width, int height, string assetName, int textureColumns, int textureLines)
 {
     this._windowSize = winSize;
     this._position = position;
     Damage = 1;
     this._weapons = new List<Weapon>();
     this._graphicalBounds = new GraphicalBounds<CharacterActions>(new Dictionary<CharacterActions, Rectangle>());
     this._sprite = new AnimatedSprite(new Rectangle((int)position.X - width / 2, (int)position.Y - height, width, height), winSize, assetName, textureColumns, textureLines, 30, 1, -1, -1, true);
     this._canMove = true;
     this._jumping = false;
     this._jumpHeight = 0;
     this._direction = true;
     this._timer = 0;
     this._physics = new Physics(200, 1000);
     this.Life = 1f;
     this._action = CharacterActions.StandRight;
     this._attacks = new Dictionary<CharacterActions, Attack>();
     Armor = 1;
     CanBeStunned = true;
 }
 public virtual void Stand(bool right)
 {
     if (!(right == _direction && (_action == CharacterActions.StandRight || _action == CharacterActions.StandLeft)))
     {
         _direction = right;
         if (right)
             _action = CharacterActions.StandRight;
         else
             _action = CharacterActions.StandLeft;
         actualizeSpriteGraphicalBounds();
     }
 }
예제 #36
0
 void Start()
 {
     //Time.timeScale = 0.1f;
     CurrentGravity = Gravity;
     Brain = GetComponent<CharacterActions>();
 }
예제 #37
0
 public void AddGraphicalBounds(CharacterActions action, Rectangle bounds)
 {
     this._graphicalBounds.set(action, bounds);
 }
 public virtual void Move(bool right)
 {
     if (!this._canMove || right == this._direction && (this._action == CharacterActions.WalkRight || this._action == CharacterActions.WalkLeft))
         return;
     this._direction = right;
     this._action = !right ? CharacterActions.WalkLeft : CharacterActions.WalkRight;
     this.actualizeSpriteGraphicalBounds();
 }
 public virtual void Attack(CharacterActions attack)
 {
     if (_attacks.ContainsKey(attack))
     {
         switch (attack)
         {
             case CharacterActions.Attack1Right:
                 _attacks[attack].Launch(new Rectangle((int)Position.X, _sprite.Position.Y, _sprite.Position.Width / 2, _sprite.Position.Height));
                 break;
             case CharacterActions.Attack1Left:
                 _attacks[attack].Launch(new Rectangle((int)Position.X, (int)Position.Y, _sprite.Position.Width / 2, _sprite.Position.Height));
                 break;
             case CharacterActions.AttackStunLeft:
             case CharacterActions.AttackStunRight:
                 Rectangle r = _sprite.Position;
                 _attacks[attack].Launch(new Rectangle(r.X - 2 * r.Width, r.Y - r.Height, 5 * r.Width, 3 * r.Height));
                 break;
         }
         _canMove = false;
         _timer = _attacks[attack].AttackTime;
     }
 }
 public virtual void Move(bool right)
 {
     if (_canMove && !(right == _direction && (_action == CharacterActions.WalkRight || _action == CharacterActions.WalkLeft)))
     {
         _direction = right;
         if (right)
             _action = CharacterActions.WalkRight;
         else
             _action = CharacterActions.WalkLeft;
         actualizeSpriteGraphicalBounds();
     }
 }
 public virtual void Jump()
 {
     if (!this._canMove || this._jumping)
         return;
     this._action = !this._direction ? CharacterActions.JumpLeft : CharacterActions.JumpRight;
     this.actualizeSpriteGraphicalBounds();
     this._jumpHeight = 0;
     this._jumping = true;
     this._isOnGround = false;
     this._physics.Jump();
 }
 public virtual void Stand(bool right)
 {
     if (right == this._direction && (this._action == CharacterActions.StandRight || this._action == CharacterActions.StandLeft))
         return;
     this._direction = right;
     this._action = !right ? CharacterActions.StandLeft : CharacterActions.StandRight;
     this.actualizeSpriteGraphicalBounds();
 }
 public virtual void ReceiveAttack(float damage = 0.0f, int blockTime = 100)
 {
     if (CanBeStunned)
     {
         this._action = this._direction ? CharacterActions.ReceiveAttackRight : CharacterActions.ReceiveAttackLeft;
         this._canMove = false;
         this._timer = blockTime;
     }
     this.actualizeSpriteGraphicalBounds();
     this.Life -= damage / Armor;
 }
 public override void Attack(CharacterActions attack)
 {
     base.Attack(attack);
     if (_attacks.ContainsKey(attack))
         Mana -= Attacks[attack].Consumption;
 }
예제 #45
0
파일: Fighter.cs 프로젝트: Knifedwarf/AWOV
    //LineCastPhysicsScript FighterPhysics;
    // Use this for initialization
    void Start()
    {
        Body = GetComponent<RaycastPlatformer>();
        Brain = GetComponent<CharacterActions>();
        Brain.UpdateCombatCommands();

        CurrentAttack = Weapon.GetComponent<WeaponScript>().FrontAttack1;
        WeaponPropoerties = Weapon.GetComponent<WeaponScript>();
        WeaponVisuals.sprite = WeaponPropoerties.IdleRightSprite;
    }
 public virtual void ReceiveAttack(float damage = 0, int blockTime = 100)
 {
     _action = _direction ? CharacterActions.ReceiveAttackRight : CharacterActions.ReceiveAttackLeft;
     _canMove = false;
     _timer = blockTime;
     actualizeSpriteGraphicalBounds();
     Life -= damage;
 }
예제 #47
0
 public ActionStates GetCharacterActionState(PlayerIndex playerIndex, CharacterActions characterAction)
 {
     return playersCharacterActionStatesMap[playerIndex][characterAction];
 }
 public virtual void Paralize(int time)
 {
     _canMove = false;
     _timer = time;
     _action = CharacterActions.Paralized;
 }
 public void Init( CharacterActions actions )
 {
     this.actions = actions;
 }
 public virtual void Jump()
 {
     if (_canMove && !_jumping)
     {
         if (_direction)
             _action = CharacterActions.JumpRight;
         else
             _action = CharacterActions.JumpLeft;
         actualizeSpriteGraphicalBounds();
         _jumpHeight = 0;
         _jumping = true;
         _isOnGround = false;
         _physics.Jump();
     }
 }
 public virtual void AddAttack(CharacterActions action, Attack attac)
 {
     this._attacks.Add(action, attac);
 }
 public virtual void Attack(CharacterActions attack)
 {
     if (!this._attacks.ContainsKey(attack))
         return;
     Rectangle position;
     switch (attack)
     {
         case CharacterActions.Attack1Right:
             this._attacks[attack].Launch(new Rectangle((int)this.Position.X, this._sprite.Position.Y, this._sprite.Position.Width / 2, this._sprite.Position.Height));
             break;
         case CharacterActions.Attack1Left:
             this._attacks[attack].Launch(new Rectangle((int)this.Position.X - this._sprite.Position.Width / 2, (int)this.Position.Y - this._sprite.Position.Height, this._sprite.Position.Width / 2, this._sprite.Position.Height));
             break;
         case CharacterActions.AttackStunRight:
         case CharacterActions.AttackStunLeft:
             position = this._sprite.Position;
             this._attacks[attack].Launch(new Rectangle(position.X - 2 * position.Width, position.Y - position.Height, 5 * position.Width, (int)(2.20000004768372 * (double)position.Height)));
             break;
         case CharacterActions.Attack2Right:
             position = this._sprite.Position;
             this._attacks[attack].Launch(new Rectangle(position.X - position.Width / 2, position.Y - position.Height, position.Width * 2, position.Height));
             break;
         case CharacterActions.Attack2Left:
             position = this._sprite.Position;
             this._attacks[attack].Launch(new Rectangle(position.X - position.Width / 2, position.Y - position.Height, position.Width * 2, position.Height));
             break;
     }
     Game1.son.Play(Sons.Hit);
     this._canMove = false;
     this._timer = this._attacks[attack].AttackTime;
     this._action = attack;
 }
 public virtual void Paralize(int time)
 {
     if (CanBeStunned)
     {
         this._canMove = false;
         this._timer = time;
         this._action = CharacterActions.Paralized;
     }
 }
 public override void Attack(CharacterActions attack)
 {
     if ((double)this.Mana > (double)this._attacks[attack].Consumption / (double)(1 + this.Experience.Level / 7))
         base.Attack(attack);
     if (!this._attacks.ContainsKey(attack))
         return;
     this.Mana -= this.Attacks[attack].Consumption / (float)(1 + this.Experience.Level / 7);
 }
예제 #55
0
 private void UpdatePlayerCharacterActionStatesMapOnPressed(PlayerIndex playerIndex, CharacterActions characterAction)
 {
     Dictionary<CharacterActions, ActionStates> playerCharacterActionMap = playersCharacterActionStatesMap[playerIndex];
     if (playerCharacterActionMap[characterAction] == ActionStates.Pressed)
     {
         playerCharacterActionMap[characterAction] = ActionStates.Held;
     }
     else if (playerCharacterActionMap[characterAction] == ActionStates.Released)
     {
         playerCharacterActionMap[characterAction] = ActionStates.Pressed;
     }
 }
예제 #56
0
 void Awake()
 {
     _fsm = new FSM<ActionStates>(); //creates a new FSM for this object
     AddStates(); //add states to the FSM
     MakeTransitions(); //Creates valid transitions for all the states in the FSM
     _instance = this; //creates a new instace of the object
 }
 public void Init( InputBindings bindings )
 {
     this.bindings = bindings;
     actions = this.bindings.Actions;
 }