Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Snake Ladder Problem");

            int           roll;
            MovementLogic ml = new MovementLogic();
            //Use Case 1
            Player player = ml.InitialisePlayer();

            //Use Case 2
            roll = new MovementLogic().RollDice();
            Console.WriteLine("Player " + player.getName() + " has rolled a " + roll);

            //Use Case 3
            Console.WriteLine("Player " + player.getName() + " gets " + ml.MovePlayer(player, roll) + " gets to " + player.getPosition());


            //Use Case 4,5,6
            ml.PlayGame(player);


            Player player2 = ml.InitialisePlayer();

            //Use Case 7
            ml.Play2PlayerGame(player, player2);

            //Temp Read Line
            Console.ReadLine();
        }
        public void Setup()
        {
            _coordinatesLogicMock = new Mock <ICoordinatesLogic>();
            _healthLogicMock      = new Mock <IHealthLogic>();
            _animalLogicMock      = new Mock <IAnimalLogic>();

            _movementLogic = new MovementLogic(_coordinatesLogicMock.Object, _healthLogicMock.Object,
                                               _animalLogicMock.Object);
        }
Esempio n. 3
0
 public void Move()
 {
     if (HealthLeft > 0)
     {
         MovementLogic.Move();
     }
     else
     {
         Console.WriteLine("Unit dead");
     }
 }
Esempio n. 4
0
        // Get tiles world data logic
        #region
        public static List <Tile> GetAllValidMoveableTilesForEntities(World world)
        {
            // This method checks every tile in a world object, and returns all tiles
            // that a living entity is able to move onto and over

            List <Tile> tilesReturned = new List <Tile>();

            foreach (Tile tile in GetAllTilesFromWorldDictionary(world))
            {
                if (MovementLogic.IsLocationMoveable(tile))
                {
                    tilesReturned.Add(tile);
                }
            }

            return(tilesReturned);
        }
Esempio n. 5
0
        public static List <Tile> GetAllValidNewItemLocationTiles(World world)
        {
            // This method checks every tile in a world object, and returns all tiles
            // that would be a valid location to create a new item.

            List <Tile> tilesReturned = new List <Tile>();

            foreach (Tile tile in GetAllTilesFromWorldDictionary(world))
            {
                if (MovementLogic.IsLocationMoveable(tile) &&
                    tile.MyItem == null)
                {
                    tilesReturned.Add(tile);
                }
            }

            return(tilesReturned);
        }
Esempio n. 6
0
    public void Init()
    {
        if (gameObject.HasComponent <Animator>())
        {
            animPlayer = GetComponent <Animator>();
        }
        else
        {
            throw new NotImplementedException("Generating Animator dynamically not supported. Add Animator with animations first.");
        }

        tilemap = mapGrid.GetComponentInChildren <Tilemap>();

        movePoint.parent = null;

        moveLogic = new MovementLogic(moveSpeed, mapGrid, movePoint, direction, animPlayer, gameObject);


        startingPosition  = transform.position;
        startingDirection = moveLogic.direction;
    }
Esempio n. 7
0
 /// <summary>
 /// Calling before start.
 /// </summary>
 private void Awake()
 {
     // Get scripts and components.
     _actionJumpLogicScript = GameObject.FindGameObjectWithTag("Player").GetComponent <ActionJumpLogic>();
     _movementLogicScript   = GameObject.FindGameObjectWithTag("Player").GetComponent <MovementLogic>();
 }
 /// <summary>
 /// Calling before start.
 /// </summary>
 private void Awake()
 {
     // Get scripts and components.
     _joystickScript      = GetComponent <Joystick>();
     _movementLogicScript = FindObjectOfType <MovementLogic>();
 }
Esempio n. 9
0
 // Start is called before the first frame update
 void Start()
 {
     objectMovementLogic = this.gameObject.GetComponent <MovementLogic>();
     animBody            = this.gameObject.GetComponent <Animator>();
 }
 /// <summary>
 /// Calling before start.
 /// </summary>
 private void Awake()
 {
     // Get scripts and components.
     _actionJumpLogicScript = FindObjectOfType <ActionJumpLogic>();
     _movementLogicScript   = FindObjectOfType <MovementLogic>();
 }
 /// <summary>
 /// Calling before start.
 /// </summary>
 private void Awake()
 {
     // Get scripts and components.
     _joystickScript      = GetComponent <Joystick>();
     _movementLogicScript = GameObject.FindGameObjectWithTag("Player").GetComponent <MovementLogic>();
 }
Esempio n. 12
0
 void Awake()
 {
     board = new BoardArray(transform.position);
     logic = new MovementLogic(board);
 }
 // Perform specific abilities logic
 #region
 public static void PerformMove(LivingEntity caster, Tile destination)
 {
     MovementLogic.MoveEntity(caster, destination);
 }
Esempio n. 14
0
 private void Awake()
 {
     Instance = this;
 }
 private void Awake()
 {
     movementLogic    = GetComponent <MovementLogic>();
     movementAnimator = GetComponent <Animator>();
 }