Exemplo n.º 1
0
        /// <summary>
        /// Creates a command object.
        /// </summary>
        /// <param name="crab">The crab whos new location will be chosen</param>
        /// <returns>The created command object</returns>
        public static ICommand Create(ICrab crab)
        {
            ChooseCrabLocation command = new ChooseCrabLocation
            {
                crab = crab
            };

            return(command);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Mouse click handler that sets the selected elements.
        /// </summary>
        void HandleMouseClick()
        {
            Vector3    worldPosition = Input.mousePosition;
            Vector2    worldPoint    = Camera.main.ScreenToWorldPoint(worldPosition);
            Vector2Int cell          = Map.LocalToCell(worldPoint);

            ICrab crab = Map.GetMapElementAtCell <ICrab>(cell);

            SetCurrentSpriteRenderer(crab?.SpriteRenderer);
            SetMapElement(crab);
        }