Exemplo n.º 1
0
    void Update()
    {
        timer += Time.deltaTime;

        if (timer > compute_inteval)
        {
            //得到当前帧的推力
            steering_force = Vector3.zero;
            //遍历当前激活的移动并添加推力*权重
            foreach (var v in move_dic)
            {
                MoveBase move_base = v.Value;
                if (move_base != null)
                {
                    steering_force += move_base.Force() * move_base.weight;
                }
            }

            //移除完成的移动
            foreach (var v in arrive_remove)
            {
                move_dic[v] = null;
            }
            arrive_remove.Clear();

            //限制最大力
            steering_force = Vector3.ClampMagnitude(steering_force, max_force);
            //加速度=推力/质量
            acceleration = steering_force / mass;

            timer = 0;
        }
    }
 public void SetDataMove(MoveBase move)
 {
     nameText.text     = move.Name;
     typeText.text     = move.Type.ToString();
     categoryText.text = move.Category.ToString();
     powerText.text    = move.Power.ToString();
     accuracyText.text = move.Accurarcy.ToString();
 }
Exemplo n.º 3
0
 public void SetMoveData(List <MoveBase> currentMoves, MoveBase newMove)
 {
     for (int i = 0; i < currentMoves.Count; i++)
     {
         moveTexts[i].text = currentMoves[i].Name;      //Set the name of the moves already known
     }
     moveTexts[currentMoves.Count].text = newMove.Name; //Set the name of the new move
 }
Exemplo n.º 4
0
        public Game(GameDto dto, IMapper mapper)
            : base(dto.Board)
        {
            mapper.Map(dto, this);

            MyOriginalTiles = (char[])MyTiles.Clone();
            Move            = new MoveBase(this);
        }
Exemplo n.º 5
0
    void Start()
    {
        _move  = GetComponent <MoveBase>();
        _speed = _move.Speed;

        _detect = GetComponent <DetectEnemy>();

        StartCoroutine(AttackEnemy());
    }
Exemplo n.º 6
0
    public void SetMoveData(List <MoveBase> currentMoves, MoveBase newMove)
    {
        for (int i = 0; i < currentMoves.Count; i++)
        {
            moveText[i].text = currentMoves[i].Name;
        }

        moveText[currentMoves.Count].text = newMove.Name;
    }
 void HandleEnemyAction()
 {     // Wait
     if (NetworkManager.Instance.hasMove())
     { //Build Move
         var      mMsg  = NetworkManager.Instance.GetMove();
         MoveBase mBase = MoveBaseList.GetMoveBase(mMsg.MoveName);
         Move     move  = new Move(mBase);
         StartCoroutine(PerformEnemyMove(move, mMsg.hit));
     }
 }
Exemplo n.º 8
0
    IEnumerator ChooseMoveToForget(Animal animal, MoveBase newMove)
    {
        state = BattleState.Busy;
        yield return(dialogBox.TypeDialog($"Choose a move to forget."));

        moveSelectionUI.gameObject.SetActive(true);
        //Set Move Names
        moveSelectionUI.SetMoveData(animal.Moves.Select(x => x.Base).ToList(), newMove);

        state = BattleState.MoveToForget;
    }
Exemplo n.º 9
0
    IEnumerator ChooseMoveToForget(Pokemon pokemon, MoveBase newMove)
    {
        state = BattleState.Busy;
        yield return(dialogBox.TypeDialog($"Choose a move you want to forget"));

        moveSelectionUI.gameObject.SetActive(true);
        moveSelectionUI.SetMoveData(pokemon.Moves.Select(x => x.Base).ToList(), newMove);
        moveToLearn = newMove;

        state = BattleState.MoveToForget;
    }
Exemplo n.º 10
0
    //take the list of current moves and a reference to a new move
    public void SetMoveData(List <MoveBase> currentMoves, MoveBase newMove)
    {
        //set the names of the current moves
        for (int i = 0; i < currentMoves.Count; ++i)
        {
            //set the list of the names to the current
            moveTexts[i].text = currentMoves[i].Name;
        }

        moveTexts[currentMoves.Count].text = newMove.Name;
    }
    protected override void Awake()
    {
        base.Awake();

        _moveBase         = GetComponent <MoveBase>();
        _movePositionBase = GetComponent <MovePositionBase>();
        _enemyAI          = GetComponent <EnemyAI>();
        _enemyBattleAI    = GetComponent <EnemyBattleAI>();

        Stats.OnCharacterDeath += Die;
    }
Exemplo n.º 12
0
    IEnumerator ChooseMoveToForget(Pokemon pokemon, MoveBase newMove)
    {
        state = BattleState.Busy;
        yield return(dialogBox.TypeDialog($"Choisissez une attaque à oublier."));

        moveSelectionUI.gameObject.SetActive(true);
        moveSelectionUI.SetMoveData(pokemon.Moves.Select(x => x.Base).ToList(), newMove); //Set the data using Select and Linq to acces base.
        moveToLearn = newMove;

        state = BattleState.MoveToForget; //Finally move to the moveToForget state
    }
Exemplo n.º 13
0
    //this is the action of choosing what move to forget
    IEnumerator ChooseMoveToForget(Creature creature, MoveBase newMove)
    {
        state = BattleState.Busy;
        yield return(dialogueBox.TypeDialog($"Choose a move you want to forget"));

        moveSelectionUI.gameObject.SetActive(true);
        //will set all the names in the move selection UI and
        //convert a list of move class to a list of moveBase class
        moveSelectionUI.SetMoveData(creature.Moves.Select(x => x.Base).ToList(), newMove);
        moveToLearn = newMove;

        state = BattleState.MoveToForget;
    }
Exemplo n.º 14
0
    protected override void Awake()
    {
        base.Awake();

        _moveBase     = GetComponent <MoveBase>();
        _inputHandler = GetComponent <InputHandler>();
        Inventory     = GetComponent <Inventory>();

        _enableAttack      = true;
        _enableInput       = true;
        _waitForNextAttack = new WaitForSeconds(_attackSpeed);

        Stats.SetCharacterStats(_playerSpec);

        Stats.OnCharacterDeath += Die;
    }
Exemplo n.º 15
0
    public void HandleUpdate()
    {
        switch (state)
        {
        case BattleState.ActionSelection:
            HandleActionSelection();     //Function to make the player able to choose an action
            break;

        case BattleState.MoveSelection:
            HandleMoveSelection();
            break;

        case BattleState.PartyScreen:
            HandlePartySelection();
            break;

        case BattleState.AboutToUse:
            HandleAboutSelection();
            break;

        case BattleState.MoveToForget:
            Action <int> onMoveSelected = (moveIndex) =>    //This part is all a reference to the action used in the HandleMoveSelection
            {
                moveSelectionUI.gameObject.SetActive(false);
                if (moveIndex == PokemonBase.MaxNumberOfMoves)
                {
                    //Don't learn the new move
                    StartCoroutine(dialogBox.TypeDialog($"{playerUnit.Pokemon.Base.Name} n'a pas apprit {moveToLearn.Name}."));
                }
                else
                {
                    //Forget selected move and learn the new
                    var selectedMove = playerUnit.Pokemon.Moves[moveIndex].Base;
                    StartCoroutine(dialogBox.TypeDialog($"{playerUnit.Pokemon.Base.Name} a apprit {moveToLearn.Name} à la place de {selectedMove.Name}."));

                    playerUnit.Pokemon.Moves[moveIndex] = new Move(moveToLearn);
                }

                moveToLearn = null;
                state       = BattleState.RunningTurn;
            };

            moveSelectionUI.HandleMoveSelection(onMoveSelected);
            break;
        }
    }
Exemplo n.º 16
0
    //what to do while in the action select screen
    public void HandleUpdate()
    {
        if (state == BattleState.ActionSelection)
        {
            HandleActionSelection();
        }
        else if (state == BattleState.MoveSelection)
        {
            HandleMoveSelection();
        }
        else if (state == BattleState.BattleTeamScreen)
        {
            HandleBattleTeamSelection();
        }
        else if (state == BattleState.AboutToUse)
        {
            HandleAboutToUse();
        }
        else if (state == BattleState.MoveToForget)
        {
            Action <int> onMoveSelection = (moveIndex) =>
            {
                moveSelectionUI.gameObject.SetActive(false);
                if (moveIndex == Creature.MaxNumberOfMoves)
                {
                    //dont learn new move
                    StartCoroutine(dialogueBox.TypeDialog($"{playerUnit.Creature.Base.Name} did not learn {moveToLearn}"));
                }
                else
                {
                    //reference to old move
                    var selectedMove = playerUnit.Creature.Moves[moveIndex].Base;
                    //dialogue stating you will forget a move and learn...
                    StartCoroutine(dialogueBox.TypeDialog($"{playerUnit.Creature.Base.Name} forgot {selectedMove.Name} and learned {moveToLearn.Name}"));

                    //forgot old move
                    playerUnit.Creature.Moves[moveIndex] = new Move(moveToLearn);
                }

                moveToLearn = null;
                state       = BattleState.RunningTurn;
            };
            moveSelectionUI.HandleMoveSelection(onMoveSelection);
        }
    }
Exemplo n.º 17
0
    //This handles everything that happens
    public void HandleUpdate()
    {
        if (state == BattleState.ActionSelection)
        {
            HandleActionSelection();
        }
        else if (state == BattleState.MoveSelection)
        {
            HandleMoveSelection();
        }
        else if (state == BattleState.PartyScreen)
        {
            HandlePartySelection();
        }
        else if (state == BattleState.AboutToUse)
        {
            HandleAboutToUse();
        }
        else if (state == BattleState.MoveToForget)
        {
            Action <int> onMoveSelected = (moveIndex) =>
            {
                moveSelectionUI.gameObject.SetActive(false);
                if (moveIndex == PokemonBase.MaxNumOfMoves)
                {
                    //Don't learn move
                    StartCoroutine(dialogBox.TypeDialog($"{PlayerUnit.Pokemon.Base.Name} did not learn {moveToLearn.Name}!"));
                }
                else
                {
                    //Forget the selected move and learn new one
                    var selectedMove = PlayerUnit.Pokemon.Moves[moveIndex].Base;
                    StartCoroutine(dialogBox.TypeDialog($"{PlayerUnit.Pokemon.Base.Name} forgot {selectedMove.Name} and learned {moveToLearn.Name}!"));

                    PlayerUnit.Pokemon.Moves[moveIndex] = new Move(moveToLearn);
                }

                moveToLearn = null;
                state       = BattleState.RunningTurn;
            };

            moveSelectionUI.HandleMoveSelection(onMoveSelected);
        }
    }
Exemplo n.º 18
0
 public Move(MoveBase skeleton, int points)
 {
     Skeleton = skeleton;
     Points   = points;
 }
Exemplo n.º 19
0
    // public int Attackpower {get; set; }

    public CharMove(MoveBase cBase)
    {
        Base     = cBase;
        MOVECOST = cBase.MoveCost;
    }
Exemplo n.º 20
0
 /// <summary>
 /// Constructor for moves that are added when loading a saved monster.
 /// This allows for persisting remaining Energy levels.
 /// </summary>
 /// <param name="mBase"></param>
 /// <param name="mEnergy"></param>
 public MoveObj(MoveBase mBase, int mEnergy)
 {
     Base   = mBase;
     Energy = mEnergy;
 }
Exemplo n.º 21
0
 public Move(MoveBase _base)
 {
     Base = _base;
     PP   = _base.Pp; //de inicio tiene el maximo de PPs
 }
Exemplo n.º 22
0
 public Move(MoveBase pBase)
 {
     Base     = pBase;
     Affinity = pBase.Affinity;
 }
Exemplo n.º 23
0
 protected virtual void Awake()
 {
     _moveBase = gameObject.GetAddComponent <MoveBase> ();
     _moveBase.m_MoveFinishCallBack = OnHandleMoveFinish;
 }
Exemplo n.º 24
0
 public Move(MoveBase mBase)
 {
     Base = mBase;
     MP   = mBase.MP;
 }
Exemplo n.º 25
0
 public Move(MoveBase mBase)
 {
     _Base    = mBase;
     maxTimes = mBase.getMaxTimes();
 }
Exemplo n.º 26
0
 public MoveCommand(MoveBase target, InputBuffer buffer)
 {
     this.target = target;
     this.buffer = buffer;
 }
Exemplo n.º 27
0
    // private Vector2 _pointCollision = Vector2.zero;

    private void Awake()
    {
        _detect = GetComponent <DetectEnemy>();
        _move   = GetComponent <MoveBase>();
        //   _health.EventDie += OnDie;
    }
 public void ProcessPlayerMove(string gameId, string player, MoveBase move)
 {
     var game = _games.First(x => x.Key.GameId == gameId);
     game.Value.RecordResult(player, move);
 }
Exemplo n.º 29
0
 public Move(MoveBase pMoveBase)
 {
     MoveBase = pMoveBase;
 }
Exemplo n.º 30
0
 public Move(MoveBase pBase)
 {
     Base = pBase;
     PP   = pBase.Pp;
 }
Exemplo n.º 31
0
 public Move(MoveBase skeleton)
 {
     Skeleton = skeleton;
     Points   = skeleton.points;
 }