Exemplo n.º 1
0
        public static Command_ShootMissile Create(Ship shipIn, Vector3 targetIn)
        {
            Command_ShootMissile command = ScriptableObject.CreateInstance("Command_ShootMissile") as Command_ShootMissile;

            command.Init(shipIn, targetIn);
            return(command);
        }
Exemplo n.º 2
0
        private void OnLeftMouseClick()
        {
            RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);

            if (hit.collider != null)
            {
                var clicked = hit.collider.GetComponent <Ship>();
                if (clicked != null && currentPlayer.Number == clicked.Owner.Number)
                {
                    SetSelection(clicked);
                }
            }
            else
            {
                Command command = Command_ShootMissile.Create(currentSelection, Camera.main.ScreenToWorldPoint(Input.mousePosition));
                currentSelection.SetCommand(currentSelection.GetUnassignedCommand(), command);
                updateCommandQueueUI();
            }
        }